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 SYNTAX yading@10: yading@10: yading@10: This section documents the syntax and formats employed by the FFmpeg yading@10: libraries and tools. yading@10: yading@10: yading@10: yading@10: =head2 Quoting and escaping yading@10: yading@10: yading@10: FFmpeg adopts the following quoting and escaping mechanism, unless yading@10: explicitly specified. The following rules are applied: yading@10: yading@10: yading@10: =over 4 yading@10: yading@10: yading@10: =item * yading@10: yading@10: C<'> and C<\> are special characters (respectively used for yading@10: quoting and escaping). In addition to them, there might be other yading@10: special characters depending on the specific syntax where the escaping yading@10: and quoting are employed. yading@10: yading@10: yading@10: =item * yading@10: yading@10: A special character is escaped by prefixing it with a '\'. yading@10: yading@10: yading@10: =item * yading@10: yading@10: All characters enclosed between '' are included literally in the yading@10: parsed string. The quote character C<'> itself cannot be quoted, yading@10: so you may need to close the quote and escape it. yading@10: yading@10: yading@10: =item * yading@10: yading@10: Leading and trailing whitespaces, unless escaped or quoted, are yading@10: removed from the parsed string. yading@10: yading@10: =back yading@10: yading@10: yading@10: Note that you may need to add a second level of escaping when using yading@10: the command line or a script, which depends on the syntax of the yading@10: adopted shell language. yading@10: yading@10: The function C defined in yading@10: F can be used to parse a token quoted or yading@10: escaped according to the rules defined above. yading@10: yading@10: The tool F in the FFmpeg source tree can be used yading@10: to automatically quote or escape a string in a script. yading@10: yading@10: yading@10: =head3 Examples yading@10: yading@10: yading@10: yading@10: =over 4 yading@10: yading@10: yading@10: =item * yading@10: yading@10: Escape the string C containing the C<'> special yading@10: character: yading@10: yading@10: Crime d\'Amour yading@10: yading@10: yading@10: yading@10: =item * yading@10: yading@10: The string above contains a quote, so the C<'> needs to be escaped yading@10: when quoting it: yading@10: yading@10: 'Crime d'\''Amour' yading@10: yading@10: yading@10: yading@10: =item * yading@10: yading@10: Include leading or trailing whitespaces using quoting: yading@10: yading@10: ' this string starts and ends with whitespaces ' yading@10: yading@10: yading@10: yading@10: =item * yading@10: yading@10: Escaping and quoting can be mixed together: yading@10: yading@10: ' The string '\'string\'' is a string ' yading@10: yading@10: yading@10: yading@10: =item * yading@10: yading@10: To include a literal C<\> you can use either escaping or quoting: yading@10: yading@10: 'c:\foo' can be written as c:\\foo yading@10: yading@10: yading@10: =back yading@10: yading@10: yading@10: yading@10: yading@10: =head2 Date yading@10: yading@10: yading@10: The accepted syntax is: yading@10: yading@10: [(YYYY-MM-DD|YYYYMMDD)[T|t| ]]((HH:MM:SS[.m...]]])|(HHMMSS[.m...]]]))[Z] yading@10: now yading@10: yading@10: yading@10: If the value is "now" it takes the current time. yading@10: yading@10: Time is local time unless Z is appended, in which case it is yading@10: interpreted as UTC. yading@10: If the year-month-day part is not specified it takes the current yading@10: year-month-day. yading@10: yading@10: yading@10: yading@10: =head2 Time duration yading@10: yading@10: yading@10: The accepted syntax is: yading@10: yading@10: [-][HH:]MM:SS[.m...] yading@10: [-]S+[.m...] yading@10: yading@10: yading@10: I expresses the number of hours, I the number a of minutes yading@10: and I the number of seconds. yading@10: yading@10: yading@10: yading@10: =head2 Video size yading@10: yading@10: Specify the size of the sourced video, it may be a string of the form yading@10: IxI, or the name of a size abbreviation. yading@10: yading@10: The following abbreviations are recognized: yading@10: yading@10: =over 4 yading@10: yading@10: yading@10: =item B yading@10: yading@10: 720x480 yading@10: yading@10: =item B yading@10: yading@10: 720x576 yading@10: yading@10: =item B yading@10: yading@10: 352x240 yading@10: yading@10: =item B yading@10: yading@10: 352x288 yading@10: yading@10: =item B yading@10: yading@10: 640x480 yading@10: yading@10: =item B yading@10: yading@10: 768x576 yading@10: yading@10: =item B yading@10: yading@10: 352x240 yading@10: yading@10: =item B yading@10: yading@10: 352x240 yading@10: yading@10: =item B yading@10: yading@10: 128x96 yading@10: yading@10: =item B yading@10: yading@10: 176x144 yading@10: yading@10: =item B yading@10: yading@10: 352x288 yading@10: yading@10: =item B<4cif> yading@10: yading@10: 704x576 yading@10: yading@10: =item B<16cif> yading@10: yading@10: 1408x1152 yading@10: yading@10: =item B yading@10: yading@10: 160x120 yading@10: yading@10: =item B yading@10: yading@10: 320x240 yading@10: yading@10: =item B yading@10: yading@10: 640x480 yading@10: yading@10: =item B yading@10: yading@10: 800x600 yading@10: yading@10: =item B yading@10: yading@10: 1024x768 yading@10: yading@10: =item B yading@10: yading@10: 1600x1200 yading@10: yading@10: =item B yading@10: yading@10: 2048x1536 yading@10: yading@10: =item B yading@10: yading@10: 1280x1024 yading@10: yading@10: =item B yading@10: yading@10: 2560x2048 yading@10: yading@10: =item B yading@10: yading@10: 5120x4096 yading@10: yading@10: =item B yading@10: yading@10: 852x480 yading@10: yading@10: =item B yading@10: yading@10: 1366x768 yading@10: yading@10: =item B yading@10: yading@10: 1600x1024 yading@10: yading@10: =item B yading@10: yading@10: 1920x1200 yading@10: yading@10: =item B yading@10: yading@10: 2560x1600 yading@10: yading@10: =item B yading@10: yading@10: 3200x2048 yading@10: yading@10: =item B yading@10: yading@10: 3840x2400 yading@10: yading@10: =item B yading@10: yading@10: 6400x4096 yading@10: yading@10: =item B yading@10: yading@10: 7680x4800 yading@10: yading@10: =item B yading@10: yading@10: 320x200 yading@10: yading@10: =item B yading@10: yading@10: 640x350 yading@10: yading@10: =item B yading@10: yading@10: 852x480 yading@10: yading@10: =item B yading@10: yading@10: 1280x720 yading@10: yading@10: =item B yading@10: yading@10: 1920x1080 yading@10: yading@10: =item B<2k> yading@10: yading@10: 2048x1080 yading@10: yading@10: =item B<2kflat> yading@10: yading@10: 1998x1080 yading@10: yading@10: =item B<2kscope> yading@10: yading@10: 2048x858 yading@10: yading@10: =item B<4k> yading@10: yading@10: 4096x2160 yading@10: yading@10: =item B<4kflat> yading@10: yading@10: 3996x2160 yading@10: yading@10: =item B<4kscope> yading@10: yading@10: 4096x1716 yading@10: yading@10: =back yading@10: yading@10: yading@10: yading@10: yading@10: =head2 Video rate yading@10: yading@10: yading@10: Specify the frame rate of a video, expressed as the number of frames yading@10: generated per second. It has to be a string in the format yading@10: I/I, an integer number, a float yading@10: number or a valid video frame rate abbreviation. yading@10: yading@10: The following abbreviations are recognized: yading@10: yading@10: =over 4 yading@10: yading@10: yading@10: =item B yading@10: yading@10: 30000/1001 yading@10: yading@10: =item B yading@10: yading@10: 25/1 yading@10: yading@10: =item B yading@10: yading@10: 30000/1001 yading@10: yading@10: =item B yading@10: yading@10: 25/1 yading@10: yading@10: =item B yading@10: yading@10: 30000/1001 yading@10: yading@10: =item B yading@10: yading@10: 25/1 yading@10: yading@10: =item B yading@10: yading@10: 24/1 yading@10: yading@10: =item B yading@10: yading@10: 24000/1001 yading@10: yading@10: =back yading@10: yading@10: yading@10: yading@10: yading@10: =head2 Ratio yading@10: yading@10: yading@10: A ratio can be expressed as an expression, or in the form yading@10: I:I. yading@10: yading@10: Note that a ratio with infinite (1/0) or negative value is yading@10: considered valid, so you should check on the returned value if you yading@10: want to exclude those values. yading@10: yading@10: The undefined value can be expressed using the "0:0" string. yading@10: yading@10: yading@10: yading@10: =head2 Color yading@10: yading@10: yading@10: It can be the name of a color (case insensitive match) or a yading@10: [0x|#]RRGGBB[AA] sequence, possibly followed by "@" and a string yading@10: representing the alpha component. yading@10: yading@10: The alpha component may be a string composed by "0x" followed by an yading@10: hexadecimal number or a decimal number between 0.0 and 1.0, which yading@10: represents the opacity value (0x00/0.0 means completely transparent, yading@10: 0xff/1.0 completely opaque). yading@10: If the alpha component is not specified then 0xff is assumed. yading@10: yading@10: The string "random" will result in a random color. yading@10: yading@10: yading@10: yading@10: =head1 EXPRESSION EVALUATION yading@10: yading@10: yading@10: When evaluating an arithmetic expression, FFmpeg uses an internal yading@10: formula evaluator, implemented through the F yading@10: interface. yading@10: yading@10: An expression may contain unary, binary operators, constants, and yading@10: functions. yading@10: yading@10: Two expressions I and I can be combined to form yading@10: another expression "I;I". yading@10: I and I are evaluated in turn, and the new yading@10: expression evaluates to the value of I. yading@10: yading@10: The following binary operators are available: C<+>, C<->, yading@10: C<*>, C, C<^>. yading@10: yading@10: The following unary operators are available: C<+>, C<->. yading@10: yading@10: The following functions are available: yading@10: yading@10: =over 4 yading@10: yading@10: yading@10: =item B yading@10: yading@10: Compute absolute value of I. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Compute arccosine of I. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Compute arcsine of I. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Compute arctangent of I. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Return 1 if I is greater than or equal to I and lesser than or yading@10: equal to I, 0 otherwise. yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: Compute bitwise and/or operation on I and I. yading@10: yading@10: The results of the evaluation of I and I are converted to yading@10: integers before executing the bitwise operation. yading@10: yading@10: Note that both the conversion to integer and the conversion back to yading@10: floating point can lose precision. Beware of unexpected results for yading@10: large numbers (usually 2^53 and larger). yading@10: yading@10: yading@10: =item B yading@10: yading@10: Round the value of expression I upwards to the nearest yading@10: integer. For example, "ceil(1.5)" is "2.0". yading@10: yading@10: yading@10: =item B yading@10: yading@10: Compute cosine of I. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Compute hyperbolic cosine of I. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Return 1 if I and I are equivalent, 0 otherwise. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Compute exponential of I (with base C, the Euler's number). yading@10: yading@10: yading@10: =item B yading@10: yading@10: Round the value of expression I downwards to the nearest yading@10: integer. For example, "floor(-1.5)" is "-2.0". yading@10: yading@10: yading@10: =item B yading@10: yading@10: Compute Gauss function of I, corresponding to yading@10: C. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Return the greatest common divisor of I and I. If both I and yading@10: I are 0 or either or both are less than zero then behavior is undefined. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Return 1 if I is greater than I, 0 otherwise. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Return 1 if I is greater than or equal to I, 0 otherwise. yading@10: yading@10: yading@10: =item B yading@10: yading@10: This function is similar to the C function with the same name; it returns yading@10: "sqrt(I*I + I*I)", the length of the hypotenuse of a yading@10: right triangle with sides of length I and I, or the distance of the yading@10: point (I, I) from the origin. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Evaluate I, and if the result is non-zero return the result of yading@10: the evaluation of I, return 0 otherwise. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Evaluate I, and if the result is non-zero return the evaluation yading@10: result of I, otherwise the evaluation result of I. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Evaluate I, and if the result is zero return the result of the yading@10: evaluation of I, return 0 otherwise. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Evaluate I, and if the result is zero return the evaluation yading@10: result of I, otherwise the evaluation result of I. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Return 1.0 if I is +/-INFINITY, 0.0 otherwise. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Return 1.0 if I is NAN, 0.0 otherwise. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Allow to load the value of the internal variable with number yading@10: I, which was previously stored with st(I, I). yading@10: The function returns the loaded value. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Compute natural logarithm of I. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Return 1 if I is lesser than I, 0 otherwise. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Return 1 if I is lesser than or equal to I, 0 otherwise. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Return the maximum between I and I. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Return the maximum between I and I. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Compute the remainder of division of I by I. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Return 1.0 if I is zero, 0.0 otherwise. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Compute the power of I elevated I, it is equivalent to yading@10: "(I)^(I)". yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: Print the value of expression I with loglevel I. If yading@10: I is not specified then a default log level is used. yading@10: Returns the value of the expression printed. yading@10: yading@10: Prints t with loglevel l yading@10: yading@10: yading@10: =item B yading@10: yading@10: Return a pseudo random value between 0.0 and 1.0. I is the index of the yading@10: internal variable which will be used to save the seed/state. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Find an input value for which the function represented by I yading@10: with argument I is 0 in the interval 0..I. yading@10: yading@10: The expression in I must denote a continuous function or the yading@10: result is undefined. yading@10: yading@10: I is used to represent the function input value, which means yading@10: that the given expression will be evaluated multiple times with yading@10: various input values that the expression can access through yading@10: C. When the expression evaluates to 0 then the yading@10: corresponding input value will be returned. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Compute sine of I. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Compute hyperbolic sine of I. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Compute the square root of I. This is equivalent to yading@10: "(I)^.5". yading@10: yading@10: yading@10: =item B yading@10: yading@10: Compute expression C<1/(1 + exp(4*x))>. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Allow to store the value of the expression I in an internal yading@10: variable. I specifies the number of the variable where to yading@10: store the value, and it is a value ranging from 0 to 9. The function yading@10: returns the value stored in the internal variable. yading@10: Note, Variables are currently not shared between expressions. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Compute tangent of I. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Compute hyperbolic tangent of I. yading@10: yading@10: yading@10: =item B yading@10: yading@10: yading@10: =item B yading@10: yading@10: Evaluate a Taylor series at I, given an expression representing yading@10: the C-th derivative of a function at 0. yading@10: yading@10: When the series does not converge the result is undefined. yading@10: yading@10: I is used to represent the derivative order in I, yading@10: which means that the given expression will be evaluated multiple times yading@10: with various input values that the expression can access through yading@10: C. If I is not specified then 0 is assumed. yading@10: yading@10: Note, when you have the derivatives at y instead of 0, yading@10: C can be used. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Return the current (wallclock) time in seconds. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Round the value of expression I towards zero to the nearest yading@10: integer. For example, "trunc(-1.5)" is "-1.0". yading@10: yading@10: yading@10: =item B yading@10: yading@10: Evaluate expression I while the expression I is yading@10: non-zero, and returns the value of the last I evaluation, or yading@10: NAN if I was always false. yading@10: yading@10: =back yading@10: yading@10: yading@10: The following constants are available: yading@10: yading@10: =over 4 yading@10: yading@10: yading@10: =item B yading@10: yading@10: area of the unit disc, approximately 3.14 yading@10: yading@10: =item B yading@10: yading@10: exp(1) (Euler's number), approximately 2.718 yading@10: yading@10: =item B yading@10: yading@10: golden ratio (1+sqrt(5))/2, approximately 1.618 yading@10: yading@10: =back yading@10: yading@10: yading@10: Assuming that an expression is considered "true" if it has a non-zero yading@10: value, note that: yading@10: yading@10: C<*> works like AND yading@10: yading@10: C<+> works like OR yading@10: yading@10: For example the construct: yading@10: yading@10: if (A AND B) then C yading@10: yading@10: is equivalent to: yading@10: yading@10: if(A*B, C) yading@10: yading@10: yading@10: In your C code, you can extend the list of unary and binary functions, yading@10: and define recognized constants, so that they are available for your yading@10: expressions. yading@10: yading@10: The evaluator also recognizes the International System unit prefixes. yading@10: If 'i' is appended after the prefix, binary prefixes are used, which yading@10: are based on powers of 1024 instead of powers of 1000. yading@10: The 'B' postfix multiplies the value by 8, and can be appended after a yading@10: unit prefix or used alone. This allows using for example 'KB', 'MiB', yading@10: 'G' and 'B' as number postfix. yading@10: yading@10: The list of available International System prefixes follows, with yading@10: indication of the corresponding powers of 10 and of 2. yading@10: yading@10: =over 4 yading@10: yading@10: yading@10: =item B yading@10: yading@10: 10^-24 / 2^-80 yading@10: yading@10: =item B yading@10: yading@10: 10^-21 / 2^-70 yading@10: yading@10: =item B yading@10: yading@10: 10^-18 / 2^-60 yading@10: yading@10: =item B yading@10: yading@10: 10^-15 / 2^-50 yading@10: yading@10: =item B

yading@10: yading@10: 10^-12 / 2^-40 yading@10: yading@10: =item B yading@10: yading@10: 10^-9 / 2^-30 yading@10: yading@10: =item B yading@10: yading@10: 10^-6 / 2^-20 yading@10: yading@10: =item B yading@10: yading@10: 10^-3 / 2^-10 yading@10: yading@10: =item B yading@10: yading@10: 10^-2 yading@10: yading@10: =item B yading@10: yading@10: 10^-1 yading@10: yading@10: =item B yading@10: yading@10: 10^2 yading@10: yading@10: =item B yading@10: yading@10: 10^3 / 2^10 yading@10: yading@10: =item B yading@10: yading@10: 10^3 / 2^10 yading@10: yading@10: =item B yading@10: yading@10: 10^6 / 2^20 yading@10: yading@10: =item B yading@10: yading@10: 10^9 / 2^30 yading@10: yading@10: =item B yading@10: yading@10: 10^12 / 2^40 yading@10: yading@10: =item B

yading@10: yading@10: 10^15 / 2^40 yading@10: yading@10: =item B yading@10: yading@10: 10^18 / 2^50 yading@10: yading@10: =item B yading@10: yading@10: 10^21 / 2^60 yading@10: yading@10: =item B yading@10: yading@10: 10^24 / 2^70 yading@10: yading@10: =back yading@10: yading@10: yading@10: yading@10: yading@10: =head1 OPENCL OPTIONS yading@10: yading@10: yading@10: When FFmpeg is configured with C<--enable-opencl>, it is possible yading@10: to set the options for the global OpenCL context. yading@10: yading@10: The list of supported options follows: yading@10: yading@10: yading@10: =over 4 yading@10: yading@10: yading@10: =item B yading@10: yading@10: Set build options used to compile the registered kernels. yading@10: yading@10: See reference "OpenCL Specification Version: 1.2 chapter 5.6.4". yading@10: yading@10: yading@10: =item B yading@10: yading@10: Select the index of the platform to run OpenCL code. yading@10: yading@10: The specified index must be one of the indexes in the device list yading@10: which can be obtained with C. yading@10: yading@10: yading@10: =item B yading@10: yading@10: Select the index of the device used to run OpenCL code. yading@10: yading@10: The specifed index must be one of the indexes in the device list which yading@10: can be obtained with C. yading@10: yading@10: yading@10: =back yading@10: yading@10: yading@10: yading@10: yading@10: =head1 CODEC OPTIONS yading@10: yading@10: yading@10: libavcodec provides some generic global options, which can be set on yading@10: all the encoders and decoders. In addition each codec may support yading@10: so-called private options, which are specific for a given codec. yading@10: yading@10: Sometimes, a global option may only affect a specific kind of codec, yading@10: and may be unsensical or ignored by another, so you need to be aware yading@10: of the meaning of the specified options. Also some options are yading@10: meant only for decoding or encoding. yading@10: yading@10: Options may be set by specifying -I