yading@10: =head1 NAME yading@10: yading@10: ffserver - ffserver video server yading@10: yading@10: =head1 SYNOPSIS yading@10: yading@10: yading@10: ffserver [I] yading@10: yading@10: yading@10: =head1 DESCRIPTION yading@10: yading@10: yading@10: B 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: F). yading@10: yading@10: B receives prerecorded files or FFM streams from some yading@10: B instance as input, then streams them over yading@10: RTP/RTSP/HTTP. yading@10: yading@10: An B instance will listen on some port as specified yading@10: in the configuration file. You can launch one or more instances of yading@10: B 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: B launch such B instances at startup. yading@10: yading@10: Input streams are called feeds, and each one is specified by a yading@10: CFeedE> 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 CStreamE> section in the yading@10: configuration file. yading@10: yading@10: yading@10: =head2 Status stream yading@10: 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: 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: yading@10: yading@10: then the server will post a page with the status information when yading@10: the special stream F is requested. yading@10: yading@10: yading@10: =head2 What can this do? yading@10: 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: yading@10: =head2 How do I make it work? yading@10: 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: C<--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: yading@10: ffserver -f doc/ffserver.conf & yading@10: ffmpeg -i INPUTFILE http://localhost:8090/feed1.ffm yading@10: 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: yading@10: http://:8090/test.asf yading@10: 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: yading@10: =head2 What happens next? yading@10: 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: yading@10: =head2 Troubleshooting yading@10: yading@10: yading@10: yading@10: =head3 I don't hear any audio, but video is fine. yading@10: 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: yading@10: =head3 The audio and video lose sync after a while. yading@10: yading@10: yading@10: Yes, they do. yading@10: yading@10: yading@10: =head3 After a long while, the video update rate goes way down in WMP. yading@10: yading@10: yading@10: Yes, it does. Who knows why? yading@10: yading@10: yading@10: =head3 WMP 6.4 behaves differently to WMP 7. yading@10: 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: yading@10: =head2 What else can it do? yading@10: 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: yading@10: =head2 Tips yading@10: 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: yading@10: =head2 Why does the ?buffer / Preroll stop working after a time? yading@10: 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: yading@10: =head2 Does the C stuff work. yading@10: 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 C is fairly flexible. You should use one yading@10: of the following formats (the 'T' is literal): yading@10: yading@10: yading@10: * YYYY-MM-DDTHH:MM:SS (localtime) yading@10: * YYYY-MM-DDTHH:MM:SSZ (UTC) yading@10: yading@10: yading@10: You can omit the YYYY-MM-DD, and then it refers to the current day. However yading@10: note that B 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: B. yading@10: yading@10: yading@10: =head2 What is FFM, FFM2 yading@10: 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: yading@10: =head1 OPTIONS yading@10: yading@10: yading@10: All the numerical options, if not specified otherwise, accept a string yading@10: representing a number as input, which may be followed by one of the SI yading@10: unit prefixes, for example: 'K', 'M', or 'G'. yading@10: yading@10: If 'i' is appended to the SI unit prefix, the complete prefix will be yading@10: interpreted as a unit prefix for binary multiplies, which are based on yading@10: powers of 1024 instead of powers of 1000. Appending 'B' to the SI unit yading@10: prefix multiplies the value by 8. This allows using, for example: yading@10: 'KB', 'MiB', 'G' and 'B' as number suffixes. yading@10: yading@10: Options which do not take arguments are boolean options, and set the yading@10: corresponding value to true. They can be set to false by prefixing yading@10: the option name with "no". For example using "-nofoo" yading@10: will set the boolean option with name "foo" to false. yading@10: yading@10: yading@10: yading@10: =head2 Stream specifiers yading@10: yading@10: Some options are applied per-stream, e.g. bitrate or codec. Stream specifiers yading@10: are used to precisely specify which stream(s) a given option belongs to. yading@10: yading@10: A stream specifier is a string generally appended to the option name and yading@10: separated from it by a colon. E.g. C<-codec:a:1 ac3> contains the yading@10: C stream specifier, which matches the second audio stream. Therefore, it yading@10: would select the ac3 codec for the second audio stream. yading@10: yading@10: A stream specifier can match several streams, so that the option is applied to all yading@10: of them. E.g. the stream specifier in C<-b:a 128k> matches all audio yading@10: streams. yading@10: yading@10: An empty stream specifier matches all streams. For example, C<-codec copy> yading@10: or C<-codec: copy> would copy all the streams without reencoding. yading@10: yading@10: Possible forms of stream specifiers are: yading@10: yading@10: =over 4 yading@10: yading@10: yading@10: =item I yading@10: yading@10: Matches the stream with this index. E.g. C<-threads:1 4> would set the yading@10: thread count for the second stream to 4. yading@10: yading@10: =item IB<[:>IB<]> yading@10: yading@10: I is one of following: 'v' for video, 'a' for audio, 's' for subtitle, yading@10: 'd' for data, and 't' for attachments. If I is given, then it matches yading@10: stream number I of this type. Otherwise, it matches all yading@10: streams of this type. yading@10: yading@10: =item BIB<[:>IB<]> yading@10: yading@10: If I is given, then it matches the stream with number I yading@10: in the program with the id I. Otherwise, it matches all streams in the yading@10: program. yading@10: yading@10: =item B<#>I yading@10: yading@10: Matches the stream by a format-specific ID. yading@10: yading@10: =back yading@10: yading@10: yading@10: yading@10: =head2 Generic options yading@10: yading@10: yading@10: These options are shared amongst the ff* tools. yading@10: yading@10: yading@10: =over 4 yading@10: yading@10: yading@10: yading@10: =item B<-L> yading@10: yading@10: Show license. yading@10: yading@10: yading@10: =item B<-h, -?, -help, --help [>IB<]> yading@10: yading@10: Show help. An optional parameter may be specified to print help about a specific yading@10: item. yading@10: yading@10: Possible values of I are: yading@10: yading@10: =over 4 yading@10: yading@10: yading@10: =item BI yading@10: yading@10: Print detailed information about the decoder named I. Use the yading@10: B<-decoders> option to get a list of all decoders. yading@10: yading@10: yading@10: =item BI yading@10: yading@10: Print detailed information about the encoder named I. Use the yading@10: B<-encoders> option to get a list of all encoders. yading@10: yading@10: yading@10: =item BI yading@10: yading@10: Print detailed information about the demuxer named I. Use the yading@10: B<-formats> option to get a list of all demuxers and muxers. yading@10: yading@10: yading@10: =item BI yading@10: yading@10: Print detailed information about the muxer named I. Use the yading@10: B<-formats> option to get a list of all muxers and demuxers. yading@10: yading@10: yading@10: =item BI yading@10: yading@10: Print detailed information about the filter name I. Use the yading@10: B<-filters> option to get a list of all filters. yading@10: yading@10: yading@10: =back yading@10: yading@10: yading@10: yading@10: =item B<-version> yading@10: yading@10: Show version. yading@10: yading@10: yading@10: =item B<-formats> yading@10: yading@10: Show available formats. yading@10: yading@10: yading@10: =item B<-codecs> yading@10: yading@10: Show all codecs known to libavcodec. yading@10: yading@10: Note that the term 'codec' is used throughout this documentation as a shortcut yading@10: for what is more correctly called a media bitstream format. yading@10: yading@10: yading@10: =item B<-decoders> yading@10: yading@10: Show available decoders. yading@10: yading@10: yading@10: =item B<-encoders> yading@10: yading@10: Show all available encoders. yading@10: yading@10: yading@10: =item B<-bsfs> yading@10: yading@10: Show available bitstream filters. yading@10: yading@10: yading@10: =item B<-protocols> yading@10: yading@10: Show available protocols. yading@10: yading@10: yading@10: =item B<-filters> yading@10: yading@10: Show available libavfilter filters. yading@10: yading@10: yading@10: =item B<-pix_fmts> yading@10: yading@10: Show available pixel formats. yading@10: yading@10: yading@10: =item B<-sample_fmts> yading@10: yading@10: Show available sample formats. yading@10: yading@10: yading@10: =item B<-layouts> yading@10: yading@10: Show channel names and standard channel layouts. yading@10: yading@10: yading@10: =item B<-loglevel [repeat+]>I B<| -v [repeat+]>I yading@10: yading@10: Set the logging level used by the library. yading@10: Adding "repeat+" indicates that repeated log output should not be compressed yading@10: to the first line and the "Last message repeated n times" line will be yading@10: omitted. "repeat" can also be used alone. yading@10: If "repeat" is used alone, and with no prior loglevel set, the default yading@10: loglevel will be used. If multiple loglevel parameters are given, using yading@10: 'repeat' will not change the loglevel. yading@10: I is a number or a string containing one of the following values: yading@10: yading@10: =over 4 yading@10: yading@10: yading@10: =item B yading@10: yading@10: Show nothing at all; be silent. yading@10: yading@10: =item B yading@10: yading@10: Only show fatal errors which could lead the process to crash, such as yading@10: and assert failure. This is not currently used for anything. yading@10: yading@10: =item B yading@10: yading@10: Only show fatal errors. These are errors after which the process absolutely yading@10: cannot continue after. yading@10: yading@10: =item B yading@10: yading@10: Show all errors, including ones which can be recovered from. yading@10: yading@10: =item B yading@10: yading@10: Show all warnings and errors. Any message related to possibly yading@10: incorrect or unexpected events will be shown. yading@10: yading@10: =item B yading@10: yading@10: Show informative messages during processing. This is in addition to yading@10: warnings and errors. This is the default value. yading@10: yading@10: =item B yading@10: yading@10: Same as C, except more verbose. yading@10: yading@10: =item B yading@10: yading@10: Show everything, including debugging information. yading@10: yading@10: =back yading@10: yading@10: yading@10: By default the program logs to stderr, if coloring is supported by the yading@10: terminal, colors are used to mark errors and warnings. Log coloring yading@10: can be disabled setting the environment variable yading@10: B or B, or can be forced setting yading@10: the environment variable B. yading@10: The use of the environment variable B is deprecated and yading@10: will be dropped in a following FFmpeg version. yading@10: yading@10: yading@10: =item B<-report> yading@10: yading@10: Dump full command line and console output to a file named yading@10: C-I-I.log> in the current yading@10: directory. yading@10: This file can be useful for bug reports. yading@10: It also implies C<-loglevel verbose>. yading@10: yading@10: Setting the environment variable C to any value has the yading@10: same effect. If the value is a ':'-separated key=value sequence, these yading@10: options will affect the report; options values must be escaped if they yading@10: contain special characters or the options delimiter ':' (see the yading@10: ``Quoting and escaping'' section in the ffmpeg-utils manual). The yading@10: following option is recognized: yading@10: yading@10: =over 4 yading@10: yading@10: yading@10: =item B yading@10: yading@10: set the file name to use for the report; C<%p> is expanded to the name yading@10: of the program, C<%t> is expanded to a timestamp, C<%%> is expanded yading@10: to a plain C<%> yading@10: yading@10: =back yading@10: yading@10: yading@10: Errors in parsing the environment variable are not fatal, and will not yading@10: appear in the report. yading@10: yading@10: yading@10: =item B<-cpuflags flags (>IB<)> yading@10: yading@10: Allows setting and clearing cpu flags. This option is intended yading@10: for testing. Do not use it unless you know what you're doing. yading@10: yading@10: ffmpeg -cpuflags -sse+mmx ... yading@10: ffmpeg -cpuflags mmx ... yading@10: ffmpeg -cpuflags 0 ... yading@10: yading@10: Possible flags for this option are: yading@10: yading@10: =over 4 yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =over 4 yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B<3dnow> yading@10: yading@10: yading@10: =item B<3dnowext> yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =back yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =over 4 yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =back yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =over 4 yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =back yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =over 4 yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =back yading@10: yading@10: yading@10: =back yading@10: yading@10: yading@10: yading@10: =item B<-opencl_options options (>IB<)> yading@10: yading@10: Set OpenCL environment options. This option is only available when yading@10: FFmpeg has been compiled with C<--enable-opencl>. yading@10: yading@10: I must be a list of I=I option pairs yading@10: separated by ':'. See the ``OpenCL Options'' section in the yading@10: ffmpeg-utils manual for the list of supported options. yading@10: yading@10: =back yading@10: yading@10: yading@10: yading@10: =head2 AVOptions yading@10: yading@10: yading@10: These options are provided directly by the libavformat, libavdevice and yading@10: libavcodec libraries. To see the list of available AVOptions, use the yading@10: B<-help> option. They are separated into two categories: yading@10: yading@10: =over 4 yading@10: yading@10: yading@10: =item B yading@10: yading@10: These options can be set for any container, codec or device. Generic options yading@10: are listed under AVFormatContext options for containers/devices and under yading@10: AVCodecContext options for codecs. yading@10: yading@10: =item B yading@10: yading@10: These options are specific to the given container, device or codec. Private yading@10: options are listed under their corresponding containers/devices/codecs. yading@10: yading@10: =back yading@10: yading@10: yading@10: For example to write an ID3v2.3 header instead of a default ID3v2.4 to yading@10: an MP3 file, use the B private option of the MP3 yading@10: muxer: yading@10: yading@10: ffmpeg -i input.flac -id3v2_version 3 out.mp3 yading@10: yading@10: yading@10: All codec AVOptions are obviously per-stream, so the chapter on stream yading@10: specifiers applies to them yading@10: yading@10: Note B<-nooption> syntax cannot be used for boolean AVOptions, yading@10: use B<-option 0>/B<-option 1>. yading@10: yading@10: Note2 old undocumented way of specifying per-stream AVOptions by prepending yading@10: v/a/s to the options name is now obsolete and will be removed soon. yading@10: yading@10: yading@10: =head2 Main options yading@10: yading@10: yading@10: yading@10: =over 4 yading@10: yading@10: yading@10: =item B<-f> I yading@10: yading@10: Use F instead of F. yading@10: yading@10: =item B<-n> yading@10: yading@10: Enable no-launch mode. This option disables all the Launch directives yading@10: within the various EStreamE sections. Since ffserver will not launch yading@10: any ffmpeg instances, you will have to launch them manually. yading@10: yading@10: =item B<-d> yading@10: yading@10: Enable debug mode. This option increases log verbosity, directs log yading@10: messages to stdout. yading@10: yading@10: =back yading@10: yading@10: yading@10: yading@10: yading@10: =head1 SEE ALSO yading@10: yading@10: yading@10: yading@10: ffserver-all(1), yading@10: the F 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: yading@10: yading@10: =head1 AUTHORS yading@10: yading@10: yading@10: The FFmpeg developers. yading@10: yading@10: For details about the authorship, see the Git history of the project yading@10: (git://source.ffmpeg.org/ffmpeg), e.g. by typing the command yading@10: B in the FFmpeg source directory, or browsing the yading@10: online repository at EBE. yading@10: yading@10: Maintainers for the specific components are listed in the file yading@10: F in the source code tree. yading@10: yading@10: yading@10: