yading@10: \input texinfo @c -*- texinfo -*- yading@10: yading@10: @settitle ffserver Documentation yading@10: @titlepage yading@10: @center @titlefont{ffserver Documentation} yading@10: @end titlepage yading@10: yading@10: @top yading@10: yading@10: @contents yading@10: yading@10: @chapter Synopsis yading@10: yading@10: ffserver [@var{options}] yading@10: yading@10: @chapter Description yading@10: @c man begin DESCRIPTION yading@10: yading@10: @command{ffserver} is a streaming server for both audio and video. It yading@10: supports several live feeds, streaming from files and time shifting on yading@10: live feeds (you can seek to positions in the past on each live feed, yading@10: provided you specify a big enough feed storage in yading@10: @file{ffserver.conf}). yading@10: yading@10: @command{ffserver} receives prerecorded files or FFM streams from some yading@10: @command{ffmpeg} instance as input, then streams them over yading@10: RTP/RTSP/HTTP. yading@10: yading@10: An @command{ffserver} instance will listen on some port as specified yading@10: in the configuration file. You can launch one or more instances of yading@10: @command{ffmpeg} and send one or more FFM streams to the port where yading@10: ffserver is expecting to receive them. Alternately, you can make yading@10: @command{ffserver} launch such @command{ffmpeg} instances at startup. yading@10: yading@10: Input streams are called feeds, and each one is specified by a yading@10: @code{} section in the configuration file. yading@10: yading@10: For each feed you can have different output streams in various yading@10: formats, each one specified by a @code{} section in the yading@10: configuration file. yading@10: yading@10: @section Status stream yading@10: yading@10: ffserver supports an HTTP interface which exposes the current status yading@10: of the server. yading@10: yading@10: Simply point your browser to the address of the special status stream yading@10: specified in the configuration file. yading@10: yading@10: For example if you have: yading@10: @example yading@10: yading@10: Format status yading@10: yading@10: # Only allow local people to get the status yading@10: ACL allow localhost yading@10: ACL allow 192.168.0.0 192.168.255.255 yading@10: yading@10: @end example yading@10: yading@10: then the server will post a page with the status information when yading@10: the special stream @file{status.html} is requested. yading@10: yading@10: @section What can this do? yading@10: yading@10: When properly configured and running, you can capture video and audio in real yading@10: time from a suitable capture card, and stream it out over the Internet to yading@10: either Windows Media Player or RealAudio player (with some restrictions). yading@10: yading@10: It can also stream from files, though that is currently broken. Very often, a yading@10: web server can be used to serve up the files just as well. yading@10: yading@10: It can stream prerecorded video from .ffm files, though it is somewhat tricky yading@10: to make it work correctly. yading@10: yading@10: @section How do I make it work? yading@10: yading@10: First, build the kit. It *really* helps to have installed LAME first. Then when yading@10: you run the ffserver ./configure, make sure that you have the yading@10: @code{--enable-libmp3lame} flag turned on. yading@10: yading@10: LAME is important as it allows for streaming audio to Windows Media Player. yading@10: Don't ask why the other audio types do not work. yading@10: yading@10: As a simple test, just run the following two command lines where INPUTFILE yading@10: is some file which you can decode with ffmpeg: yading@10: yading@10: @example yading@10: ffserver -f doc/ffserver.conf & yading@10: ffmpeg -i INPUTFILE http://localhost:8090/feed1.ffm yading@10: @end example yading@10: yading@10: At this point you should be able to go to your Windows machine and fire up yading@10: Windows Media Player (WMP). Go to Open URL and enter yading@10: yading@10: @example yading@10: http://:8090/test.asf yading@10: @end example yading@10: yading@10: You should (after a short delay) see video and hear audio. yading@10: yading@10: WARNING: trying to stream test1.mpg doesn't work with WMP as it tries to yading@10: transfer the entire file before starting to play. yading@10: The same is true of AVI files. yading@10: yading@10: @section What happens next? yading@10: yading@10: You should edit the ffserver.conf file to suit your needs (in terms of yading@10: frame rates etc). Then install ffserver and ffmpeg, write a script to start yading@10: them up, and off you go. yading@10: yading@10: @section Troubleshooting yading@10: yading@10: @subsection I don't hear any audio, but video is fine. yading@10: yading@10: Maybe you didn't install LAME, or got your ./configure statement wrong. Check yading@10: the ffmpeg output to see if a line referring to MP3 is present. If not, then yading@10: your configuration was incorrect. If it is, then maybe your wiring is not yading@10: set up correctly. Maybe the sound card is not getting data from the right yading@10: input source. Maybe you have a really awful audio interface (like I do) yading@10: that only captures in stereo and also requires that one channel be flipped. yading@10: If you are one of these people, then export 'AUDIO_FLIP_LEFT=1' before yading@10: starting ffmpeg. yading@10: yading@10: @subsection The audio and video lose sync after a while. yading@10: yading@10: Yes, they do. yading@10: yading@10: @subsection After a long while, the video update rate goes way down in WMP. yading@10: yading@10: Yes, it does. Who knows why? yading@10: yading@10: @subsection WMP 6.4 behaves differently to WMP 7. yading@10: yading@10: Yes, it does. Any thoughts on this would be gratefully received. These yading@10: differences extend to embedding WMP into a web page. [There are two yading@10: object IDs that you can use: The old one, which does not play well, and yading@10: the new one, which does (both tested on the same system). However, yading@10: I suspect that the new one is not available unless you have installed WMP 7]. yading@10: yading@10: @section What else can it do? yading@10: yading@10: You can replay video from .ffm files that was recorded earlier. yading@10: However, there are a number of caveats, including the fact that the yading@10: ffserver parameters must match the original parameters used to record the yading@10: file. If they do not, then ffserver deletes the file before recording into it. yading@10: (Now that I write this, it seems broken). yading@10: yading@10: You can fiddle with many of the codec choices and encoding parameters, and yading@10: there are a bunch more parameters that you cannot control. Post a message yading@10: to the mailing list if there are some 'must have' parameters. Look in yading@10: ffserver.conf for a list of the currently available controls. yading@10: yading@10: It will automatically generate the ASX or RAM files that are often used yading@10: in browsers. These files are actually redirections to the underlying ASF yading@10: or RM file. The reason for this is that the browser often fetches the yading@10: entire file before starting up the external viewer. The redirection files yading@10: are very small and can be transferred quickly. [The stream itself is yading@10: often 'infinite' and thus the browser tries to download it and never yading@10: finishes.] yading@10: yading@10: @section Tips yading@10: yading@10: * When you connect to a live stream, most players (WMP, RA, etc) want to yading@10: buffer a certain number of seconds of material so that they can display the yading@10: signal continuously. However, ffserver (by default) starts sending data yading@10: in realtime. This means that there is a pause of a few seconds while the yading@10: buffering is being done by the player. The good news is that this can be yading@10: cured by adding a '?buffer=5' to the end of the URL. This means that the yading@10: stream should start 5 seconds in the past -- and so the first 5 seconds yading@10: of the stream are sent as fast as the network will allow. It will then yading@10: slow down to real time. This noticeably improves the startup experience. yading@10: yading@10: You can also add a 'Preroll 15' statement into the ffserver.conf that will yading@10: add the 15 second prebuffering on all requests that do not otherwise yading@10: specify a time. In addition, ffserver will skip frames until a key_frame yading@10: is found. This further reduces the startup delay by not transferring data yading@10: that will be discarded. yading@10: yading@10: * You may want to adjust the MaxBandwidth in the ffserver.conf to limit yading@10: the amount of bandwidth consumed by live streams. yading@10: yading@10: @section Why does the ?buffer / Preroll stop working after a time? yading@10: yading@10: It turns out that (on my machine at least) the number of frames successfully yading@10: grabbed is marginally less than the number that ought to be grabbed. This yading@10: means that the timestamp in the encoded data stream gets behind realtime. yading@10: This means that if you say 'Preroll 10', then when the stream gets 10 yading@10: or more seconds behind, there is no Preroll left. yading@10: yading@10: Fixing this requires a change in the internals of how timestamps are yading@10: handled. yading@10: yading@10: @section Does the @code{?date=} stuff work. yading@10: yading@10: Yes (subject to the limitation outlined above). Also note that whenever you yading@10: start ffserver, it deletes the ffm file (if any parameters have changed), yading@10: thus wiping out what you had recorded before. yading@10: yading@10: The format of the @code{?date=xxxxxx} is fairly flexible. You should use one yading@10: of the following formats (the 'T' is literal): yading@10: yading@10: @example yading@10: * YYYY-MM-DDTHH:MM:SS (localtime) yading@10: * YYYY-MM-DDTHH:MM:SSZ (UTC) yading@10: @end example yading@10: yading@10: You can omit the YYYY-MM-DD, and then it refers to the current day. However yading@10: note that @samp{?date=16:00:00} refers to 16:00 on the current day -- this yading@10: may be in the future and so is unlikely to be useful. yading@10: yading@10: You use this by adding the ?date= to the end of the URL for the stream. yading@10: For example: @samp{http://localhost:8080/test.asf?date=2002-07-26T23:05:00}. yading@10: @c man end yading@10: yading@10: @section What is FFM, FFM2 yading@10: yading@10: FFM and FFM2 are formats used by ffserver. They allow storing a wide variety of yading@10: video and audio streams and encoding options, and can store a moving time segment yading@10: of an infinite movie or a whole movie. yading@10: yading@10: FFM is version specific, and there is limited compatibility of FFM files yading@10: generated by one version of ffmpeg/ffserver and another version of yading@10: ffmpeg/ffserver. It may work but it is not guaranteed to work. yading@10: yading@10: FFM2 is extensible while maintaining compatibility and should work between yading@10: differing versions of tools. FFM2 is the default. yading@10: yading@10: @chapter Options yading@10: @c man begin OPTIONS yading@10: yading@10: @include avtools-common-opts.texi yading@10: yading@10: @section Main options yading@10: yading@10: @table @option yading@10: @item -f @var{configfile} yading@10: Use @file{configfile} instead of @file{/etc/ffserver.conf}. yading@10: @item -n yading@10: Enable no-launch mode. This option disables all the Launch directives yading@10: within the various sections. Since ffserver will not launch yading@10: any ffmpeg instances, you will have to launch them manually. yading@10: @item -d yading@10: Enable debug mode. This option increases log verbosity, directs log yading@10: messages to stdout. yading@10: @end table yading@10: @c man end yading@10: yading@10: @ifset config-all yading@10: @include all-components.texi yading@10: @end ifset yading@10: yading@10: @chapter See Also yading@10: yading@10: @ifhtml yading@10: @ifset config-all yading@10: @url{ffserver.html,ffserver}, yading@10: @end ifset yading@10: @ifset config-not-all yading@10: @url{ffserver-all.html,ffserver-all}, yading@10: @end ifset yading@10: the @file{doc/ffserver.conf} example, yading@10: @url{ffmpeg.html,ffmpeg}, @url{ffplay.html,ffplay}, @url{ffprobe.html,ffprobe}, yading@10: @url{ffmpeg-utils.html,ffmpeg-utils}, yading@10: @url{ffmpeg-scaler.html,ffmpeg-scaler}, yading@10: @url{ffmpeg-resampler.html,ffmpeg-resampler}, yading@10: @url{ffmpeg-codecs.html,ffmpeg-codecs}, yading@10: @url{ffmpeg-bitstream-filters.html,ffmpeg-bitstream-filters}, yading@10: @url{ffmpeg-formats.html,ffmpeg-formats}, yading@10: @url{ffmpeg-devices.html,ffmpeg-devices}, yading@10: @url{ffmpeg-protocols.html,ffmpeg-protocols}, yading@10: @url{ffmpeg-filters.html,ffmpeg-filters} yading@10: @end ifhtml yading@10: yading@10: @ifnothtml yading@10: @ifset config-all yading@10: ffserver(1), yading@10: @end ifset yading@10: @ifset config-not-all yading@10: ffserver-all(1), yading@10: @end ifset yading@10: the @file{doc/ffserver.conf} example, ffmpeg(1), ffplay(1), ffprobe(1), yading@10: ffmpeg-utils(1), ffmpeg-scaler(1), ffmpeg-resampler(1), yading@10: ffmpeg-codecs(1), ffmpeg-bitstream-filters(1), ffmpeg-formats(1), yading@10: ffmpeg-devices(1), ffmpeg-protocols(1), ffmpeg-filters(1) yading@10: @end ifnothtml yading@10: yading@10: @include authors.texi yading@10: yading@10: @ignore yading@10: yading@10: @setfilename ffserver yading@10: @settitle ffserver video server yading@10: yading@10: @end ignore yading@10: yading@10: @bye