MAN page from Fedora 28 ffmpeg-doc-4.1.1-1.fc28.i686.rpm
FFMPEG-FORMATS
Section: (1)
Updated:
Index NAME
ffmpeg-formats - FFmpeg formats
DESCRIPTION
This document describes the supported formats (muxers and demuxers)provided by the libavformat library.
FORMAT OPTIONS
The libavformat library provides some generic global options, whichcan be set on all the muxers and demuxers. In addition each muxer ordemuxer may support so-called private options, which are specific forthat component.
Options may be set by specifying -option value in theFFmpeg tools, or by setting the value explicitly in the"AVFormatContext" options or using the libavutil/opt.h APIfor programmatic use.
The list of supported options follows:
- avioflags flags (input/output)
- Possible values:
- direct
- Reduce buffering.
- probesize integer (input)
- Set probing size in bytes, i.e. the size of the data to analyze to getstream information. A higher value will enable detecting moreinformation in case it is dispersed into the stream, but will increaselatency. Must be an integer not lesser than 32. It is 5000000 by default.
- packetsize integer (output)
- Set packet size.
- fflags flags
- Set format flags. Some are implemented for a limited number of formats.
Possible values for input files:
- discardcorrupt
- Discard corrupted packets.
- fastseek
- Enable fast, but inaccurate seeks for some formats.
- genpts
- Generate missing PTS if DTS is present.
- igndts
- Ignore DTS if PTS is set. Inert when nofillin is set.
- ignidx
- Ignore index.
- keepside (deprecated,inert)
- nobuffer
- Reduce the latency introduced by buffering during initial input streams analysis.
- nofillin
- Do not fill in missing values in packet fields that can be exactly calculated.
- noparse
- Disable AVParsers, this needs "+nofillin" too.
- sortdts
- Try to interleave output packets by DTS. At present, available only for AVIs with an index.
Possible values for output files:
- autobsf
- Automatically apply bitstream filters as required by the output format. Enabled by default.
- bitexact
- Only write platform-, build- and time-independent data.This ensures that file and data checksums are reproducible and match betweenplatforms. Its primary use is for regression testing.
- flush_packets
- Write out packets immediately.
- latm (deprecated,inert)
- shortest
- Stop muxing at the end of the shortest stream.It may be needed to increase max_interleave_delta to avoid flushing the longerstreams before EOF.
- seek2any integer (input)
- Allow seeking to non-keyframes on demuxer level when supported if set to 1.Default is 0.
- analyzeduration integer (input)
- Specify how many microseconds are analyzed to probe the input. Ahigher value will enable detecting more accurate information, but willincrease latency. It defaults to 5,000,000 microseconds = 5 seconds.
- cryptokey hexadecimal string (input)
- Set decryption key.
- indexmem integer (input)
- Set max memory used for timestamp index (per stream).
- rtbufsize integer (input)
- Set max memory used for buffering real-time frames.
- fdebug flags (input/output)
- Print specific debug info.
Possible values:
- ts
- max_delay integer (input/output)
- Set maximum muxing or demuxing delay in microseconds.
- fpsprobesize integer (input)
- Set number of frames used to probe fps.
- audio_preload integer (output)
- Set microseconds by which audio packets should be interleaved earlier.
- chunk_duration integer (output)
- Set microseconds for each chunk.
- chunk_size integer (output)
- Set size in bytes for each chunk.
- err_detect, f_err_detect flags (input)
- Set error detection flags. "f_err_detect" is deprecated andshould be used only via the ffmpeg tool.
Possible values:
- crccheck
- Verify embedded CRCs.
- bitstream
- Detect bitstream specification deviations.
- buffer
- Detect improper bitstream length.
- explode
- Abort decoding on minor error detection.
- careful
- Consider things that violate the spec and have not been seen in thewild as errors.
- compliant
- Consider all spec non compliancies as errors.
- aggressive
- Consider things that a sane encoder should not do as an error.
- max_interleave_delta integer (output)
- Set maximum buffering duration for interleaving. The duration isexpressed in microseconds, and defaults to 1000000 (1 second).
To ensure all the streams are interleaved correctly, libavformat willwait until it has at least one packet for each stream before actuallywriting any packets to the output file. When some streams are``sparse'' (i.e. there are large gaps between successive packets), thiscan result in excessive buffering.
This field specifies the maximum difference between the timestamps of thefirst and the last packet in the muxing queue, above which libavformatwill output a packet regardless of whether it has queued a packet for allthe streams.
If set to 0, libavformat will continue buffering packets until it hasa packet for each stream, regardless of the maximum timestampdifference between the buffered packets.
- use_wallclock_as_timestamps integer (input)
- Use wallclock as timestamps if set to 1. Default is 0.
- avoid_negative_ts integer (output)
- Possible values:
- make_non_negative
- Shift timestamps to make them non-negative.Also note that this affects only leading negative timestamps, and notnon-monotonic negative timestamps.
- make_zero
- Shift timestamps so that the first timestamp is 0.
- auto (default)
- Enables shifting when required by the target format.
- disabled
- Disables shifting of timestamp.
When shifting is enabled, all output timestamps are shifted by thesame amount. Audio, video, and subtitles desynching and relativetimestamp differences are preserved compared to how they would havebeen without shifting.
- skip_initial_bytes integer (input)
- Set number of bytes to skip before reading header and frames if set to 1.Default is 0.
- correct_ts_overflow integer (input)
- Correct single timestamp overflows if set to 1. Default is 1.
- flush_packets integer (output)
- Flush the underlying I/O stream after each packet. Default is -1 (auto), whichmeans that the underlying protocol will decide, 1 enables it, and has theeffect of reducing the latency, 0 disables it and may increase IO throughput insome cases.
- output_ts_offset offset (output)
- Set the output time offset.
offset must be a time duration specification,see the Time duration section in the ffmpeg-utils(1) manual.
The offset is added by the muxer to the output timestamps.
Specifying a positive offset means that the corresponding streams aredelayed bt the time duration specified in offset. Default valueis 0 (meaning that no offset is applied).
- format_whitelist list (input)
- ``,'' separated list of allowed demuxers. By default all are allowed.
- dump_separator string (input)
- Separator used to separate the fields printed on the command line about theStream parameters.For example to separate the fields with newlines and indention:
ffprobe -dump_separator " " -i ~/videos/matrixbench_mpeg2.mpg
- max_streams integer (input)
- Specifies the maximum number of streams. This can be used to reject files thatwould require too many resources due to a large number of streams.
- skip_estimate_duration_from_pts bool (input)
- Skip estimation of input duration when calculated using PTS.At present, applicable for MPEG-PS and MPEG-TS.
Format stream specifiers
Format stream specifiers allow selection of one or more streams thatmatch specific properties.
Possible forms of stream specifiers are:
- stream_index
- Matches the stream with this index.
- stream_type[:stream_index]
- stream_type is one of following: 'v' for video, 'a' for audio,'s' for subtitle, 'd' for data, and 't' for attachments. Ifstream_index is given, then it matches the stream numberstream_index of this type. Otherwise, it matches all streams ofthis type.
- p:program_id[:stream_index]
- If stream_index is given, then it matches the stream with numberstream_index in the program with the idprogram_id. Otherwise, it matches all streams in the program.
- #stream_id
- Matches the stream by a format-specific ID.
The exact semantics of stream specifiers is defined by the"avformat_match_stream_specifier()" function declared in thelibavformat/avformat.h header.
DEMUXERS
Demuxers are configured elements in FFmpeg that can read themultimedia streams from a particular type of file.
When you configure your FFmpeg build, all the supported demuxersare enabled by default. You can list all available ones using theconfigure option "--list-demuxers".
You can disable all the demuxers using the configure option"--disable-demuxers", and selectively enable a single demuxer withthe option "--enable-demuxer=DEMUXER", or disable itwith the option "--disable-demuxer=DEMUXER".
The option "-demuxers" of the ff* tools will display the list ofenabled demuxers. Use "-formats" to view a combined list ofenabled demuxers and muxers.
The description of some of the currently available demuxers follows.
aa
Audible Format 2, 3, and 4 demuxer.
This demuxer is used to demux Audible Format 2, 3, and 4 (.aa) files.
applehttp
Apple
HTTP Live Streaming demuxer.
This demuxer presents all AVStreams from all variant streams.The id field is set to the bitrate variant index number. By settingthe discard flags on AVStreams (by pressing 'a' or 'v' in ffplay),the caller can decide which variant streams to actually receive.The total bitrate of the variant that the stream belongs to isavailable in a metadata key named ``variant_bitrate''.
apng
Animated Portable Network Graphics demuxer.
This demuxer is used to demux APNG files.All headers, but the PNG signature, up to (but not including) the firstfcTL chunk are transmitted as extradata.Frames are then split as being all the chunks between two fcTL ones, orbetween the last fcTL and IEND chunks.
- -ignore_loop bool
- Ignore the loop variable in the file if set.
- -max_fps int
- Maximum framerate in frames per second (0 for no limit).
- -default_fps int
- Default framerate in frames per second when none is specified in the file(0 meaning as fast as possible).
asf
Advanced Systems Format demuxer.
This demuxer is used to demux ASF files and MMS network streams.
- -no_resync_search bool
- Do not try to resynchronize by looking for a certain optional start code.
concat
Virtual concatenation script demuxer.
This demuxer reads a list of files and other directives from a text file anddemuxes them one after the other, as if all their packets had been muxedtogether.
The timestamps in the files are adjusted so that the first file starts at 0and each next file starts where the previous one finishes. Note that it isdone globally and may cause gaps if all streams do not have exactly the samelength.
All files must have the same streams (same codecs, same time base, etc.).
The duration of each file is used to adjust the timestamps of the next file:if the duration is incorrect (because it was computed using the bit-rate orbecause the file is truncated, for example), it can cause artifacts. The"duration" directive can be used to override the duration stored ineach file.
Syntax
The script is a text file in extended-ASCII, with one directive per line.Empty lines, leading spaces and lines starting with '#' are ignored. Thefollowing directive is recognized:
- file path
- Path to a file to read; special characters and spaces must be escaped withbackslash or single quotes.
All subsequent file-related directives apply to that file.
- ffconcat version 1.0
- Identify the script type and version. It also sets the safe optionto 1 if it was -1.
To make FFmpeg recognize the format automatically, this directive mustappear exactly as is (no extra space or byte-order-mark) on the very firstline of the script.
- duration dur
- Duration of the file. This information can be specified from the file;specifying it here may be more efficient or help if the information from thefile is not available or accurate.
If the duration is set for all files, then it is possible to seek in thewhole concatenated video.
- inpoint timestamp
- In point of the file. When the demuxer opens the file it instantly seeks to thespecified timestamp. Seeking is done so that all streams can be presentedsuccessfully at In point.
This directive works best with intra frame codecs, because for non-intra frameones you will usually get extra packets before the actual In point and thedecoded content will most likely contain frames before In point too.
For each file, packets before the file In point will have timestamps less thanthe calculated start timestamp of the file (negative in case of the firstfile), and the duration of the files (if not specified by the "duration"directive) will be reduced based on their specified In point.
Because of potential packets before the specified In point, packet timestampsmay overlap between two concatenated files.
- outpoint timestamp
- Out point of the file. When the demuxer reaches the specified decodingtimestamp in any of the streams, it handles it as an end of file condition andskips the current and all the remaining packets from all streams.
Out point is exclusive, which means that the demuxer will not output packetswith a decoding timestamp greater or equal to Out point.
This directive works best with intra frame codecs and formats where all streamsare tightly interleaved. For non-intra frame codecs you will usually getadditional packets with presentation timestamp after Out point therefore thedecoded content will most likely contain frames after Out point too. If yourstreams are not tightly interleaved you may not get all the packets from allstreams before Out point and you may only will be able to decode the earlieststream until Out point.
The duration of the files (if not specified by the "duration"directive) will be reduced based on their specified Out point.
- file_packet_metadata key=value
- Metadata of the packets of the file. The specified metadata will be set foreach file packet. You can specify this directive multiple times to add multiplemetadata entries.
- stream
- Introduce a stream in the virtual file.All subsequent stream-related directives apply to the last introducedstream.Some streams properties must be set in order to allow identifying thematching streams in the subfiles.If no streams are defined in the script, the streams from the first file arecopied.
- exact_stream_id id
- Set the id of the stream.If this directive is given, the string with the corresponding id in thesubfiles will be used.This is especially useful for MPEG-PS (VOB) files, where the order of thestreams is not reliable.
Options
This demuxer accepts the following option:
- safe
- If set to 1, reject unsafe file paths. A file path is considered safe if itdoes not contain a protocol specification and is relative and all componentsonly contain characters from the portable character set (letters, digits,period, underscore and hyphen) and have no period at the beginning of acomponent.
If set to 0, any file name is accepted.
The default is 1.
-1 is equivalent to 1 if the format was automaticallyprobed and 0 otherwise.
- auto_convert
- If set to 1, try to perform automatic conversions on packet data to make thestreams concatenable.The default is 1.
Currently, the only conversion is adding the h264_mp4toannexb bitstreamfilter to H.264 streams in MP4 format. This is necessary in particular ifthere are resolution changes.
- segment_time_metadata
- If set to 1, every packet will contain the lavf.concat.start_time and thelavf.concat.duration packet metadata values which are the start_time andthe duration of the respective file segments in the concatenated outputexpressed in microseconds. The duration metadata is only set if it is knownbased on the concat file.The default is 0.
Examples
- *
- Use absolute filenames and include some comments:
# my first filename file /mnt/share/file-1.wav # my second filename including whitespace file '/mnt/share/file 2.wav' # my third filename including whitespace plus single quote file '/mnt/share/file 3'\''.wav'
- *
- Allow for input format auto-probing, use safe filenames and set the duration ofthe first file:
ffconcat version 1.0 file file-1.wav duration 20.0 file subdir/file-2.wav
dash
Dynamic Adaptive Streaming over
HTTP demuxer.
This demuxer presents all AVStreams found in the manifest.By setting the discard flags on AVStreams the caller can decidewhich streams to actually receive.Each stream mirrors the "id" and "bandwidth" properties from the"<Representation>" as metadata keys named ``id'' and ``variant_bitrate'' respectively.
flv, live_flv
Adobe Flash Video Format demuxer.
This demuxer is used to demux FLV files and RTMP network streams. In case of live network streams, if you force format, you may use live_flv option instead of flv to survive timestamp discontinuities.
ffmpeg -f flv -i myfile.flv ... ffmpeg -f live_flv -i rtmp://<any.server>/anything/key ....
- -flv_metadata bool
- Allocate the streams according to the onMetaData array content.
- -flv_ignore_prevtag bool
- Ignore the size of previous tag value.
- -flv_full_metadata bool
- Output all context of the onMetadata.
gif
Animated
GIF demuxer.
It accepts the following options:
- min_delay
- Set the minimum valid delay between frames in hundredths of seconds.Range is 0 to 6000. Default value is 2.
- max_gif_delay
- Set the maximum valid delay between frames in hundredth of seconds.Range is 0 to 65535. Default value is 65535 (nearly eleven minutes),the maximum value allowed by the specification.
- default_delay
- Set the default delay between frames in hundredths of seconds.Range is 0 to 6000. Default value is 10.
- ignore_loop
- GIF files can contain information to loop a certain number of times (orinfinitely). If ignore_loop is set to 1, then the loop settingfrom the input will be ignored and looping will not occur. If set to 0,then looping will occur and will cycle the number of times according tothe GIF. Default value is 1.
For example, with the overlay filter, place an infinitely looping GIFover another video:
ffmpeg -i input.mp4 -ignore_loop 0 -i input.gif -filter_complex overlay=shortest=1 out.mkv
Note that in the above example the shortest option for overlay filter isused to end the output video at the length of the shortest input file,which in this case is input.mp4 as the GIF in this example loopsinfinitely.
hls
HLS demuxer
It accepts the following options:
- live_start_index
- segment index to start live streams at (negative values are from the end).
- allowed_extensions
- ',' separated list of file extensions that hls is allowed to access.
- max_reload
- Maximum number of times a insufficient list is attempted to be reloaded.Default value is 1000.
- http_persistent
- Use persistent HTTP connections. Applicable only for HTTP streams.Enabled by default.
- http_multiple
- Use multiple HTTP connections for downloading HTTP segments.Enabled by default for HTTP/1.1 servers.
image2
Image file demuxer.
This demuxer reads from a list of image files specified by a pattern.The syntax and meaning of the pattern is specified by theoption pattern_type.
The pattern may contain a suffix which is used to automaticallydetermine the format of the images contained in the files.
The size, the pixel format, and the format of each image must be thesame for all the files in the sequence.
This demuxer accepts the following options:
- framerate
- Set the frame rate for the video stream. It defaults to 25.
- loop
- If set to 1, loop over the input. Default value is 0.
- pattern_type
- Select the pattern type used to interpret the provided filename.
pattern_type accepts one of the following values.
- none
- Disable pattern matching, therefore the video will only contain the specifiedimage. You should use this option if you do not want to create sequences frommultiple images and your filenames may contain special pattern characters.
- sequence
- Select a sequence pattern type, used to specify a sequence of filesindexed by sequential numbers.
A sequence pattern may contain the string ``%d'' or "%0Nd``, whichspecifies the position of the characters representing a sequentialnumber in each filename matched by the pattern. If the form''%d0Nd" is used, the string representing the number in eachfilename is 0-padded and N is the total number of 0-paddeddigits representing the number. The literal character '%' can bespecified in the pattern with the string ``%%''.
If the sequence pattern contains ``%d'' or "%0Nd", the first filename ofthe file list specified by the pattern must contain a numberinclusively contained between start_number andstart_number+start_number_range-1, and all the followingnumbers must be sequential.
For example the pattern ``img-%03d.bmp'' will match a sequence offilenames of the form img-001.bmp, img-002.bmp, ...,img-010.bmp, etc.; the pattern ``i%%m%%g-%d.jpg'' will match asequence of filenames of the form i%m%g-1.jpg,i%m%g-2.jpg, ..., i%m%g-10.jpg, etc.
Note that the pattern must not necessarily contain ``%d'' or"%0Nd", for example to convert a single image fileimg.jpeg you can employ the command:
ffmpeg -i img.jpeg img.png
- glob
- Select a glob wildcard pattern type.
The pattern is interpreted like a "glob()" pattern. This is onlyselectable if libavformat was compiled with globbing support.
- glob_sequence (deprecated, will be removed)
- Select a mixed glob wildcard/sequence pattern.
If your version of libavformat was compiled with globbing support, andthe provided pattern contains at least one glob meta character among"%*?[]{}" that is preceded by an unescaped ``%'', the pattern isinterpreted like a "glob()" pattern, otherwise it is interpretedlike a sequence pattern.
All glob special characters "%*?[]{}" must be prefixedwith ``%''. To escape a literal ``%'' you shall use ``%%''.
For example the pattern "foo-%*.jpeg" will match all thefilenames prefixed by ``foo-'' and terminating with ``.jpeg'', and"foo-%?%?%?.jpeg" will match all the filenames prefixed with``foo-'', followed by a sequence of three characters, and terminatingwith ``.jpeg''.
This pattern type is deprecated in favor of glob andsequence.
Default value is glob_sequence.
- pixel_format
- Set the pixel format of the images to read. If not specified the pixelformat is guessed from the first image file in the sequence.
- start_number
- Set the index of the file matched by the image file pattern to startto read from. Default value is 0.
- start_number_range
- Set the index interval range to check when looking for the first imagefile in the sequence, starting from start_number. Default valueis 5.
- ts_from_file
- If set to 1, will set frame timestamp to modification time of image file. Notethat monotonity of timestamps is not provided: images go in the same order aswithout this option. Default value is 0.If set to 2, will set frame timestamp to the modification time of the image file innanosecond precision.
- video_size
- Set the video size of the images to read. If not specified the videosize is guessed from the first image file in the sequence.
Examples
- *
- Use ffmpeg for creating a video from the images in the filesequence img-001.jpeg, img-002.jpeg, ..., assuming aninput frame rate of 10 frames per second:
ffmpeg -framerate 10 -i 'img-%03d.jpeg' out.mkv
- *
- As above, but start by reading from a file with index 100 in the sequence:
ffmpeg -framerate 10 -start_number 100 -i 'img-%03d.jpeg' out.mkv
- *
- Read images matching the ``*.png'' glob pattern , that is all the filesterminating with the ``.png'' suffix:
ffmpeg -framerate 10 -pattern_type glob -i "*.png" out.mkv
libgme
The Game Music Emu library is a collection of video game music file emulators.
See <http://code.google.com/p/game-music-emu/> for more information.
Some files have multiple tracks. The demuxer will pick the first track bydefault. The track_index option can be used to select a differenttrack. Track indexes start at 0. The demuxer exports the number of tracks astracks meta data entry.
For very large files, the max_size option may have to be adjusted.
libopenmpt
libopenmpt based module demuxer
See <https://lib.openmpt.org/libopenmpt/> for more information.
Some files have multiple subsongs (tracks) this can be set with the subsongoption.
It accepts the following options:
- subsong
- Set the subsong index. This can be either 'all', 'auto', or the index of thesubsong. Subsong indexes start at 0. The default is 'auto'.
The default value is to let libopenmpt choose.
- layout
- Set the channel layout. Valid values are 1, 2, and 4 channel layouts.The default value is STEREO.
- sample_rate
- Set the sample rate for libopenmpt to output.Range is from 1000 to INT_MAX. The value default is 48000.
mov/mp4/3gp/QuickTime
QuickTime /
MP4 demuxer.
This demuxer accepts the following options:
- enable_drefs
- Enable loading of external tracks, disabled by default.Enabling this can theoretically leak information in some use cases.
- use_absolute_path
- Allows loading of external tracks via absolute paths, disabled by default.Enabling this poses a security risk. It should only be enabled if the sourceis known to be non malicious.
mpegts
MPEG-2 transport stream demuxer.
This demuxer accepts the following options:
- resync_size
- Set size limit for looking up a new synchronization. Default value is65536.
- skip_unknown_pmt
- Skip PMTs for programs not defined in the PAT. Default value is 0.
- fix_teletext_pts
- Override teletext packet PTS and DTS values with the timestamps calculatedfrom the PCR of the first program which the teletext stream is part of and isnot discarded. Default value is 1, set this option to 0 if you want yourteletext packet PTS and DTS values untouched.
- ts_packetsize
- Output option carrying the raw packet size in bytes.Show the detected raw packet size, cannot be set by the user.
- scan_all_pmts
- Scan and combine all PMTs. The value is an integer with value from -1to 1 (-1 means automatic setting, 1 means enabled, 0 meansdisabled). Default value is -1.
- merge_pmt_versions
- Re-use existing streams when a PMT's version is updated and elementarystreams move to different PIDs. Default value is 0.
mpjpeg
MJPEG encapsulated in multi-part
MIME demuxer.
This demuxer allows reading of MJPEG, where each frame is represented as a part ofmultipart/x-mixed-replace stream.
- strict_mime_boundary
- Default implementation applies a relaxed standard to multi-part MIME boundary detection,to prevent regression with numerous existing endpoints not generating a proper MIMEMJPEG stream. Turning this option on by setting it to 1 will result in a stricter checkof the boundary value.
rawvideo
Raw video demuxer.
This demuxer allows one to read raw video data. Since there is no headerspecifying the assumed video parameters, the user must specify themin order to be able to decode the data correctly.
This demuxer accepts the following options:
- framerate
- Set input video frame rate. Default value is 25.
- pixel_format
- Set the input video pixel format. Default value is "yuv420p".
- video_size
- Set the input video size. This value must be specified explicitly.
For example to read a rawvideo file input.raw withffplay, assuming a pixel format of "rgb24", a videosize of "320x240", and a frame rate of 10 images per second, usethe command:
ffplay -f rawvideo -pixel_format rgb24 -video_size 320x240 -framerate 10 input.raw
sbg
SBaGen script demuxer.
This demuxer reads the script language used by SBaGen<http://uazu.net/sbagen/> to generate binaural beats sessions. A SBGscript looks like that:
-SE a: 300-2.5/3 440+4.5/0 b: 300-2.5/0 440+4.5/3 off: - NOW == a +0:07:00 == b +0:14:00 == a +0:21:00 == b +0:30:00 off
A SBG script can mix absolute and relative timestamps. If the script useseither only absolute timestamps (including the script start time) or onlyrelative ones, then its layout is fixed, and the conversion isstraightforward. On the other hand, if the script mixes both kind oftimestamps, then the NOW reference for relative timestamps will betaken from the current time of day at the time the script is read, and thescript layout will be frozen according to that reference. That means that ifthe script is directly played, the actual times will match the absolutetimestamps up to the sound controller's clock accuracy, but if the usersomehow pauses the playback or seeks, all times will be shifted accordingly.
tedcaptions
JSON captions used for <
http://www.ted.com/>.
TED does not provide links to the captions, but they can be guessed from thepage. The file tools/bookmarklets.html from the FFmpeg source treecontains a bookmarklet to expose them.
This demuxer accepts the following option:
- start_time
- Set the start time of the TED talk, in milliseconds. The default is 15000(15s). It is used to sync the captions with the downloadable videos, becausethey include a 15s intro.
Example: convert the captions to a format most players understand:
ffmpeg -i http://www.ted.com/talks/subtitles/id/1/lang/en talk1-en.srt
MUXERS
Muxers are configured elements in FFmpeg which allow writingmultimedia streams to a particular type of file.
When you configure your FFmpeg build, all the supported muxersare enabled by default. You can list all available muxers using theconfigure option "--list-muxers".
You can disable all the muxers with the configure option"--disable-muxers" and selectively enable / disable single muxerswith the options "--enable-muxer=MUXER" /"--disable-muxer=MUXER".
The option "-muxers" of the ff* tools will display the list ofenabled muxers. Use "-formats" to view a combined list ofenabled demuxers and muxers.
A description of some of the currently available muxers follows.
aiff
Audio Interchange File Format muxer.
Options
It accepts the following options:
- write_id3v2
- Enable ID3v2 tags writing when set to 1. Default is 0 (disabled).
- id3v2_version
- Select ID3v2 version to write. Currently only version 3 and 4 (aka.ID3v2.3 and ID3v2.4) are supported. The default is version 4.
asf
Advanced Systems Format muxer.
Note that Windows Media Audio (wma) and Windows Media Video (wmv) use thismuxer too.
Options
It accepts the following options:
- packet_size
- Set the muxer packet size. By tuning this setting you may reduce datafragmentation or muxer overhead depending on your source. Default value is3200, minimum is 100, maximum is 64k.
avi
Audio Video Interleaved muxer.
Options
It accepts the following options:
- reserve_index_space
- Reserve the specified amount of bytes for the OpenDML master index of eachstream within the file header. By default additional master indexes areembedded within the data packets if there is no space left in the first masterindex and are linked together as a chain of indexes. This index structure cancause problems for some use cases, e.g. third-party software strictly relyingon the OpenDML index specification or when file seeking is slow. Reservingenough index space in the file header avoids these problems.
The required index space depends on the output file size and should be about 16bytes per gigabyte. When this option is omitted or set to zero the necessaryindex space is guessed.
- write_channel_mask
- Write the channel layout mask into the audio stream header.
This option is enabled by default. Disabling the channel mask can be useful inspecific scenarios, e.g. when merging multiple audio streams into one forcompatibility with software that only supports a single audio stream in AVI(see the ``amerge'' section in the ffmpeg-filters manual).
chromaprint
Chromaprint fingerprinter
This muxer feeds audio data to the Chromaprint library, which generatesa fingerprint for the provided audio data. It takes a single signednative-endian 16-bit raw audio stream.
Options
- silence_threshold
- Threshold for detecting silence, ranges from 0 to 32767. -1 for default(required for use with the AcoustID service).
- algorithm
- Algorithm index to fingerprint with.
- fp_format
- Format to output the fingerprint as. Accepts the following options:
- raw
- Binary raw fingerprint
- compressed
- Binary compressed fingerprint
- base64
- Base64 compressed fingerprint
crc
CRC (Cyclic Redundancy Check) testing format.
This muxer computes and prints the Adler-32 CRC of all the input audioand video frames. By default audio frames are converted to signed16-bit raw audio and video frames to raw video before computing theCRC.
The output of the muxer consists of a single line of the form:CRC=0xCRC, where CRC is a hexadecimal number 0-padded to8 digits containing the CRC for all the decoded input frames.
See also the framecrc muxer.
Examples
For example to compute the CRC of the input, and store it in the fileout.crc:
ffmpeg -i INPUT -f crc out.crc
You can print the CRC to stdout with the command:
ffmpeg -i INPUT -f crc -
You can select the output format of each frame with ffmpeg byspecifying the audio and video codec and format. For example tocompute the CRC of the input audio converted to PCM unsigned 8-bitand the input video converted to MPEG-2 video, use the command:
ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f crc -
flv
Adobe Flash Video Format muxer.
This muxer accepts the following options:
- flvflags flags
- Possible values:
- aac_seq_header_detect
- Place AAC sequence header based on audio stream data.
- no_sequence_end
- Disable sequence end tag.
- no_metadata
- Disable metadata tag.
- no_duration_filesize
- Disable duration and filesize in metadata when they are equal to zeroat the end of stream. (Be used to non-seekable living stream).
- add_keyframe_index
- Used to facilitate seeking; particularly for HTTP pseudo streaming.
dash
Dynamic Adaptive Streaming over
HTTP (
DASH) muxer that creates segmentsand manifest files according to the MPEG-DASH standard
ISO/IEC 23009-1:2014.For more information see:
- *
- ISO DASH Specification: <http://standards.iso.org/ittf/PubliclyAvailableStandards/c065274_ISO_IEC_23009-1_2014.zip>
- *
- WebM DASH Specification: <https://sites.google.com/a/webmproject.org/wiki/adaptive-streaming/webm-dash-specification>
It creates a MPD manifest file and segment files for each stream.
The segment filename might contain pre-defined identifiers used with SegmentTemplateas defined in section 5.3.9.4.4 of the standard. Available identifiers are ``$RepresentationID$'',``$Number$'', ``$Bandwidth$'' and ``$Time$''.
ffmpeg -re -i <input> -map 0 -map 0 -c:a libfdk_aac -c:v libx264 -b:v:0 800k -b:v:1 300k -s:v:1 320x170 -profile:v:1 baseline -profile:v:0 main -bf 1 -keyint_min 120 -g 120 -sc_threshold 0 -b_strategy 0 -ar:a:1 22050 -use_timeline 1 -use_template 1 -window_size 5 -adaptation_sets "id=0,streams=v id=1,streams=a" -f dash /path/to/out.mpd
- -min_seg_duration microseconds
- This is a deprecated option to set the segment length in microseconds, use seg_duration instead.
- -seg_duration duration
- Set the segment length in seconds (fractional value can be set). The value istreated as average segment duration when use_template is enabled anduse_timeline is disabled and as minimum segment duration for all the otheruse cases.
- -window_size size
- Set the maximum number of segments kept in the manifest.
- -extra_window_size size
- Set the maximum number of segments kept outside of the manifest before removing from disk.
- -remove_at_exit remove
- Enable (1) or disable (0) removal of all segments when finished.
- -use_template template
- Enable (1) or disable (0) use of SegmentTemplate instead of SegmentList.
- -use_timeline timeline
- Enable (1) or disable (0) use of SegmentTimeline in SegmentTemplate.
- -single_file single_file
- Enable (1) or disable (0) storing all segments in one file, accessed using byte ranges.
- -single_file_name file_name
- DASH-templated name to be used for baseURL. Implies single_file set to ``1''.
- -init_seg_name init_name
- DASH-templated name to used for the initialization segment. Default is ``init-stream$RepresentationID$.m4s''
- -media_seg_name segment_name
- DASH-templated name to used for the media segments. Default is ``chunk-stream$RepresentationID$-$Number%05d$.m4s''
- -utc_timing_url utc_url
- URL of the page that will return the UTC timestamp in ISO format. Example: ``https://time.akamai.com/?iso''
- method method
- Use the given HTTP method to create output files. Generally set to PUT or POST.
- -http_user_agent user_agent
- Override User-Agent field in HTTP header. Applicable only for HTTP output.
- -http_persistent http_persistent
- Use persistent HTTP connections. Applicable only for HTTP output.
- -hls_playlist hls_playlist
- Generate HLS playlist files as well. The master playlist is generated with the filename master.m3u8.One media playlist file is generated for each stream with filenames media_0.m3u8, media_1.m3u8, etc.
- -streaming streaming
- Enable (1) or disable (0) chunk streaming mode of output. In chunk streamingmode, each frame will be a moof fragment which forms a chunk.
- -adaptation_sets adaptation_sets
- Assign streams to AdaptationSets. Syntax is ``id=x,streams=a,b,c id=y,streams=d,e'' with x and y being the IDsof the adaptation sets and a,b,c,d and e are the indices of the mapped streams.
To map all video (or audio) streams to an AdaptationSet, ``v'' (or ``a'') can be used as stream identifier instead of IDs.
When no assignment is defined, this defaults to an AdaptationSet for each stream.
- -timeout timeout
- Set timeout for socket I/O operations. Applicable only for HTTP output.
- -index_correction index_correction
- Enable (1) or Disable (0) segment index correction logic. Applicable only whenuse_template is enabled and use_timeline is disabled.
When enabled, the logic monitors the flow of segment indexes. If a streams'ssegment index value is not at the expected real time position, then the logiccorrects that index value.
Typically this logic is needed in live streaming use cases. The network bandwidthfluctuations are common during long run streaming. Each fluctuation can causethe segment indexes fall behind the expected real time position.
- -format_options options_list
- Set container format (mp4/webm) options using a ":" separated list ofkey=value parameters. Values containing ":" special characters must beescaped.
- dash_segment_type dash_segment_type
- Possible values:
- mp4
- If this flag is set, the dash segment files will be in in ISOBMFF format. This is the default format.
- webm
- If this flag is set, the dash segment files will be in in WebM format.
framecrc
Per-packet
CRC (Cyclic Redundancy Check) testing format.
This muxer computes and prints the Adler-32 CRC for each audioand video packet. By default audio frames are converted to signed16-bit raw audio and video frames to raw video before computing theCRC.
The output of the muxer consists of a line for each audio and videopacket of the form:
<stream_index>, <packet_dts>, <packet_pts>, <packet_duration>, <packet_size>, 0x<CRC>
CRC is a hexadecimal number 0-padded to 8 digits containing theCRC of the packet.
Examples
For example to compute the CRC of the audio and video frames inINPUT, converted to raw audio and video packets, and store itin the file out.crc:
ffmpeg -i INPUT -f framecrc out.crc
To print the information to stdout, use the command:
ffmpeg -i INPUT -f framecrc -
With ffmpeg, you can select the output format to which theaudio and video frames are encoded before computing the CRC for eachpacket by specifying the audio and video codec. For example, tocompute the CRC of each decoded input audio frame converted to PCMunsigned 8-bit and of each decoded input video frame converted toMPEG-2 video, use the command:
ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f framecrc -
See also the crc muxer.
framehash
Per-packet hash testing format.
This muxer computes and prints a cryptographic hash for each audioand video packet. This can be used for packet-by-packet equalitychecks without having to individually do a binary comparison on each.
By default audio frames are converted to signed 16-bit raw audio andvideo frames to raw video before computing the hash, but the outputof explicit conversions to other codecs can also be used. It uses theSHA-256 cryptographic hash function by default, but supports severalother algorithms.
The output of the muxer consists of a line for each audio and videopacket of the form:
<stream_index>, <packet_dts>, <packet_pts>, <packet_duration>, <packet_size>, <hash>
hash is a hexadecimal number representing the computed hashfor the packet.
- hash algorithm
- Use the cryptographic hash function specified by the string algorithm.Supported values include "MD5", "murmur3", "RIPEMD128","RIPEMD160", "RIPEMD256", "RIPEMD320", "SHA160","SHA224", "SHA256" (default), "SHA512/224", "SHA512/256","SHA384", "SHA512", "CRC32" and "adler32".
Examples
To compute the SHA-256 hash of the audio and video frames in INPUT,converted to raw audio and video packets, and store it in the fileout.sha256:
ffmpeg -i INPUT -f framehash out.sha256
To print the information to stdout, using the MD5 hash function, usethe command:
ffmpeg -i INPUT -f framehash -hash md5 -
See also the hash muxer.
framemd5
Per-packet
MD5 testing format.
This is a variant of the framehash muxer. Unlike that muxer,it defaults to using the MD5 hash function.
Examples
To compute the MD5 hash of the audio and video frames in INPUT,converted to raw audio and video packets, and store it in the fileout.md5:
ffmpeg -i INPUT -f framemd5 out.md5
To print the information to stdout, use the command:
ffmpeg -i INPUT -f framemd5 -
See also the framehash and md5 muxers.
gif
Animated
GIF muxer.
It accepts the following options:
- loop
- Set the number of times to loop the output. Use "-1" for no loop, 0for looping indefinitely (default).
- final_delay
- Force the delay (expressed in centiseconds) after the last frame. Each frameends with a delay until the next frame. The default is "-1", which is aspecial value to tell the muxer to re-use the previous delay. In case of aloop, you might want to customize this value to mark a pause for instance.
For example, to encode a gif looping 10 times, with a 5 seconds delay betweenthe loops:
ffmpeg -i INPUT -loop 10 -final_delay 500 out.gif
Note 1: if you wish to extract the frames into separate GIF files, you need toforce the image2 muxer:
ffmpeg -i INPUT -c:v gif -f image2 "out%d.gif"
Note 2: the GIF format has a very large time base: the delay between two framescan therefore not be smaller than one centi second.
hash
Hash testing format.
This muxer computes and prints a cryptographic hash of all the inputaudio and video frames. This can be used for equality checks withouthaving to do a complete binary comparison.
By default audio frames are converted to signed 16-bit raw audio andvideo frames to raw video before computing the hash, but the outputof explicit conversions to other codecs can also be used. Timestampsare ignored. It uses the SHA-256 cryptographic hash function by default,but supports several other algorithms.
The output of the muxer consists of a single line of the form:algo=hash, where algo is a short string representingthe hash function used, and hash is a hexadecimal numberrepresenting the computed hash.
- hash algorithm
- Use the cryptographic hash function specified by the string algorithm.Supported values include "MD5", "murmur3", "RIPEMD128","RIPEMD160", "RIPEMD256", "RIPEMD320", "SHA160","SHA224", "SHA256" (default), "SHA512/224", "SHA512/256","SHA384", "SHA512", "CRC32" and "adler32".
Examples
To compute the SHA-256 hash of the input converted to raw audio andvideo, and store it in the file out.sha256:
ffmpeg -i INPUT -f hash out.sha256
To print an MD5 hash to stdout use the command:
ffmpeg -i INPUT -f hash -hash md5 -
See also the framehash muxer.
hls
Apple
HTTP Live Streaming muxer that segments MPEG-TS according tothe
HTTP Live Streaming (
HLS) specification.
It creates a playlist file, and one or more segment files. The output filenamespecifies the playlist filename.
By default, the muxer creates a file for each segment produced. These fileshave the same name as the playlist, followed by a sequential number and a.ts extension.
Make sure to require a closed GOP when encoding and to set the GOPsize to fit your segment time constraint.
For example, to convert an input file with ffmpeg:
ffmpeg -i in.mkv -c:v h264 -flags +cgop -g 30 -hls_time 1 out.m3u8
This example will produce the playlist, out.m3u8, and segment files:out0.ts, out1.ts, out2.ts, etc.
See also the segment muxer, which provides a more generic andflexible implementation of a segmenter, and can be used to perform HLSsegmentation.
Options
This muxer supports the following options:
- hls_init_time seconds
- Set the initial target segment length in seconds. Default value is 0.Segment will be cut on the next key frame after this time has passed on the first m3u8 list.After the initial playlist is filled ffmpeg will cut segmentsat duration equal to "hls_time"
- hls_time seconds
- Set the target segment length in seconds. Default value is 2.Segment will be cut on the next key frame after this time has passed.
- hls_list_size size
- Set the maximum number of playlist entries. If set to 0 the list filewill contain all the segments. Default value is 5.
- hls_delete_threshold size
- Set the number of unreferenced segments to keep on disk before "hls_flags delete_segments"deletes them. Increase this to allow continue clients to download segments whichwere recently referenced in the playlist. Default value is 1, meaning segments older than"hls_list_size+1" will be deleted.
- hls_ts_options options_list
- Set output format options using a :-separated list of key=valueparameters. Values containing ":" special characters must beescaped.
- hls_wrap wrap
- This is a deprecated option, you can use "hls_list_size"and "hls_flags delete_segments" instead it
This option is useful to avoid to fill the disk with many segmentfiles, and limits the maximum number of segment files written to diskto wrap.
- hls_start_number_source
- Start the playlist sequence number ("#EXT-X-MEDIA-SEQUENCE") according to the specified source.Unless "hls_flags single_file" is set, it also specifies source of starting sequence numbers ofsegment and subtitle filenames. In any case, if "hls_flags append_list"is set and read playlist sequence number is greater than the specified start sequence number,then that value will be used as start value.
It accepts the following values:
- generic (default)
- Set the starting sequence numbers according to start_number option value.
- epoch
- The start number will be the seconds since epoch (1970-01-01 00:00:00)
- datetime
- The start number will be based on the current date/time as YYYYmmddHHMMSS. e.g. 20161231235759.
- start_number number
- Start the playlist sequence number ("#EXT-X-MEDIA-SEQUENCE") from the specified numberwhen hls_start_number_source value is generic. (This is the default case.)Unless "hls_flags single_file" is set, it also specifies starting