yading10: \input texinfo yading10: yading10: ffmpeg Documentation yading10: yading10: ffmpeg Documentation yading10: titlepage yading10: yading10: yading10: yading10: yading10: yading10: Synopsis yading10: yading10: ffmpeg [GLOBAL_OPTIONS] {[INPUT_FILE_OPTIONS] -i input_file} ... {[OUTPUT_FILE_OPTIONS] output_file} ... yading10: yading10: Description yading10: yading10: yading10: ffmpeg is a very fast video and audio converter that can also grab from yading10: a live audio/video source. It can also convert between arbitrary sample yading10: rates and resize video on the fly with a high quality polyphase filter. yading10: yading10: ffmpeg reads from an arbitrary number of input "files" (which can be regular yading10: files, pipes, network streams, grabbing devices, etc.), specified by the yading10: -i option, and writes to an arbitrary number of output "files", which are yading10: specified by a plain output filename. Anything found on the command line which yading10: cannot be interpreted as an option is considered to be an output filename. yading10: yading10: Each input or output file can, in principle, contain any number of streams of yading10: different types (video/audio/subtitle/attachment/data). The allowed number and/or yading10: types of streams may be limited by the container format. Selecting which yading10: streams from which inputs will go into which output is either done automatically yading10: or with the -map option (see the Stream selection chapter). yading10: yading10: To refer to input files in options, you must use their indices (0-based). E.g. yading10: the first input file is 0, the second is 1, etc. Similarly, streams yading10: within a file are referred to by their indices. E.g. 2:3 refers to the yading10: fourth stream in the third input file. Also see the Stream specifiers chapter. yading10: yading10: As a general rule, options are applied to the next specified yading10: file. Therefore, order is important, and you can have the same yading10: option on the command line multiple times. Each occurrence is yading10: then applied to the next input or output file. yading10: Exceptions from this rule are the global options (e.g. verbosity level), yading10: which should be specified first. yading10: yading10: Do not mix input and output files -- first specify all input files, then all yading10: output files. Also do not mix options which belong to different files. All yading10: options apply ONLY to the next input or output file and are reset between files. yading10: yading10: yading10: yading10: To set the video bitrate of the output file to 64 kbit/s: yading10: yading10: ffmpeg -i input.avi -b:v 64k -bufsize 64k output.avi yading10: example yading10: yading10: yading10: To force the frame rate of the output file to 24 fps: yading10: yading10: ffmpeg -i input.avi -r 24 output.avi yading10: example yading10: yading10: yading10: To force the frame rate of the input file (valid for raw formats only) yading10: to 1 fps and the frame rate of the output file to 24 fps: yading10: yading10: ffmpeg -r 1 -i input.m2v -r 24 output.avi yading10: example yading10: itemize yading10: yading10: The format option may be needed for raw input files. yading10: yading10: yading10: yading10: Detailed description yading10: yading10: yading10: The transcoding process in ffmpeg for each output can be described by yading10: the following diagram: yading10: yading10: yading10:  _______              ______________               _________              ______________            ________ yading10: |       |            |              |             |         |            |              |          |        | yading10: | input |  demuxer   | encoded data |   decoder   | decoded |  encoder   | encoded data |  muxer   | output | yading10: | file  | ---------> | packets      |  ---------> | frames  | ---------> | packets      | -------> | file   | yading10: |_______|            |______________|             |_________|            |______________|          |________| yading10: yading10: example yading10: yading10: ffmpeg calls the libavformat library (containing demuxers) to read yading10: input files and get packets containing encoded data from them. When there are yading10: multiple input files, ffmpeg tries to keep them synchronized by yading10: tracking lowest timestamp on any active input stream. yading10: yading10: Encoded packets are then passed to the decoder (unless streamcopy is selected yading10: for the stream, see further for a description). The decoder produces yading10: uncompressed frames (raw video/PCM audio/...) which can be processed further by yading10: filtering (see next section). After filtering, the frames are passed to the yading10: encoder, which encodes them and outputs encoded packets. Finally those are yading10: passed to the muxer, which writes the encoded packets to the output file. yading10: yading10: Filtering yading10: Before encoding, ffmpeg can process raw audio and video frames using yading10: filters from the libavfilter library. Several chained filters form a filter yading10: graph. ffmpeg distinguishes between two types of filtergraphs: yading10: simple and complex. yading10: yading10: Simple filtergraphs yading10: Simple filtergraphs are those that have exactly one input and output, both of yading10: the same type. In the above diagram they can be represented by simply inserting yading10: an additional step between decoding and encoding: yading10: yading10: yading10:  _________                        __________              ______________ yading10: |         |                      |          |            |              | yading10: | decoded |  simple filtergraph  | filtered |  encoder   | encoded data | yading10: | frames  | -------------------> | frames   | ---------> | packets      | yading10: |_________|                      |__________|            |______________| yading10: yading10: example yading10: yading10: Simple filtergraphs are configured with the per-stream -filter option yading10: (with -vf and -af aliases for video and audio respectively). yading10: A simple filtergraph for video can look for example like this: yading10: yading10: yading10:  _______        _____________        _______        _____        ________ yading10: |       |      |             |      |       |      |     |      |        | yading10: | input | ---> | deinterlace | ---> | scale | ---> | fps | ---> | output | yading10: |_______|      |_____________|      |_______|      |_____|      |________| yading10: yading10: example yading10: yading10: Note that some filters change frame properties but not frame contents. E.g. the yading10: fps filter in the example above changes number of frames, but does not yading10: touch the frame contents. Another example is the setpts filter, which yading10: only sets timestamps and otherwise passes the frames unchanged. yading10: yading10: Complex filtergraphs yading10: Complex filtergraphs are those which cannot be described as simply a linear yading10: processing chain applied to one stream. This is the case, for example, when the graph has yading10: more than one input and/or output, or when output stream type is different from yading10: input. They can be represented with the following diagram: yading10: yading10: yading10:  _________ yading10: |         | yading10: | input 0 |\                    __________ yading10: |_________| \                  |          | yading10:              \   _________    /| output 0 | yading10:               \ |         |  / |__________| yading10:  _________     \| complex | / yading10: |         |     |         |/ yading10: | input 1 |---->| filter  |\ yading10: |_________|     |         | \   __________ yading10:                /| graph   |  \ |          | yading10:               / |         |   \| output 1 | yading10:  _________   /  |_________|    |__________| yading10: |         | / yading10: | input 2 |/ yading10: |_________| yading10: yading10: example yading10: yading10: Complex filtergraphs are configured with the -filter_complex option. yading10: Note that this option is global, since a complex filtergraph, by its nature, yading10: cannot be unambiguously associated with a single stream or file. yading10: yading10: The -lavfi option is equivalent to -filter_complex. yading10: yading10: A trivial example of a complex filtergraph is the overlay filter, which yading10: has two video inputs and one video output, containing one video overlaid on top yading10: of the other. Its audio counterpart is the amix filter. yading10: yading10: Stream copy yading10: Stream copy is a mode selected by supplying the copy parameter to the yading10: -codec option. It makes ffmpeg omit the decoding and encoding yading10: step for the specified stream, so it does only demuxing and muxing. It is useful yading10: for changing the container format or modifying container-level metadata. The yading10: diagram above will, in this case, simplify to this: yading10: yading10: yading10:  _______              ______________            ________ yading10: |       |            |              |          |        | yading10: | input |  demuxer   | encoded data |  muxer   | output | yading10: | file  | ---------> | packets      | -------> | file   | yading10: |_______|            |______________|          |________| yading10: yading10: example yading10: yading10: Since there is no decoding or encoding, it is very fast and there is no quality yading10: loss. However, it might not work in some cases because of many factors. Applying yading10: filters is obviously also impossible, since filters work on uncompressed data. yading10: yading10: yading10: yading10: Stream selection yading10: yading10: yading10: By default, ffmpeg includes only one stream of each type (video, audio, subtitle) yading10: present in the input files and adds them to each output file.  It picks the yading10: "best" of each based upon the following criteria: for video, it is the stream yading10: with the highest resolution, for audio, it is the stream with the most channels, for yading10: subtitles, it is the first subtitle stream. In the case where several streams of yading10: the same type rate equally, the stream with the lowest index is chosen. yading10: yading10: You can disable some of those defaults by using the -vn/-an/-sn options. For yading10: full manual control, use the -map option, which disables the defaults just yading10: described. yading10: yading10: yading10: yading10: Options yading10: yading10: yading10: avtools-common-opts.texi yading10: yading10: Main options yading10: yading10: yading10: yading10: -f FMT (input/output) yading10: Force input or output file format. The format is normally auto detected for input yading10: files and guessed from the file extension for output files, so this option is not yading10: needed in most cases. yading10: yading10: -i FILENAME (input) yading10: input file name yading10: yading10: -y (global) yading10: Overwrite output files without asking. yading10: yading10: -n (global) yading10: Do not overwrite output files, and exit immediately if a specified yading10: output file already exists. yading10: yading10: -c[:STREAM_SPECIFIER] CODEC (input/output,per-stream) yading10: -codec[:STREAM_SPECIFIER] CODEC (input/output,per-stream) yading10: Select an encoder (when used before an output file) or a decoder (when used yading10: before an input file) for one or more streams. CODEC is the name of a yading10: decoder/encoder or a special value copy (output only) to indicate that yading10: the stream is not to be re-encoded. yading10: yading10: For example yading10: yading10: ffmpeg -i INPUT -map 0 -c:v libx264 -c:a copy OUTPUT yading10: example yading10: encodes all video streams with libx264 and copies all audio streams. yading10: yading10: For each stream, the last matching c option is applied, so yading10: yading10: ffmpeg -i INPUT -map 0 -c copy -c:v:1 libx264 -c:a:137 libvorbis OUTPUT yading10: example yading10: will copy all the streams except the second video, which will be encoded with yading10: libx264, and the 138th audio, which will be encoded with libvorbis. yading10: yading10: -t DURATION (output) yading10: Stop writing the output after its duration reaches DURATION. yading10: DURATION may be a number in seconds, or in hh:mm:ss[.xxx] form. yading10: yading10: -to and -t are mutually exclusive and -t has priority. yading10: yading10: -to POSITION (output) yading10: Stop writing the output at POSITION. yading10: POSITION may be a number in seconds, or in hh:mm:ss[.xxx] form. yading10: yading10: -to and -t are mutually exclusive and -t has priority. yading10: yading10: -fs LIMIT_SIZE (output) yading10: Set the file size limit, expressed in bytes. yading10: yading10: -ss POSITION (input/output) yading10: When used as an input option (before -i), seeks in this input file to yading10: POSITION. When used as an output option (before an output filename), yading10: decodes but discards input until the timestamps reach POSITION. This is yading10: slower, but more accurate. yading10: yading10: POSITION may be either in seconds or in hh:mm:ss[.xxx] form. yading10: yading10: -itsoffset OFFSET (input) yading10: Set the input time offset in seconds. yading10: [-]hh:mm:ss[.xxx] syntax is also supported. yading10: The offset is added to the timestamps of the input files. yading10: Specifying a positive offset means that the corresponding yading10: streams are delayed by OFFSET seconds. yading10: yading10: -timestamp TIME (output) yading10: Set the recording timestamp in the container. yading10: The syntax for TIME is: yading10: yading10: now|([(YYYY-MM-DD|YYYYMMDD)[T|t| ]]((HH:MM:SS[.m...])|(HHMMSS[.m...]))[Z|z]) yading10: example yading10: If the value is "now" it takes the current time. yading10: Time is local time unless 'Z' or 'z' is appended, in which case it is yading10: interpreted as UTC. yading10: If the year-month-day part is not specified it takes the current yading10: year-month-day. yading10: yading10: -metadata[:metadata_specifier] KEY=VALUE (output,per-metadata) yading10: Set a metadata key/value pair. yading10: yading10: An optional METADATA_SPECIFIER may be given to set metadata yading10: on streams or chapters. See -map_metadata documentation for yading10: details. yading10: yading10: This option overrides metadata set with -map_metadata. It is yading10: also possible to delete metadata by using an empty value. yading10: yading10: For example, for setting the title in the output file: yading10: yading10: ffmpeg -i in.avi -metadata title="my title" out.flv yading10: example yading10: yading10: To set the language of the first audio stream: yading10: yading10: ffmpeg -i INPUT -metadata:s:a:1 language=eng OUTPUT yading10: example yading10: yading10: -target TYPE (output) yading10: Specify target file type (vcd, svcd, dvd, dv, yading10: dv50). TYPE may be prefixed with pal-, ntsc- or yading10: film- to use the corresponding standard. All the format options yading10: (bitrate, codecs, buffer sizes) are then set automatically. You can just type: yading10: yading10: yading10: ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg yading10: example yading10: yading10: Nevertheless you can specify additional options as long as you know yading10: they do not conflict with the standard, as in: yading10: yading10: yading10: ffmpeg -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg yading10: example yading10: yading10: -dframes NUMBER (output) yading10: Set the number of data frames to record. This is an alias for -frames:d. yading10: yading10: -frames[:STREAM_SPECIFIER] FRAMECOUNT (output,per-stream) yading10: Stop writing to the stream after FRAMECOUNT frames. yading10: yading10: -q[:STREAM_SPECIFIER] Q (output,per-stream) yading10: -qscale[:STREAM_SPECIFIER] Q (output,per-stream) yading10: Use fixed quality scale (VBR). The meaning of Q is yading10: codec-dependent. yading10: yading10: yading10: -filter[:STREAM_SPECIFIER] FILTERGRAPH (output,per-stream) yading10: Create the filtergraph specified by FILTERGRAPH and use it to yading10: filter the stream. yading10: yading10: FILTERGRAPH is a description of the filtergraph to apply to yading10: the stream, and must have a single input and a single output of the yading10: same type of the stream. In the filtergraph, the input is associated yading10: to the label in, and the output to the label out. See yading10: the ffmpeg-filters manual for more information about the filtergraph yading10: syntax. yading10: yading10: See the -filter_complex option if you yading10: want to create filtergraphs with multiple inputs and/or outputs. yading10: yading10: -filter_script[:STREAM_SPECIFIER] FILENAME (output,per-stream) yading10: This option is similar to -filter, the only difference is that its yading10: argument is the name of the file from which a filtergraph description is to be yading10: read. yading10: yading10: -pre[:STREAM_SPECIFIER] PRESET_NAME (output,per-stream) yading10: Specify the preset for matching stream(s). yading10: yading10: -stats (global) yading10: Print encoding progress/statistics. It is on by default, to explicitly yading10: disable it you need to specify -nostats. yading10: yading10: -progress URL (global) yading10: Send program-friendly progress information to URL. yading10: yading10: Progress information is written approximately every second and at the end of yading10: the encoding process. It is made of "KEY=VALUE" lines. KEY yading10: consists of only alphanumeric characters. The last key of a sequence of yading10: progress information is always "progress". yading10: yading10: -stdin yading10: Enable interaction on standard input. On by default unless standard input is yading10: used as an input. To explicitly disable interaction you need to specify yading10: -nostdin. yading10: yading10: Disabling interaction on standard input is useful, for example, if yading10: ffmpeg is in the background process group. Roughly the same result can yading10: be achieved with ffmpeg ... < /dev/null but it requires a yading10: shell. yading10: yading10: -debug_ts (global) yading10: Print timestamp information. It is off by default. This option is yading10: mostly useful for testing and debugging purposes, and the output yading10: format may change from one version to another, so it should not be yading10: employed by portable scripts. yading10: yading10: See also the option -fdebug ts. yading10: yading10: -attach FILENAME (output) yading10: Add an attachment to the output file. This is supported by a few formats yading10: like Matroska for e.g. fonts used in rendering subtitles. Attachments yading10: are implemented as a specific type of stream, so this option will add yading10: a new stream to the file. It is then possible to use per-stream options yading10: on this stream in the usual way. Attachment streams created with this yading10: option will be created after all the other streams (i.e. those created yading10: with -map or automatic mappings). yading10: yading10: Note that for Matroska you also have to set the mimetype metadata tag: yading10: yading10: ffmpeg -i INPUT -attach DejaVuSans.ttf -metadata:s:2 mimetype=application/x-truetype-font out.mkv yading10: example yading10: (assuming that the attachment stream will be third in the output file). yading10: yading10: -dump_attachment[:STREAM_SPECIFIER] FILENAME (input,per-stream) yading10: Extract the matching attachment stream into a file named FILENAME. If yading10: FILENAME is empty, then the value of the filename metadata tag yading10: will be used. yading10: yading10: E.g. to extract the first attachment to a file named 'out.ttf': yading10: yading10: ffmpeg -dump_attachment:t:0 out.ttf -i INPUT yading10: example yading10: To extract all attachments to files determined by the filename tag: yading10: yading10: ffmpeg -dump_attachment:t "" -i INPUT yading10: example yading10: yading10: Technical note -- attachments are implemented as codec extradata, so this yading10: option can actually be used to extract extradata from any stream, not just yading10: attachments. yading10: yading10: table yading10: yading10: Video Options yading10: yading10: yading10: -vframes NUMBER (output) yading10: Set the number of video frames to record. This is an alias for -frames:v. yading10: -r[:STREAM_SPECIFIER] FPS (input/output,per-stream) yading10: Set frame rate (Hz value, fraction or abbreviation). yading10: yading10: As an input option, ignore any timestamps stored in the file and instead yading10: generate timestamps assuming constant frame rate FPS. yading10: yading10: As an output option, duplicate or drop input frames to achieve constant output yading10: frame rate FPS. yading10: yading10: -s[:STREAM_SPECIFIER] SIZE (input/output,per-stream) yading10: Set frame size. yading10: yading10: As an input option, this is a shortcut for the video_size private yading10: option, recognized by some demuxers for which the frame size is either not yading10: stored in the file or is configurable -- e.g. raw video or video grabbers. yading10: yading10: As an output option, this inserts the scale video filter to the yading10: end of the corresponding filtergraph. Please use the scale filter yading10: directly to insert it at the beginning or some other place. yading10: yading10: The format is wxh (default - same as source). yading10: yading10: -aspect[:STREAM_SPECIFIER] ASPECT (output,per-stream) yading10: Set the video display aspect ratio specified by ASPECT. yading10: yading10: ASPECT can be a floating point number string, or a string of the yading10: form NUM:DEN, where NUM and DEN are the yading10: numerator and denominator of the aspect ratio. For example "4:3", yading10: "16:9", "1.3333", and "1.7777" are valid argument values. yading10: yading10: If used together with -vcodec copy, it will affect the aspect ratio yading10: stored at container level, but not the aspect ratio stored in encoded yading10: frames, if it exists. yading10: yading10: -vn (output) yading10: Disable video recording. yading10: yading10: -vcodec CODEC (output) yading10: Set the video codec. This is an alias for -codec:v. yading10: yading10: -pass[:STREAM_SPECIFIER] N (output,per-stream) yading10: Select the pass number (1 or 2). It is used to do two-pass yading10: video encoding. The statistics of the video are recorded in the first yading10: pass into a log file (see also the option -passlogfile), yading10: and in the second pass that log file is used to generate the video yading10: at the exact requested bitrate. yading10: On pass 1, you may just deactivate audio and set output to null, yading10: examples for Windows and Unix: yading10: yading10: ffmpeg -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y NUL yading10: ffmpeg -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y /dev/null yading10: example yading10: yading10: -passlogfile[:STREAM_SPECIFIER] PREFIX (output,per-stream) yading10: Set two-pass log file name prefix to PREFIX, the default file name yading10: prefix is ``ffmpeg2pass''. The complete file name will be yading10: PREFIX-N.log, where N is a number specific to the output yading10: stream yading10: yading10: -vlang CODE yading10: Set the ISO 639 language code (3 letters) of the current video stream. yading10: yading10: -vf FILTERGRAPH (output) yading10: Create the filtergraph specified by FILTERGRAPH and use it to yading10: filter the stream. yading10: yading10: This is an alias for -filter:v, see the -filter option. yading10: table yading10: yading10: Advanced Video Options yading10: yading10: yading10: -pix_fmt[:STREAM_SPECIFIER] FORMAT (input/output,per-stream) yading10: Set pixel format. Use -pix_fmts to show all the supported yading10: pixel formats. yading10: If the selected pixel format can not be selected, ffmpeg will print a yading10: warning and select the best pixel format supported by the encoder. yading10: If PIX_FMT is prefixed by a +, ffmpeg will exit with an error yading10: if the requested pixel format can not be selected, and automatic conversions yading10: inside filtergraphs are disabled. yading10: If PIX_FMT is a single +, ffmpeg selects the same pixel format yading10: as the input (or graph output) and automatic conversions are disabled. yading10: yading10: -sws_flags FLAGS (input/output) yading10: Set SwScaler flags. yading10: -vdt N yading10: Discard threshold. yading10: yading10: -rc_override[:STREAM_SPECIFIER] OVERRIDE (output,per-stream) yading10: Rate control override for specific intervals, formatted as "int,int,int" yading10: list separated with slashes. Two first values are the beginning and yading10: end frame numbers, last one is quantizer to use if positive, or quality yading10: factor if negative. yading10: yading10: -deinterlace yading10: Deinterlace pictures. yading10: This option is deprecated since the deinterlacing is very low quality. yading10: Use the yadif filter with -filter:v yadif. yading10: -ilme yading10: Force interlacing support in encoder (MPEG-2 and MPEG-4 only). yading10: Use this option if your input file is interlaced and you want yading10: to keep the interlaced format for minimum losses. yading10: The alternative is to deinterlace the input stream with yading10: -deinterlace, but deinterlacing introduces losses. yading10: -psnr yading10: Calculate PSNR of compressed frames. yading10: -vstats yading10: Dump video coding statistics to vstats_HHMMSS.log. yading10: -vstats_file FILE yading10: Dump video coding statistics to FILE. yading10: -top[:STREAM_SPECIFIER] N (output,per-stream) yading10: top=1/bottom=0/auto=-1 field first yading10: -dc PRECISION yading10: Intra_dc_precision. yading10: -vtag FOURCC/TAG (output) yading10: Force video tag/fourcc. This is an alias for -tag:v. yading10: -qphist (global) yading10: Show QP histogram yading10: -vbsf BITSTREAM_FILTER yading10: Deprecated see -bsf yading10: yading10: -force_key_frames[:STREAM_SPECIFIER] TIME[,TIME...] (output,per-stream) yading10: -force_key_frames[:STREAM_SPECIFIER] expr:EXPR (output,per-stream) yading10: Force key frames at the specified timestamps, more precisely at the first yading10: frames after each specified time. yading10: yading10: If the argument is prefixed with expr:, the string EXPR yading10: is interpreted like an expression and is evaluated for each frame. A yading10: key frame is forced in case the evaluation is non-zero. yading10: yading10: If one of the times is "chapters[DELTA]", it is expanded into yading10: the time of the beginning of all chapters in the file, shifted by yading10: DELTA, expressed as a time in seconds. yading10: This option can be useful to ensure that a seek point is present at a yading10: chapter mark or any other designated place in the output file. yading10: yading10: For example, to insert a key frame at 5 minutes, plus key frames 0.1 second yading10: before the beginning of every chapter: yading10: yading10: -force_key_frames 0:05:00,chapters-0.1 yading10: example yading10: yading10: The expression in EXPR can contain the following constants: yading10: yading10: n yading10: the number of current processed frame, starting from 0 yading10: n_forced yading10: the number of forced frames yading10: prev_forced_n yading10: the number of the previous forced frame, it is NAN when no yading10: keyframe was forced yet yading10: prev_forced_t yading10: the time of the previous forced frame, it is NAN when no yading10: keyframe was forced yet yading10: t yading10: the time of the current processed frame yading10: table yading10: yading10: For example to force a key frame every 5 seconds, you can specify: yading10: yading10: -force_key_frames expr:gte(t,n_forced*5) yading10: example yading10: yading10: To force a key frame 5 seconds after the time of the last forced one, yading10: starting from second 13: yading10: yading10: -force_key_frames expr:if(isnan(prev_forced_t),gte(t,13),gte(t,prev_forced_t+5)) yading10: example yading10: yading10: Note that forcing too many keyframes is very harmful for the lookahead yading10: algorithms of certain encoders: using fixed-GOP options or similar yading10: would be more efficient. yading10: yading10: -copyinkf[:STREAM_SPECIFIER] (output,per-stream) yading10: When doing stream copy, copy also non-key frames found at the yading10: beginning. yading10: table yading10: yading10: Audio Options yading10: yading10: yading10: -aframes NUMBER (output) yading10: Set the number of audio frames to record. This is an alias for -frames:a. yading10: -ar[:STREAM_SPECIFIER] FREQ (input/output,per-stream) yading10: Set the audio sampling frequency. For output streams it is set by yading10: default to the frequency of the corresponding input stream. For input yading10: streams this option only makes sense for audio grabbing devices and raw yading10: demuxers and is mapped to the corresponding demuxer options. yading10: -aq Q (output) yading10: Set the audio quality (codec-specific, VBR). This is an alias for -q:a. yading10: -ac[:STREAM_SPECIFIER] CHANNELS (input/output,per-stream) yading10: Set the number of audio channels. For output streams it is set by yading10: default to the number of input audio channels. For input streams yading10: this option only makes sense for audio grabbing devices and raw demuxers yading10: and is mapped to the corresponding demuxer options. yading10: -an (output) yading10: Disable audio recording. yading10: -acodec CODEC (input/output) yading10: Set the audio codec. This is an alias for -codec:a. yading10: -sample_fmt[:STREAM_SPECIFIER] SAMPLE_FMT (output,per-stream) yading10: Set the audio sample format. Use -sample_fmts to get a list yading10: of supported sample formats. yading10: yading10: -af FILTERGRAPH (output) yading10: Create the filtergraph specified by FILTERGRAPH and use it to yading10: filter the stream. yading10: yading10: This is an alias for -filter:a, see the -filter option. yading10: table yading10: yading10: Advanced Audio options: yading10: yading10: yading10: -atag FOURCC/TAG (output) yading10: Force audio tag/fourcc. This is an alias for -tag:a. yading10: -absf BITSTREAM_FILTER yading10: Deprecated, see -bsf yading10: -guess_layout_max CHANNELS (input,per-stream) yading10: If some input channel layout is not known, try to guess only if it yading10: corresponds to at most the specified number of channels. For example, 2 yading10: tells to ffmpeg to recognize 1 channel as mono and 2 channels as yading10: stereo but not 6 channels as 5.1. The default is to always try to guess. Use yading10: 0 to disable all guessing. yading10: table yading10: yading10: Subtitle options: yading10: yading10: yading10: -slang CODE yading10: Set the ISO 639 language code (3 letters) of the current subtitle stream. yading10: -scodec CODEC (input/output) yading10: Set the subtitle codec. This is an alias for -codec:s. yading10: -sn (output) yading10: Disable subtitle recording. yading10: -sbsf BITSTREAM_FILTER yading10: Deprecated, see -bsf yading10: table yading10: yading10: Advanced Subtitle options: yading10: yading10: yading10: yading10: -fix_sub_duration yading10: Fix subtitles durations. For each subtitle, wait for the next packet in the yading10: same stream and adjust the duration of the first to avoid overlap. This is yading10: necessary with some subtitles codecs, especially DVB subtitles, because the yading10: duration in the original packet is only a rough estimate and the end is yading10: actually marked by an empty subtitle frame. Failing to use this option when yading10: necessary can result in exaggerated durations or muxing failures due to yading10: non-monotonic timestamps. yading10: yading10: Note that this option will delay the output of all data until the next yading10: subtitle packet is decoded: it may increase memory consumption and latency a yading10: lot. yading10: yading10: -canvas_size SIZE yading10: Set the size of the canvas used to render subtitles. yading10: yading10: table yading10: yading10: Advanced options yading10: yading10: yading10: -map [-]INPUT_FILE_ID[:STREAM_SPECIFIER][,SYNC_FILE_ID[:STREAM_SPECIFIER]] | [LINKLABEL] (output) yading10: yading10: Designate one or more input streams as a source for the output file. Each input yading10: stream is identified by the input file index INPUT_FILE_ID and yading10: the input stream index INPUT_STREAM_ID within the input yading10: file. Both indices start at 0. If specified, yading10: SYNC_FILE_ID:STREAM_SPECIFIER sets which input stream yading10: is used as a presentation sync reference. yading10: yading10: The first -map option on the command line specifies the yading10: source for output stream 0, the second -map option specifies yading10: the source for output stream 1, etc. yading10: yading10: A - character before the stream identifier creates a "negative" mapping. yading10: It disables matching streams from already created mappings. yading10: yading10: An alternative [LINKLABEL] form will map outputs from complex filter yading10: graphs (see the -filter_complex option) to the output file. yading10: LINKLABEL must correspond to a defined output link label in the graph. yading10: yading10: For example, to map ALL streams from the first input file to output yading10: yading10: ffmpeg -i INPUT -map 0 output yading10: example yading10: yading10: For example, if you have two audio streams in the first input file, yading10: these streams are identified by "0:0" and "0:1". You can use yading10: -map to select which streams to place in an output file. For yading10: example: yading10: yading10: ffmpeg -i INPUT -map 0:1 out.wav yading10: example yading10: will map the input stream in INPUT identified by "0:1" to yading10: the (single) output stream in out.wav. yading10: yading10: For example, to select the stream with index 2 from input file yading10: a.mov (specified by the identifier "0:2"), and stream with yading10: index 6 from input b.mov (specified by the identifier "1:6"), yading10: and copy them to the output file out.mov: yading10: yading10: ffmpeg -i a.mov -i b.mov -c copy -map 0:2 -map 1:6 out.mov yading10: example yading10: yading10: To select all video and the third audio stream from an input file: yading10: yading10: ffmpeg -i INPUT -map 0:v -map 0:a:2 OUTPUT yading10: example yading10: yading10: To map all the streams except the second audio, use negative mappings yading10: yading10: ffmpeg -i INPUT -map 0 -map -0:a:1 OUTPUT yading10: example yading10: yading10: Note that using this option disables the default mappings for this output file. yading10: yading10: -map_channel [INPUT_FILE_ID.STREAM_SPECIFIER.CHANNEL_ID|-1][:OUTPUT_FILE_ID.STREAM_SPECIFIER] yading10: Map an audio channel from a given input to an output. If yading10: OUTPUT_FILE_ID.STREAM_SPECIFIER is not set, the audio channel will yading10: be mapped on all the audio streams. yading10: yading10: Using "-1" instead of yading10: INPUT_FILE_ID.STREAM_SPECIFIER.CHANNEL_ID will map a muted yading10: channel. yading10: yading10: For example, assuming INPUT is a stereo audio file, you can switch the yading10: two audio channels with the following command: yading10: yading10: ffmpeg -i INPUT -map_channel 0.0.1 -map_channel 0.0.0 OUTPUT yading10: example yading10: yading10: If you want to mute the first channel and keep the second: yading10: yading10: ffmpeg -i INPUT -map_channel -1 -map_channel 0.0.1 OUTPUT yading10: example yading10: yading10: The order of the "-map_channel" option specifies the order of the channels in yading10: the output stream. The output channel layout is guessed from the number of yading10: channels mapped (mono if one "-map_channel", stereo if two, etc.). Using "-ac" yading10: in combination of "-map_channel" makes the channel gain levels to be updated if yading10: input and output channel layouts don't match (for instance two "-map_channel" yading10: options and "-ac 6"). yading10: yading10: You can also extract each channel of an input to specific outputs; the following yading10: command extracts two channels of the INPUT audio stream (file 0, stream 0) yading10: to the respective OUTPUT_CH0 and OUTPUT_CH1 outputs: yading10: yading10: ffmpeg -i INPUT -map_channel 0.0.0 OUTPUT_CH0 -map_channel 0.0.1 OUTPUT_CH1 yading10: example yading10: yading10: The following example splits the channels of a stereo input into two separate yading10: streams, which are put into the same output file: yading10: yading10: ffmpeg -i stereo.wav -map 0:0 -map 0:0 -map_channel 0.0.0:0.0 -map_channel 0.0.1:0.1 -y out.ogg yading10: example yading10: yading10: Note that currently each output stream can only contain channels from a single yading10: input stream; you can't for example use "-map_channel" to pick multiple input yading10: audio channels contained in different streams (from the same or different files) yading10: and merge them into a single output stream. It is therefore not currently yading10: possible, for example, to turn two separate mono streams into a single stereo yading10: stream. However splitting a stereo stream into two single channel mono streams yading10: is possible. yading10: yading10: If you need this feature, a possible workaround is to use the amerge yading10: filter. For example, if you need to merge a media (here input.mkv) with 2 yading10: mono audio streams into one single stereo channel audio stream (and keep the yading10: video stream), you can use the following command: yading10: yading10: ffmpeg -i input.mkv -filter_complex "[0:1] [0:2] amerge" -c:a pcm_s16le -c:v copy output.mkv yading10: example yading10: yading10: -map_metadata[:METADATA_SPEC_OUT] INFILE[:METADATA_SPEC_IN] (output,per-metadata) yading10: Set metadata information of the next output file from INFILE. Note that yading10: those are file indices (zero-based), not filenames. yading10: Optional METADATA_SPEC_IN/OUT parameters specify, which metadata to copy. yading10: A metadata specifier can have the following forms: yading10: yading10: G yading10: global metadata, i.e. metadata that applies to the whole file yading10: yading10: S[:STREAM_SPEC] yading10: per-stream metadata. STREAM_SPEC is a stream specifier as described yading10: in the Stream specifiers chapter. In an input metadata specifier, the first yading10: matching stream is copied from. In an output metadata specifier, all matching yading10: streams are copied to. yading10: yading10: C:CHAPTER_INDEX yading10: per-chapter metadata. CHAPTER_INDEX is the zero-based chapter index. yading10: yading10: P:PROGRAM_INDEX yading10: per-program metadata. PROGRAM_INDEX is the zero-based program index. yading10: table yading10: If metadata specifier is omitted, it defaults to global. yading10: yading10: By default, global metadata is copied from the first input file, yading10: per-stream and per-chapter metadata is copied along with streams/chapters. These yading10: default mappings are disabled by creating any mapping of the relevant type. A negative yading10: file index can be used to create a dummy mapping that just disables automatic copying. yading10: yading10: For example to copy metadata from the first stream of the input file to global metadata yading10: of the output file: yading10: yading10: ffmpeg -i in.ogg -map_metadata 0:s:0 out.mp3 yading10: example yading10: yading10: To do the reverse, i.e. copy global metadata to all audio streams: yading10: yading10: ffmpeg -i in.mkv -map_metadata:s:a 0:g out.mkv yading10: example yading10: Note that simple 0 would work as well in this example, since global yading10: metadata is assumed by default. yading10: yading10: -map_chapters INPUT_FILE_INDEX (output) yading10: Copy chapters from input file with index INPUT_FILE_INDEX to the next yading10: output file. If no chapter mapping is specified, then chapters are copied from yading10: the first input file with at least one chapter. Use a negative file index to yading10: disable any chapter copying. yading10: yading10: -benchmark (global) yading10: Show benchmarking information at the end of an encode. yading10: Shows CPU time used and maximum memory consumption. yading10: Maximum memory consumption is not supported on all systems, yading10: it will usually display as 0 if not supported. yading10: -benchmark_all (global) yading10: Show benchmarking information during the encode. yading10: Shows CPU time used in various steps (audio/video encode/decode). yading10: -timelimit DURATION (global) yading10: Exit after ffmpeg has been running for DURATION seconds. yading10: -dump (global) yading10: Dump each input packet to stderr. yading10: -hex (global) yading10: When dumping packets, also dump the payload. yading10: -re (input) yading10: Read input at native frame rate. Mainly used to simulate a grab device. yading10: By default ffmpeg attempts to read the input(s) as fast as possible. yading10: This option will slow down the reading of the input(s) to the native frame rate yading10: of the input(s). It is useful for real-time output (e.g. live streaming). If yading10: your input(s) is coming from some other live streaming source (through HTTP or yading10: UDP for example) the server might already be in real-time, thus the option will yading10: likely not be required. On the other hand, this is meaningful if your input(s) yading10: is a file you are trying to push in real-time. yading10: -loop_input yading10: Loop over the input stream. Currently it works only for image yading10: streams. This option is used for automatic FFserver testing. yading10: This option is deprecated, use -loop 1. yading10: -loop_output NUMBER_OF_TIMES yading10: Repeatedly loop output for formats that support looping such as animated GIF yading10: (0 will loop the output infinitely). yading10: This option is deprecated, use -loop. yading10: -vsync PARAMETER yading10: Video sync method. yading10: For compatibility reasons old values can be specified as numbers. yading10: Newly added values will have to be specified as strings always. yading10: yading10: yading10: 0, passthrough yading10: Each frame is passed with its timestamp from the demuxer to the muxer. yading10: 1, cfr yading10: Frames will be duplicated and dropped to achieve exactly the requested yading10: constant frame rate. yading10: 2, vfr yading10: Frames are passed through with their timestamp or dropped so as to yading10: prevent 2 frames from having the same timestamp. yading10: drop yading10: As passthrough but destroys all timestamps, making the muxer generate yading10: fresh timestamps based on frame-rate. yading10: -1, auto yading10: Chooses between 1 and 2 depending on muxer capabilities. This is the yading10: default method. yading10: table yading10: yading10: Note that the timestamps may be further modified by the muxer, after this. yading10: For example, in the case that the format option avoid_negative_ts yading10: is enabled. yading10: yading10: With -map you can select from which stream the timestamps should be yading10: taken. You can leave either video or audio unchanged and sync the yading10: remaining stream(s) to the unchanged one. yading10: yading10: -async SAMPLES_PER_SECOND yading10: Audio sync method. "Stretches/squeezes" the audio stream to match the timestamps, yading10: the parameter is the maximum samples per second by which the audio is changed. yading10: -async 1 is a special case where only the start of the audio stream is corrected yading10: without any later correction. yading10: yading10: Note that the timestamps may be further modified by the muxer, after this. yading10: For example, in the case that the format option avoid_negative_ts yading10: is enabled. yading10: yading10: This option has been deprecated. Use the aresample audio filter instead. yading10: yading10: -copyts yading10: Do not process input timestamps, but keep their values without trying yading10: to sanitize them. In particular, do not remove the initial start time yading10: offset value. yading10: yading10: Note that, depending on the vsync option or on specific muxer yading10: processing (e.g. in case the format option avoid_negative_ts yading10: is enabled) the output timestamps may mismatch with the input yading10: timestamps even when this option is selected. yading10: yading10: -copytb MODE yading10: Specify how to set the encoder timebase when stream copying.  MODE is an yading10: integer numeric value, and can assume one of the following values: yading10: yading10: yading10: 1 yading10: Use the demuxer timebase. yading10: yading10: The time base is copied to the output encoder from the corresponding input yading10: demuxer. This is sometimes required to avoid non monotonically increasing yading10: timestamps when copying video streams with variable frame rate. yading10: yading10: 0 yading10: Use the decoder timebase. yading10: yading10: The time base is copied to the output encoder from the corresponding input yading10: decoder. yading10: yading10: -1 yading10: Try to make the choice automatically, in order to generate a sane output. yading10: table yading10: yading10: Default value is -1. yading10: yading10: -shortest (output) yading10: Finish encoding when the shortest input stream ends. yading10: -dts_delta_threshold yading10: Timestamp discontinuity delta threshold. yading10: -muxdelay SECONDS (input) yading10: Set the maximum demux-decode delay. yading10: -muxpreload SECONDS (input) yading10: Set the initial demux-decode delay. yading10: -streamid OUTPUT-STREAM-INDEX:NEW-VALUE (output) yading10: Assign a new stream-id value to an output stream. This option should be yading10: specified prior to the output filename to which it applies. yading10: For the situation where multiple output files exist, a streamid yading10: may be reassigned to a different value. yading10: yading10: For example, to set the stream 0 PID to 33 and the stream 1 PID to 36 for yading10: an output mpegts file: yading10: yading10: ffmpeg -i infile -streamid 0:33 -streamid 1:36 out.ts yading10: example yading10: yading10: -bsf[:STREAM_SPECIFIER] BITSTREAM_FILTERS (output,per-stream) yading10: Set bitstream filters for matching streams. BITSTREAM_FILTERS is yading10: a comma-separated list of bitstream filters. Use the -bsfs option yading10: to get the list of bitstream filters. yading10: yading10: ffmpeg -i h264.mp4 -c:v copy -bsf:v h264_mp4toannexb -an out.h264 yading10: example yading10: yading10: ffmpeg -i file.mov -an -vn -bsf:s mov2textsub -c:s copy -f rawvideo sub.txt yading10: example yading10: yading10: -tag[:STREAM_SPECIFIER] CODEC_TAG (per-stream) yading10: Force a tag/fourcc for matching streams. yading10: yading10: -timecode HH:MM:SSSEPFF yading10: Specify Timecode for writing. SEP is ':' for non drop timecode and ';' yading10: (or '.') for drop. yading10: yading10: ffmpeg -i input.mpg -timecode 01:02:03.04 -r 30000/1001 -s ntsc output.mpg yading10: example yading10: yading10: yading10: -filter_complex FILTERGRAPH (global) yading10: Define a complex filtergraph, i.e. one with arbitrary number of inputs and/or yading10: outputs. For simple graphs -- those with one input and one output of the same yading10: type -- see the -filter options. FILTERGRAPH is a description of yading10: the filtergraph, as described in the ``Filtergraph syntax'' section of the yading10: ffmpeg-filters manual. yading10: yading10: Input link labels must refer to input streams using the yading10: [file_index:stream_specifier] syntax (i.e. the same as -map yading10: uses). If STREAM_SPECIFIER matches multiple streams, the first one will be yading10: used. An unlabeled input will be connected to the first unused input stream of yading10: the matching type. yading10: yading10: Output link labels are referred to with -map. Unlabeled outputs are yading10: added to the first output file. yading10: yading10: Note that with this option it is possible to use only lavfi sources without yading10: normal input files. yading10: yading10: For example, to overlay an image over video yading10: yading10: ffmpeg -i video.mkv -i image.png -filter_complex '[0:v][1:v]overlay[out]' -map yading10: '[out]' out.mkv yading10: example yading10: Here [0:v] refers to the first video stream in the first input file, yading10: which is linked to the first (main) input of the overlay filter. Similarly the yading10: first video stream in the second input is linked to the second (overlay) input yading10: of overlay. yading10: yading10: Assuming there is only one video stream in each input file, we can omit input yading10: labels, so the above is equivalent to yading10: yading10: ffmpeg -i video.mkv -i image.png -filter_complex 'overlay[out]' -map yading10: '[out]' out.mkv yading10: example yading10: yading10: Furthermore we can omit the output label and the single output from the filter yading10: graph will be added to the output file automatically, so we can simply write yading10: yading10: ffmpeg -i video.mkv -i image.png -filter_complex 'overlay' out.mkv yading10: example yading10: yading10: To generate 5 seconds of pure red video using lavfi color source: yading10: yading10: ffmpeg -filter_complex 'color=c=red' -t 5 out.mkv yading10: example yading10: yading10: -lavfi FILTERGRAPH (global) yading10: Define a complex filtergraph, i.e. one with arbitrary number of inputs and/or yading10: outputs. Equivalent to -filter_complex. yading10: yading10: -filter_complex_script FILENAME (global) yading10: This option is similar to -filter_complex, the only difference is that yading10: its argument is the name of the file from which a complex filtergraph yading10: description is to be read. yading10: yading10: table yading10: yading10: As a special exception, you can use a bitmap subtitle stream as input: it yading10: will be converted into a video with the same size as the largest video in yading10: the file, or 720x576 if no video is present. Note that this is an yading10: experimental and temporary solution. It will be removed once libavfilter has yading10: proper support for subtitles. yading10: yading10: For example, to hardcode subtitles on top of a DVB-T recording stored in yading10: MPEG-TS format, delaying the subtitles by 1 second: yading10: yading10: ffmpeg -i input.ts -filter_complex \ yading10:   '[#0x2ef] setpts=PTS+1/TB [sub] ; [#0x2d0] [sub] overlay' \ yading10:   -sn -map '#0x2dc' output.mkv yading10: example yading10: (0x2d0, 0x2dc and 0x2ef are the MPEG-TS PIDs of respectively the video, yading10: audio and subtitles streams; 0:0, 0:3 and 0:7 would have worked too) yading10: yading10: Preset files yading10: A preset file contains a sequence of OPTION=VALUE pairs, yading10: one for each line, specifying a sequence of options which would be yading10: awkward to specify on the command line. Lines starting with the hash yading10: ('#') character are ignored and are used to provide comments. Check yading10: the presets directory in the FFmpeg source tree for examples. yading10: yading10: Preset files are specified with the vpre, apre, yading10: spre, and fpre options. The fpre option takes the yading10: filename of the preset instead of a preset name as input and can be yading10: used for any kind of codec. For the vpre, apre, and yading10: spre options, the options specified in a preset file are yading10: applied to the currently selected codec of the same type as the preset yading10: option. yading10: yading10: The argument passed to the vpre, apre, and spre yading10: preset options identifies the preset file to use according to the yading10: following rules: yading10: yading10: First ffmpeg searches for a file named ARG.ffpreset in the yading10: directories $FFMPEG_DATADIR (if set), and $HOME/.ffmpeg, and in yading10: the datadir defined at configuration time (usually PREFIX/share/ffmpeg) yading10: or in a ffpresets folder along the executable on win32, yading10: in that order. For example, if the argument is libvpx-1080p, it will yading10: search for the file libvpx-1080p.ffpreset. yading10: yading10: If no such file is found, then ffmpeg will search for a file named yading10: CODEC_NAME-ARG.ffpreset in the above-mentioned yading10: directories, where CODEC_NAME is the name of the codec to which yading10: the preset file options will be applied. For example, if you select yading10: the video codec with -vcodec libvpx and use -vpre 1080p, yading10: then it will search for the file libvpx-1080p.ffpreset. yading10: yading10: yading10: Tips yading10: yading10: yading10: yading10: yading10: For streaming at very low bitrate application, use a low frame rate yading10: and a small GOP size. This is especially true for RealVideo where yading10: the Linux player does not seem to be very fast, so it can miss yading10: frames. An example is: yading10: yading10: yading10: ffmpeg -g 3 -r 3 -t 10 -b:v 50k -s qcif -f rv10 /tmp/b.rm yading10: example yading10: yading10: yading10: The parameter 'q' which is displayed while encoding is the current yading10: quantizer. The value 1 indicates that a very good quality could yading10: be achieved. The value 31 indicates the worst quality. If q=31 appears yading10: too often, it means that the encoder cannot compress enough to meet yading10: your bitrate. You must either increase the bitrate, decrease the yading10: frame rate or decrease the frame size. yading10: yading10: yading10: If your computer is not fast enough, you can speed up the yading10: compression at the expense of the compression ratio. You can use yading10: '-me zero' to speed up motion estimation, and '-g 0' to disable yading10: motion estimation completely (you have only I-frames, which means it yading10: is about as good as JPEG compression). yading10: yading10: yading10: To have very low audio bitrates, reduce the sampling frequency yading10: (down to 22050 Hz for MPEG audio, 22050 or 11025 for AC-3). yading10: yading10: yading10: To have a constant quality (but a variable bitrate), use the option yading10: '-qscale n' when 'n' is between 1 (excellent quality) and 31 (worst yading10: quality). yading10: yading10: itemize yading10: yading10: yading10: Examples yading10: yading10: yading10: Preset files yading10: yading10: A preset file contains a sequence of OPTION=VALUE pairs, one for yading10: each line, specifying a sequence of options which can be specified also on yading10: the command line. Lines starting with the hash ('#') character are ignored and yading10: are used to provide comments. Empty lines are also ignored. Check the yading10: presets directory in the FFmpeg source tree for examples. yading10: yading10: Preset files are specified with the pre option, this option takes a yading10: preset name as input.  FFmpeg searches for a file named PRESET_NAME.avpreset in yading10: the directories $AVCONV_DATADIR (if set), and $HOME/.ffmpeg, and in yading10: the data directory defined at configuration time (usually $PREFIX/share/ffmpeg) yading10: in that order.  For example, if the argument is libx264-max, it will yading10: search for the file libx264-max.avpreset. yading10: yading10: Video and Audio grabbing yading10: yading10: If you specify the input format and device then ffmpeg can grab video yading10: and audio directly. yading10: yading10: yading10: ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg yading10: example yading10: yading10: Or with an ALSA audio source (mono input, card id 1) instead of OSS: yading10: yading10: ffmpeg -f alsa -ac 1 -i hw:1 -f video4linux2 -i /dev/video0 /tmp/out.mpg yading10: example yading10: yading10: Note that you must activate the right video source and channel before yading10: launching ffmpeg with any TV viewer such as yading10: xawtv (http://linux.bytesex.org/xawtv/) by Gerd Knorr. You also yading10: have to set the audio recording levels correctly with a yading10: standard mixer. yading10: yading10: X11 grabbing yading10: yading10: Grab the X11 display with ffmpeg via yading10: yading10: yading10: ffmpeg -f x11grab -s cif -r 25 -i :0.0 /tmp/out.mpg yading10: example yading10: yading10: 0.0 is display.screen number of your X11 server, same as yading10: the DISPLAY environment variable. yading10: yading10: yading10: ffmpeg -f x11grab -s cif -r 25 -i :0.0+10,20 /tmp/out.mpg yading10: example yading10: yading10: 0.0 is display.screen number of your X11 server, same as the DISPLAY environment yading10: variable. 10 is the x-offset and 20 the y-offset for the grabbing. yading10: yading10: Video and Audio file format conversion yading10: yading10: Any supported file format and protocol can serve as input to ffmpeg: yading10: yading10: Examples: yading10: yading10: yading10: You can use YUV files as input: yading10: yading10: yading10: ffmpeg -i /tmp/test%d.Y /tmp/out.mpg yading10: example yading10: yading10: It will use the files: yading10: yading10: /tmp/test0.Y, /tmp/test0.U, /tmp/test0.V, yading10: /tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc... yading10: example yading10: yading10: The Y files use twice the resolution of the U and V files. They are yading10: raw files, without header. They can be generated by all decent video yading10: decoders. You must specify the size of the image with the -s option yading10: if ffmpeg cannot guess it. yading10: yading10: yading10: You can input from a raw YUV420P file: yading10: yading10: yading10: ffmpeg -i /tmp/test.yuv /tmp/out.avi yading10: example yading10: yading10: test.yuv is a file containing raw YUV planar data. Each frame is composed yading10: of the Y plane followed by the U and V planes at half vertical and yading10: horizontal resolution. yading10: yading10: yading10: You can output to a raw YUV420P file: yading10: yading10: yading10: ffmpeg -i mydivx.avi hugefile.yuv yading10: example yading10: yading10: yading10: You can set several input files and output files: yading10: yading10: yading10: ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg yading10: example yading10: yading10: Converts the audio file a.wav and the raw YUV video file a.yuv yading10: to MPEG file a.mpg. yading10: yading10: yading10: You can also do audio and video conversions at the same time: yading10: yading10: yading10: ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2 yading10: example yading10: yading10: Converts a.wav to MPEG audio at 22050 Hz sample rate. yading10: yading10: yading10: You can encode to several formats at the same time and define a yading10: mapping from input stream to output streams: yading10: yading10: yading10: ffmpeg -i /tmp/a.wav -map 0:a -b:a 64k /tmp/a.mp2 -map 0:a -b:a 128k /tmp/b.mp2 yading10: example yading10: yading10: Converts a.wav to a.mp2 at 64 kbits and to b.mp2 at 128 kbits. '-map yading10: file:index' specifies which input stream is used for each output yading10: stream, in the order of the definition of output streams. yading10: yading10: yading10: You can transcode decrypted VOBs: yading10: yading10: yading10: ffmpeg -i snatch_1.vob -f avi -c:v mpeg4 -b:v 800k -g 300 -bf 2 -c:a libmp3lame -b:a 128k snatch.avi yading10: example yading10: yading10: This is a typical DVD ripping example; the input is a VOB file, the yading10: output an AVI file with MPEG-4 video and MP3 audio. Note that in this yading10: command we use B-frames so the MPEG-4 stream is DivX5 compatible, and yading10: GOP size is 300 which means one intra frame every 10 seconds for 29.97fps yading10: input video. Furthermore, the audio stream is MP3-encoded so you need yading10: to enable LAME support by passing --enable-libmp3lame to configure. yading10: The mapping is particularly useful for DVD transcoding yading10: to get the desired audio language. yading10: yading10: NOTE: To see the supported input formats, use ffmpeg -formats. yading10: yading10: yading10: You can extract images from a video, or create a video from many images: yading10: yading10: For extracting images from a video: yading10: yading10: ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg yading10: example yading10: yading10: This will extract one video frame per second from the video and will yading10: output them in files named foo-001.jpeg, foo-002.jpeg, yading10: etc. Images will be rescaled to fit the new WxH values. yading10: yading10: If you want to extract just a limited number of frames, you can use the yading10: above command in combination with the -vframes or -t option, or in yading10: combination with -ss to start extracting from a certain point in time. yading10: yading10: For creating a video from many images: yading10: yading10: ffmpeg -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi yading10: example yading10: yading10: The syntax foo-%03d.jpeg specifies to use a decimal number yading10: composed of three digits padded with zeroes to express the sequence yading10: number. It is the same syntax supported by the C printf function, but yading10: only formats accepting a normal integer are suitable. yading10: yading10: When importing an image sequence, -i also supports expanding yading10: shell-like wildcard patterns (globbing) internally, by selecting the yading10: image2-specific -pattern_type glob option. yading10: yading10: For example, for creating a video from filenames matching the glob pattern yading10: foo-*.jpeg: yading10: yading10: ffmpeg -f image2 -pattern_type glob -i 'foo-*.jpeg' -r 12 -s WxH foo.avi yading10: example yading10: yading10: yading10: You can put many streams of the same type in the output: yading10: yading10: yading10: ffmpeg -i test1.avi -i test2.avi -map 0:3 -map 0:2 -map 0:1 -map 0:0 -c copy test12.nut yading10: example yading10: yading10: The resulting output file test12.avi will contain first four streams from yading10: the input file in reverse order. yading10: yading10: yading10: To force CBR video output: yading10: yading10: ffmpeg -i myfile.avi -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v yading10: example yading10: yading10: yading10: The four options lmin, lmax, mblmin and mblmax use 'lambda' units, yading10: but you may use the QP2LAMBDA constant to easily convert from 'q' units: yading10: yading10: ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext yading10: example yading10: yading10: itemize yading10: yading10: yading10: config-all yading10: all-components.texi yading10: ifset yading10: yading10: See Also yading10: yading10: yading10: config-all yading10: ffmpeg (ffmpeg.html) yading10: ifset yading10: config-not-all yading10: ffmpeg-all (ffmpeg-all.html), yading10: ifset yading10: ffplay (ffplay.html), ffprobe (ffprobe.html), ffserver (ffserver.html), yading10: ffmpeg-utils (ffmpeg-utils.html), yading10: ffmpeg-scaler (ffmpeg-scaler.html), yading10: ffmpeg-resampler (ffmpeg-resampler.html), yading10: ffmpeg-codecs (ffmpeg-codecs.html), yading10: ffmpeg-bitstream-filters (ffmpeg-bitstream-filters.html), yading10: ffmpeg-formats (ffmpeg-formats.html), yading10: ffmpeg-devices (ffmpeg-devices.html), yading10: ffmpeg-protocols (ffmpeg-protocols.html), yading10: ffmpeg-filters (ffmpeg-filters.html) yading10: ifhtml yading10: yading10: yading10: config-all yading10: ffmpeg(1), yading10: ifset yading10: config-not-all yading10: ffmpeg-all(1), yading10: ifset yading10: ffplay(1), ffprobe(1), ffserver(1), yading10: ffmpeg-utils(1), ffmpeg-scaler(1), ffmpeg-resampler(1), yading10: ffmpeg-codecs(1), ffmpeg-bitstream-filters(1), ffmpeg-formats(1), yading10: ffmpeg-devices(1), ffmpeg-protocols(1), ffmpeg-filters(1) yading10: ifnothtml yading10: yading10: authors.texi yading10: yading10: yading10: yading10: ffmpeg yading10: ffmpeg video converter yading10: yading10: ignore yading10: yading10: