📛 NAME
ffmpeg-formats - FFmpeg formats
🚀 Quick Reference
| Use Case | Command | Description |
| List available demuxers | ffmpeg -demuxers | Displays list of enabled demuxers |
| List available muxers | ffmpeg -muxers | Displays list of enabled muxers |
| Extract metadata to file | ffmpeg -i INPUT -f ffmetadata FFMETADATAFILE | Dumps metadata into INI-like text file |
| Reinsert edited metadata | ffmpeg -i INPUT -i FFMETADATAFILE -map_metadata 1 -codec copy OUTPUT | Applies modified metadata from file |
| Compute CRC of input | ffmpeg -i INPUT -f crc out.crc | Prints Adler-32 CRC of all frames |
| Compute MD5 hash | ffmpeg -i INPUT -f md5 out.md5 | Prints MD5 hash of all frames |
| HLS segmentation | ffmpeg -i in.mkv -c:v h264 -flags +cgop -g 30 -hls_time 1 out.m3u8 | Creates HLS playlist and segments |
| DASH segmentation | ffmpeg -re -i <input> -map 0 -map 0 -c:a libfdk_aac -c:v libx264 ... -f dash /path/to/out.mpd | Creates MPEG-DASH manifest and segments |
| Segment input by time | ffmpeg -i in.mkv -codec copy -f segment -segment_time 10 out%03d.nut | Splits into fixed-duration segments |
| Stream to multiple outputs | ffmpeg -i ... -f tee "archive.mkv|[f=mpegts]udp://..." | Encodes once, writes to several destinations |
📖 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, which can be set on all the muxers and demuxers. In addition each muxer or demuxer may support so-called private options, which are specific for that component.
Options may be set by specifying -option value in the FFmpeg tools, or by setting the value explicitly in the "AVFormatContext" options or using the libavutil/opt.h API for 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. Default 5000000.
- max_probe_packets integer (input) — Max number of buffered packets when probing. Default 2500.
- packetsize integer (output) — Set packet size.
- fflags flags — Set format flags. Input values: discardcorrupt, fastseek, genpts, igndts, ignidx, keepside (deprecated), nobuffer, nofillin, noparse, sortdts. Output values: autobsf, bitexact, flush_packets, latm (deprecated), shortest.
- seek2any integer (input) — Allow seeking to non-keyframes (default 0).
- analyzeduration integer (input) — Microseconds to analyze input (default 5,000,000).
- cryptokey hexadecimal string (input) — Set decryption key.
- indexmem integer (input) — Max memory for timestamp index per stream.
- rtbufsize integer (input) — Max memory for buffering real-time frames.
- fdebug flags (input/output) — Print debug info. Values: ts.
- max_delay integer (input/output) — Max muxing/demuxing delay in microseconds.
- fpsprobesize integer (input) — Number of frames to probe fps.
- audio_preload integer (output) — Microseconds to interleave audio earlier.
- chunk_duration integer (output) — Microseconds per chunk.
- chunk_size integer (output) — Bytes per chunk.
- err_detect, f_err_detect flags (input) — Error detection flags. Values: crccheck, bitstream, buffer, explode, careful, compliant, aggressive.
- max_interleave_delta integer (output) — Max buffering duration for interleaving (default 10 seconds).
- use_wallclock_as_timestamps integer (input) — Use wallclock as timestamps (default 0).
- avoid_negative_ts integer (output) — Values: make_non_negative, make_zero, auto (default), disabled.
- skip_initial_bytes integer (input) — Bytes to skip before reading (default 0).
- correct_ts_overflow integer (input) — Correct single timestamp overflows (default 1).
- flush_packets integer (output) — Flush I/O after each packet (default -1 auto).
- output_ts_offset offset (output) — Time offset added to output timestamps.
- format_whitelist list (input) — Comma-separated allowed demuxers.
- dump_separator string (input) — Separator for stream parameters on command line.
- max_streams integer (input) — Max number of streams.
- skip_estimate_duration_from_pts bool (input) — Skip duration estimation from PTS.
- strict, f_strict integer (input/output) — Standard strictness. Values: very, strict, normal, unofficial, experimental.
🔍 Format stream specifiers
Format stream specifiers allow selection of one or more streams that match specific properties. Defined by avformat_match_stream_specifier() in libavformat/avformat.h and documented in the Stream specifiers section in the ffmpeg(1) manual.
🎬 DEMUXERS
Demuxers are configured elements in FFmpeg that can read multimedia streams from a particular type of file. All supported demuxers are enabled by default. Use --list-demuxers to list them. Use --disable-demuxers and --enable-demuxer=DEMUXER to configure.
The option -demuxers displays enabled demuxers; -formats shows combined list.
🔊 aa
Audible Format 2, 3, and 4 demuxer. Used to demux .aa files.
🖼️ apng
Animated Portable Network Graphics demuxer. All headers up to first fcTL chunk are extradata. Frames are chunks between fcTL or between last fcTL and IEND.
- -ignore_loop bool — Ignore the loop variable in the file.
- -max_fps int — Maximum framerate in fps (0 for no limit).
- -default_fps int — Default framerate when none specified (0 means as fast as possible).
🎥 asf
Advanced Systems Format demuxer. Used for ASF files and MMS network streams.
- -no_resync_search bool — Do not try to resynchronize by looking for start code.
🔗 concat
Virtual concatenation script demuxer. Reads a list of files and directives from a text file and demuxes them sequentially.
Syntax: Script is extended-ASCII, one directive per line. Empty lines and lines starting with '#' are ignored.
- "file path" — Path to a file; special characters escaped with backslash or single quotes.
- "ffconcat version 1.0" — Identifies script type and version. Must be on first line.
- "duration dur" — Duration of the file.
- "inpoint timestamp" — Seek to timestamp when opening file.
- "outpoint timestamp" — End of file condition at given decoding timestamp.
- "file_packet_metadata key=value" — Metadata for each file packet.
- "stream" — Introduce a stream in the virtual file.
- "exact_stream_id id" — Set stream id for matching.
Options:
- safe — If 1, reject unsafe file paths (default 1).
- auto_convert — If 1, perform automatic conversions (default 1).
- segment_time_metadata — If 1, packet metadata contains start_time and duration (default 0).
Examples:
# 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'
ffconcat version 1.0
file file-1.wav
duration 20.0
file subdir/file-2.wav
📡 dash
Dynamic Adaptive Streaming over HTTP demuxer. Presents all AVStreams from manifest. Each stream has "id" and "variant_bitrate" metadata keys.
📺 flv, live_flv
Adobe Flash Video Format demuxer. Use live_flv for live streams to survive timestamp discontinuities.
ffmpeg -f flv -i myfile.flv ...
ffmpeg -f live_flv -i rtmp://<any.server>/anything/key ....
- -flv_metadata bool — Allocate streams according to onMetaData.
- -flv_ignore_prevtag bool — Ignore size of previous tag.
- -flv_full_metadata bool — Output all context of onMetadata.
🎞️ gif
Animated GIF demuxer.
- min_delay — Minimum valid delay (0 to 6000, default 2).
- max_gif_delay — Maximum valid delay (0 to 65535, default 65535).
- default_delay — Default delay (0 to 6000, default 10).
- ignore_loop — If 1, ignore loop setting (default 1).
Example with overlay:
ffmpeg -i input.mp4 -ignore_loop 0 -i input.gif -filter_complex overlay=shortest=1 out.mkv
📱 hls
Apple HTTP Live Streaming demuxer. Presents all AVStreams from variant streams. The "id" field is bitrate variant index. Metadata key "variant_bitrate" available.
- live_start_index — Segment index to start live streams (negative values from end).
- allowed_extensions — Comma-separated list of allowed file extensions.
- max_reload — Max number of times to reload insufficient list (default 1000).
- m3u8_hold_counters — Max times to load m3u8 without new segments (default 1000).
- http_persistent — Use persistent HTTP connections (default enabled).
- http_multiple — Use multiple HTTP connections for segments (default enabled for HTTP/1.1).
- http_seekable — Use HTTP partial requests. 0=disable, 1=enable, -1=auto (default).
🖼️ image2
Image file demuxer. Reads from a list of image files specified by a pattern. All images must have same size, pixel format, and format.
- framerate — Frame rate (default 25).
- loop — Loop input (default 0).
- pattern_type — Select pattern type: none, sequence, glob, glob_sequence (deprecated). Default is glob_sequence.
- pixel_format — Pixel format of images.
- start_number — Index to start reading from (default 0).
- start_number_range — Interval range to check for first file (default 5).
- ts_from_file — If 1, set timestamp to modification time; if 2, nanosecond precision.
- video_size — Video size of images.
- export_path_metadata — If 1, adds extra fields: lavf.image2dec.source_path and lavf.image2dec.source_basename.
Examples:
ffmpeg -framerate 10 -i 'img-%03d.jpeg' out.mkv
ffmpeg -framerate 10 -start_number 100 -i 'img-%03d.jpeg' out.mkv
ffmpeg -framerate 10 -pattern_type glob -i "*.png" out.mkv
🎮 libgme
Game Music Emu library demuxer. See https://bitbucket.org/mpyne/game-music-emu/overview.
- track_index — Index of track to demux (default first).
- sample_rate — Sampling rate (1000-999999, default 44100).
- max_size (bytes) — Max buffer size (default 50 MiB).
🎵 libmodplug
ModPlug based module demuxer. See https://github.com/Konstanty/libmodplug. Exports 2-channel 16-bit 44.1 kHz audio. Optionally a "pal8" 16-color video stream.
- noise_reduction — Low-pass filter (1 on, 0 off).
- reverb_depth — Reverb amount (0-100).
- reverb_delay — Delay in ms (40-250).
- bass_amount — Bass expansion (0-100).
- bass_range — Cutoff (10-100 Hz).
- surround_depth — Dolby Pro-Logic surround (0-100).
- surround_delay — Surround delay ms (5-40).
- max_size — Buffer size in MiB (0-100, default 5).
- video_stream_expr — Expression for video stream colors using eval API.
- video_stream — Generate video stream (1 on, 0 off).
- video_stream_w — Video width in chars (20-512, default 30).
- video_stream_h — Video height in chars (20-512, default 30).
- video_stream_ptxt — Print metadata on video stream (default 1).
🎶 libopenmpt
libopenmpt based module demuxer. See https://lib.openmpt.org/libopenmpt/.
- subsong — Subsong index: 'all', 'auto', or index. Default 'auto'.
- layout — Channel layout: 1, 2, or 4 channels. Default STEREO.
- sample_rate — Sample rate (1000 to INT_MAX, default 48000).
📦 mov/mp4/3gp
Demuxer for Quicktime File Format & ISO/IEC Base Media File Format. Registered extensions: mov, mp4, m4a, 3gp, 3g2, mj2, psp, m4b, ism, ismv, isma, f4v.
- enable_drefs — Enable loading of external tracks (disabled by default).
- use_absolute_path — Allow loading via absolute paths (disabled by default).
- seek_streams_individually — Seek closest point in each stream (default true).
- ignore_editlist — Ignore edit list atoms (default false).
- advanced_editlist — Modify stream index per edit list (default true).
- ignore_chapters — Don't parse chapters (default false).
- use_mfra_for — Set fragment timestamp from mfra box: auto, dts, pts, 0.
- export_all — Export unrecognized boxes in udta as metadata (default false).
- export_xmp — Export XMP_ and uuid boxes as "xmp" key (default false).
- activation_bytes — 4-byte key for Audible AAX/AAX+.
- audible_fixed_key — Fixed key for Audible AAX/AAX+ (pre-set).
- decryption_key — 16-byte hex key for CENC/AES-128 CTR.
Audible AAX example:
ffmpeg -activation_bytes 1CEB00DA -i test.aax -vn -c:a copy output.mp4
📡 mpegts
MPEG-2 transport stream demuxer.
- resync_size — Size limit for new synchronization (default 65536).
- skip_unknown_pmt — Skip PMTs for programs not in PAT (default 0).
- fix_teletext_pts — Override teletext PTS/DTS with PCR (default 1).
- ts_packetsize — Output option for raw packet size (read-only).
- scan_all_pmts — Scan and combine all PMTs (-1 auto, 1 enable, 0 disable, default -1).
- merge_pmt_versions — Re-use streams when PMT version updates (default 0).
📷 mpjpeg
MJPEG encapsulated in multi-part MIME demuxer.
- strict_mime_boundary — Stricter check of boundary value (default 0).
🎬 rawvideo
Raw video demuxer. User must specify video parameters.
- framerate — Input frame rate (default 25).
- pixel_format — Input pixel format (default "yuv420p").
- video_size — Input video size (must be specified).
Example:
ffplay -f rawvideo -pixel_format rgb24 -video_size 320x240 -framerate 10 input.raw
🧠 sbg
SBaGen script demuxer. Reads SBG script for binaural beats. See http://uazu.net/sbagen/.
📝 tedcaptions
JSON captions for TED talks. See http://www.ted.com/. Bookmarklet in tools/bookmarklets.html.
- start_time — Start time in milliseconds (default 15000).
Example:
ffmpeg -i http://www.ted.com/talks/subtitles/id/1/lang/en talk1-en.srt
🔮 vapoursynth
Vapoursynth wrapper. Input format must be forced with -f vapoursynth.
- max_script_size — Max buffer size for script (default 1 MiB).
🎞️ MUXERS
Muxers allow writing multimedia streams to a particular file type. All supported muxers are enabled by default. Use --list-muxers. Configure with --disable-muxers and --enable-muxer=MUXER.
🔊 aiff
Audio Interchange File Format muxer.
- write_id3v2 — Enable ID3v2 tags (default 0).
- id3v2_version — Version 3 or 4 (default 4).
🎥 asf (also wma, wmv)
Advanced Systems Format muxer.
- packet_size — Muxer packet size (default 3200, min 100, max 64k).
🎬 avi
Audio Video Interleaved muxer.
- reserve_index_space — Reserve bytes for OpenDML master index (default guessed).
- write_channel_mask — Write channel layout mask (default enabled).
- flipped_raw_rgb — Store positive height for bottom-up bitmaps (default false).
🔍 chromaprint
Chromaprint fingerprinter. See https://acoustid.org/chromaprint. Takes single signed 16-bit raw audio stream, max 2 channels.
- silence_threshold — Silence detection threshold (-1 to 32767, default -1).
- algorithm — Algorithm version (0-4, default 1).
- fp_format — Fingerprint format: raw, compressed, base64 (default).
🔢 crc
CRC testing format. Computes Adler-32 CRC of all input frames.
Output: CRC=0xCRC
Examples:
ffmpeg -i INPUT -f crc out.crc
ffmpeg -i INPUT -f crc -
ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f crc -
📺 flv
Adobe Flash Video Format muxer.
- flvflags — Possible values: aac_seq_header_detect, no_sequence_end, no_metadata, no_duration_filesize, add_keyframe_index.
📡 dash
Dynamic Adaptive Streaming over HTTP (DASH) muxer. Creates MPD manifest and segment files according to ISO/IEC 23009-1:2014.
- min_seg_duration (deprecated) — Use seg_duration.
- seg_duration — Segment length in seconds.
- frag_duration — Fragment length in seconds.
- frag_type — Type of fragmentation interval.
- window_size — Max segments kept in manifest.
- extra_window_size — Max segments kept outside manifest.
- remove_at_exit — Remove all segments when finished.
- use_template — Use SegmentTemplate (1) or SegmentList (0).
- use_timeline — Use SegmentTimeline in SegmentTemplate.
- single_file — Store all segments in one file.
- single_file_name — DASH-templated name for baseURL.
- init_seg_name — Name for initialization segment.
- media_seg_name — Name for media segments.
- utc_timing_url — URL returning UTC timestamp in ISO format.
- method — HTTP method (PUT or POST).
- http_user_agent — Override User-Agent.
- http_persistent — Use persistent HTTP connections.
- hls_playlist — Generate HLS playlist files as well.
- hls_master_name — HLS master playlist name (default "master.m3u8").
- streaming — Enable chunk streaming mode.
- adaptation_sets — Assign streams to AdaptationSets.
- timeout — Socket I/O timeout.
- index_correction — Segment index correction logic.
- format_options — Container format options (mp4/webm).
- global_sidx — Write global SIDX atom.
- dash_segment_type — Segment format: auto, mp4, webm.
- ignore_io_errors — Ignore IO errors.
- lhls — Enable Low-latency HLS (experimental).
- ldash — Enable Low-latency Dash.
- master_m3u8_publish_rate — Publish master playlist repeatedly.
- write_prft — Write Producer Reference Time elements.
- mpd_profile — Manifest profiles.
- http_opts — HTTP protocol options.
- target_latency — Target latency in seconds.
- min_playback_rate — Minimum playback rate.
- max_playback_rate — Maximum playback rate.
- update_period — MPD update period for dynamic content (seconds).
Example command:
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
🔢 framecrc
Per-packet CRC testing format. Outputs line per packet: <stream_index>, <packet_dts>, <packet_pts>, <packet_duration>, <packet_size>, 0x<CRC>
Examples:
ffmpeg -i INPUT -f framecrc out.crc
ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f framecrc -
🔢 framehash
Per-packet hash testing format. Outputs line per packet: <stream_index>, <packet_dts>, <packet_pts>, <packet_duration>, <packet_size>, <hash>
- hash algorithm — Hash function (default SHA-256).
Example:
ffmpeg -i INPUT -f framehash out.sha256
🔢 framemd5
Per-packet MD5 testing format. Defaults to MD5.
ffmpeg -i INPUT -f framemd5 out.md5
🎞️ gif
Animated GIF muxer.
- loop — Number of loops (-1 no loop, 0 infinite).
- final_delay — Delay after last frame in centiseconds (default -1 re-use previous).
Example:
ffmpeg -i INPUT -loop 10 -final_delay 500 out.gif
Note: To extract frames as separate GIF files, use image2 muxer:
ffmpeg -i INPUT -c:v gif -f image2 "out%d.gif"
🔢 hash
Hash testing format. Outputs single line: algo=hash
- hash algorithm — Hash function (default SHA-256).
Examples:
ffmpeg -i INPUT -f hash out.sha256
ffmpeg -i INPUT -f hash -hash md5 -
📱 hls
Apple HTTP Live Streaming muxer. Segments MPEG-TS according to HLS specification.
- hls_init_time — Initial target segment length (default 0).
- hls_time — Target segment length (default 2).
- hls_list_size — Max playlist entries (default 5).
- hls_delete_threshold — Unreferenced segments to keep before deletion (default 1).
- hls_ts_options — Output format options for TS.
- hls_wrap (deprecated) — Use hls_list_size and hls_flags delete_segments.
- hls_start_number_source — Source of sequence numbers: generic (default), epoch, epoch_us, datetime.
- start_number — Starting sequence number (default 0).
- hls_allow_cache — Allow client caching (1) or not (0).
- hls_base_url — Base URL prepended to playlist entries.
- hls_segment_filename — Segment filename pattern.
- use_localtime (deprecated) — Use strftime.
- strftime — Expand filename with localtime via strftime.
- use_localtime_mkdir (deprecated) — Use strftime_mkdir.
- strftime_mkdir — Create subdirectories expanded in filename.
- hls_key_info_file — File for segment encryption key info.
- -hls_enc — Enable AES128 encryption.
- -hls_enc_key — 16-octet encryption key.
- -hls_enc_key_url — Key URL prepended to key filename.
- -hls_enc_iv — 16-octet initialization vector.
- hls_segment_type — Segment format: mpegts or fmp4.
- hls_fmp4_init_filename — Init file name for fmp4 segments.
- hls_fmp4_init_resend — Resend init file after each refresh.
- hls_flags — Various flags: single_file, delete_segments, append_list, round_durations, discont_start, omit_endlist, periodic_rekey, independent_segments, iframes_only, split_by_time, program_date_time, second_level_segment_index, second_level_segment_size, second_level_segment_duration, temp_file.
- hls_playlist_type event — Forces hls_list_size to 0.
- hls_playlist_type vod — Forces hls_list_size to 0.
- method — HTTP method for HLS files.
- http_user_agent — Override User-Agent.
- var_stream_map — Map string for grouping streams into variant streams.
- cc_stream_map — Map string for closed captions groups.
- master_pl_name — Name of HLS master playlist.
- master_pl_publish_rate — Publish master playlist repeatedly.
- http_persistent — Use persistent HTTP connections.
- timeout — Socket I/O timeout.
- -ignore_io_errors — Ignore IO errors.
- headers — Custom HTTP headers.
Basic example:
ffmpeg -i in.mkv -c:v h264 -flags +cgop -g 30 -hls_time 1 out.m3u8
🖼️ ico
ICO file muxer. Microsoft icon file format. Limitations: size ≤256 pixels, only BMP or PNG images. BMP must use BITMAPINFOHEADER and specific pixel formats.
🖼️ image2
Image file muxer. Writes video frames to image files using pattern.
- frame_pts — Expand filename with pts (default 0).
- start_number — Start sequence number (default 1).
- update — If 1, overwrite same file (default 0).
- strftime — Expand filename with date/time (default 0).
- protocol_opts — Protocol options key=value list.
Examples:
ffmpeg -i in.avi -vsync cfr -r 1 -f image2 'img-%03d.jpeg'
ffmpeg -i in.avi -vsync cfr -r 1 'img-%03d.jpeg'
ffmpeg -i in.avi -f image2 -frames:v 1 img.jpeg
ffmpeg -f v4l2 -r 1 -i /dev/video0 -f image2 -strftime 1 "%Y-%m-%d_%H-%M-%S.jpg"
ffmpeg -f v4l2 -r 1 -i /dev/video0 -copyts -f image2 -frame_pts true %d.jpg
ffmpeg -f x11grab -framerate 1 -i :0.0 -q:v 6 -update 1 -protocol_opts method=PUT http://example.com/desktop.jpg
📦 matroska
Matroska container muxer (also webm).
Metadata:
- title — Track title.
- language — Track language in ISO 639-2/B form.
- stereo_mode — Stereo 3D layout: mono, left_right, bottom_top, top_bottom, checkerboard_rl, checkerboard_lr, row_interleaved_rl, row_interleaved_lr, col_interleaved_rl, col_interleaved_lr, anaglyph_cyan_red, right_left, anaglyph_green_magenta, block_lr, block_rl.
Options:
- reserve_index_space — Reserve space for cues at beginning (default 0).
- default_mode — Controls FlagDefault: infer, infer_no_subs, passthrough.
- flipped_raw_rgb — Store positive height for bottom-up bitmaps (default false).
Example 3D WebM:
ffmpeg -i sample_left_right_clip.mpg -an -c:v libvpx -metadata stereo_mode=left_right -y stereo_clip.webm
🔢 md5
MD5 testing format. Variant of hash muxer defaulting to MD5.
ffmpeg -i INPUT -f md5 out.md5
ffmpeg -i INPUT -f md5 -
📦 mov, mp4, ismv
MOV/MP4/ISMV (Smooth Streaming) muxer. Supports fragmentation.
- -moov_size bytes — Reserve space for moov at beginning.
- -movflags frag_keyframe — Start new fragment at each video keyframe.
- -frag_duration duration — Fragment length in microseconds.
- -frag_size size — Fragment payload size in bytes.
- -movflags frag_custom — Manually trigger fragments via
av_write_frame(ctx, NULL).
- -min_frag_duration duration — Minimum fragment duration.
- -movflags empty_moov — Write initial moov without samples.
- -movflags separate_moof — Write separate moof for each track.
- -movflags skip_sidx — Skip writing sidx atom.
- -movflags faststart — Move moov to beginning (second pass).
- -movflags rtphint — Add RTP hinting tracks.
- -movflags disable_chpl — Disable Nero chapter markers.
- -movflags omit_tfhd_offset — Avoid absolute base_data_offset.
- -movflags default_base_moof — Use default-base-is-moof flag.
- -write_tmcd — Force timecode track: "on", "off", "auto".
- -movflags negative_cts_offsets — Enable version 1 CTTS box.
- -write_prft — Write producer time reference box: wallclock or pts.
Smooth Streaming example:
ffmpeg -re <<normal input/transcoding options>> -movflags isml+frag_keyframe -f ismv http://server/publishingpoint.isml/Streams(Encoder1)
🎵 mp3
Raw MP3 stream muxer with optional ID3v2 header, Xing/LAME frame, and ID3v1 footer.
- write_id3v1 — Write ID3v1 tag (default 0).
- write_xing — Write Xing/LAME frame (default enabled).
- id3v2_version — ID3v2 version (3 or 4, default 4).
Examples:
ffmpeg -i INPUT -id3v2_version 3 -write_id3v1 1 out.mp3
ffmpeg -i input.mp3 -i cover.png -c copy -map 0 -map 1 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (Front)" out.mp3
ffmpeg -i input.wav -write_xing 0 -id3v2_version 0 out.mp3
📡 mpegts
MPEG transport stream muxer. Implements ISO 13818-1 and ETSI EN 300 468.
- mpegts_transport_stream_id — Transport stream ID (default 0x0001).
- mpegts_original_network_id — Original network ID (default 0x0001).
- mpegts_service_id — Service ID (default 0x0001).
- mpegts_service_type — Service type: hex_value, digital_tv, digital_radio, teletext, advanced_codec_digital_radio, mpeg2_digital_hdtv, advanced_codec_digital_sdtv, advanced_codec_digital_hdtv.
- mpegts_pmt_start_pid — First PID for PMTs (default 0x1000).
- mpegts_start_pid — First PID for elementary streams (default 0x0100).
- mpegts_m2ts_mode — Enable m2ts mode (default -1).
- muxrate — Constant muxrate (default VBR).
- pes_payload_size — Minimum PES payload bytes (default 2930).
- mpegts_flags — Flags: resend_headers, latm, pat_pmt_at_frames, system_b, initial_discontinuity.
- mpegts_copyts — Preserve original timestamps (default -1).
- omit_video_pes_length — Omit PES length for video (default 1).
- pcr_period — PCR retransmission in ms (default -1 auto).
- pat_period — Max time between PAT/PMT (default 0.1).
- sdt_period — Max time between SDT (default 0.5).
- tables_version — PAT, PMT, SDT version (0-31, default 0).
Example:
ffmpeg -i file.mpg -c copy \
-mpegts_original_network_id 0x1122 \
-mpegts_transport_stream_id 0x3344 \
-mpegts_service_id 0x5566 \
-mpegts_pmt_start_pid 0x1500 \
-mpegts_start_pid 0x150 \
-metadata service_provider="Some provider" \
-metadata service_name="Some Channel" \
out.ts
📦 mxf, mxf_d10, mxf_opatom
MXF muxer.
- store_user_comments — Store user comments if available (default true for mxf and mxf_opatom, false for mxf_d10).
❌ null
Null muxer. No output file, useful for testing/benchmarking.
ffmpeg -benchmark -i INPUT -f null out.null
ffmpeg -benchmark -i INPUT -f null -
🥜 nut
- -syncpoints flags — Syncpoint usage: default, none, timestamped.
- -write_index bool — Write index at end (default true).
Example:
ffmpeg -i INPUT -f_strict experimental -syncpoints none - | processor
🎵 ogg
Ogg container muxer.
- -page_duration duration — Preferred page duration in microseconds (default 1 sec).
- -serial_offset value — Serial offset for stream serial numbers.
📄 segment, stream_segment, ssegment
Basic stream segmenter. Outputs separate files of nearly fixed duration.
- increment_tc — Increment timecode between segments.
- reference_stream — Reference stream specifier (default "auto").
- segment_format — Inner container format.
- segment_format_options — Output format options.
- segment_list — Generate list file.
- segment_list_flags — Flags: cache, live.
- segment_list_size — Max segments in list (0 = all).
- segment_list_entry_prefix — Prefix for entries.
- segment_list_type — List format: flat, csv, ext, ffconcat, m3u8.
- segment_time — Segment duration (default 2).
- segment_atclocktime — Split at regular clock time intervals.
- segment_clocktime_offset — Offset for clock time splits.
- segment_clocktime_wrap_duration — Max duration after clock time to start new segment.
- segment_time_delta — Accuracy time for start selection.
- segment_times — Comma-separated list of split points.
- segment_frames — Comma-separated list of frame numbers.
- segment_wrap — Wrap around segment index.
- segment_start_number — First segment number (default 0).
- strftime — Use strftime for filename expansion.
- break_non_keyframes — Allow segments to start on non-keyframes.
- reset_timestamps — Reset timestamps at start of each segment.
- initial_offset — Timestamp offset for output packets.
- write_empty_segments — Write empty segment if no packets.
Examples:
ffmpeg -i in.mkv -codec hevc -flags +cgop -g 60 -map 0 -f segment -segment_list out.list out%03d.nut
ffmpeg -i in.mkv -f segment -segment_time 10 -segment_format_options movflags=+faststart out%03d.mp4
ffmpeg -i in.mkv -codec copy -map 0 -f segment -segment_list out.csv -segment_times 1,2,3,5,8,13,21 out%03d.nut
ffmpeg -i in.mkv -force_key_frames 1,2,3,5,8,13,21 -codec:v mpeg4 -codec:a pcm_s16le -map 0 -f segment -segment_list out.csv -segment_times 1,2,3,5,8,13,21 -segment_time_delta 0.05 out%03d.nut
ffmpeg -i in.mkv -codec copy -map 0 -f segment -segment_list out.csv -segment_frames 100,200,300,500,800 out%03d.nut
ffmpeg -i in.mkv -map 0 -codec:v libx264 -codec:a aac -f ssegment -segment_list out.list out%03d.ts
ffmpeg -re -i in.mkv -codec copy -map 0 -f segment -segment_list playlist.m3u8 -segment_list_flags +live -segment_time 10 out%03d.mkv
📡 smoothstreaming
Smooth Streaming muxer. Generates Manifest and chunks for web server.
- window_size — Fragments kept in manifest (default 0).
- extra_window_size — Fragments outside manifest before deletion (default 5).
- lookahead_count — Lookahead fragments (default 2).
- min_frag_duration — Minimum fragment duration in microseconds (default 5000000).
- remove_at_exit — Remove all fragments when finished (default 0).
🔢 streamhash
Per stream hash testing format. Outputs line per stream: streamindex,streamtype,algo=hash
- hash algorithm — Hash function (default SHA-256).
Example:
ffmpeg -i INPUT -f streamhash out.sha256
ffmpeg -i INPUT -f streamhash -hash md5 -
📦 fifo
Fifo pseudo-muxer. Separates encoding and muxing using a queue in a separate thread.
- fifo_format — Format name.
- queue_size — Queue size in packets (default 60).
- format_opts — Format options for underlying muxer.
- drop_pkts_on_overflow — Drop packets if queue full (default 0).
- attempt_recovery — Attempt recovery on failure (default 0).
- max_recovery_attempts — Max successive recovery attempts (default 0 unlimited).
- recovery_wait_time — Wait time between recovery attempts (default 5 seconds).
- recovery_wait_streamtime — Use stream time for recovery wait (default 0).
- recover_any_error — Attempt recovery on any error (default 0).
- restart_with_keyframe — Wait for keyframe after recovery (default 0).
- timeshift — Buffer and delay output (duration).
Example:
ffmpeg -re -i ... -c:v libx264 -c:a aac -f fifo -fifo_format flv -map 0:v -map 0:a \
-drop_pkts_on_overflow 1 -attempt_recovery 1 -recovery_wait_time 1 rtmp://example.com/live/stream_name
📦 tee
Tee muxer. Writes same data to several outputs. Encodes only once.
- use_fifo — Process slave outputs in separate threads using fifo muxer.
- fifo_options — Options passed to fifo muxer instances.
- f — Format name for slave.
- bsfs[/spec] — Bitstream filters to apply.
- select — Stream specifier for slave output.
- onfail — Behaviour on failure: "abort" or "ignore".
Examples:
ffmpeg -i ... -c:v libx264 -c:a mp2 -f tee -map 0:v -map 0:a
"archive-20121107.mkv|[f=mpegts]udp://10.0.1.255:1234/"
ffmpeg -i ... -c:v libx264 -c:a mp2 -f tee -map 0:v -map 0:a
"[>
ffmpeg -i ... -map 0 -flags +global_header -c:v libx264 -c:a aac
-f tee "[bsfs/v=dump_extra=freq=keyframe]out.ts|[movflags=+faststart]out.mp4|[select=a]out.aac"
📡 webm_dash_manifest
WebM DASH Manifest muxer. Generates DASH manifest XML for WebM streams.
- adaptation_sets — Adaptation set assignment.
- live — Create live stream manifest (default 0).
- chunk_start_index — Start index of first chunk (default 0).
- chunk_duration_ms — Duration of each chunk in ms (default 1000).
- utc_timing_url — URL returning UTC timestamp.
- time_shift_buffer_depth — Smallest time shifting buffer (seconds, default 60).
- minimum_update_period — Minimum update period (seconds, default 0).
Example:
ffmpeg -f webm_dash_manifest -i video1.webm \
-f webm_dash_manifest -i video2.webm \
-f webm_dash_manifest -i audio1.webm \
-f webm_dash_manifest -i audio2.webm \
-map 0 -map 1 -map 2 -map 3 \
-c copy \
-f webm_dash_manifest \
-adaptation_sets "id=0,streams=0,1 id=1,streams=2,3" \
manifest.xml
📡 webm_chunk
WebM Live Chunk Muxer. Writes separate WebM headers and chunks for DASH.
- chunk_start_index — Index of first chunk (default 0).
- header — Filename for initialization data.
- audio_chunk_duration — Duration of each audio chunk in ms (default 5000).
Example:
ffmpeg -f v4l2 -i /dev/video0 \
-f alsa -i hw:0 \
-map 0:0 \
-c:v libvpx-vp9 \
-s 640x360 -keyint_min 30 -g 30 \
-f webm_chunk \
-header webm_live_video_360.hdr \
-chunk_start_index 1 \
webm_live_video_360_%d.chk \
-map 1:0 \
-c:a libvorbis \
-b:a 128k \
-f webm_chunk \
-header webm_live_audio_128.hdr \
-chunk_start_index 1 \
-audio_chunk_duration 1000 \
webm_live_audio_128_%d.chk
🏷️ METADATA
FFmpeg can dump metadata from media files into a simple UTF-8-encoded INI-like text file using the metadata muxer/demuxer.
File format:
- Header: ;FFMETADATA followed by version number (now 1).
- Metadata tags: key=value
- After header: global metadata
- Sections with per-stream/per-chapter metadata.
- Section starts with uppercase name in brackets ([, ]).
- Chapter section may have TIMEBASE=num/den and START=num, END=num.
- Empty lines and lines starting with ; or # are ignored.
- Special characters must be escaped with backslash.
- Whitespace is part of the tag.
Example:
;FFMETADATA1
title=bike\\shed
;this is a comment
artist=FFmpeg troll team
[CHAPTER]
TIMEBASE=1/1000
START=0
#chapter ends at 0:01:00
END=60000
title=chapter \#1
[STREAM]
title=multi\
line
Extract metadata:
ffmpeg -i INPUT -f ffmetadata FFMETADATAFILE
Reinsert edited metadata:
ffmpeg -i INPUT -i FFMETADATAFILE -map_metadata 1 -codec copy OUTPUT
📚 SEE ALSO
ffmpeg(1), ffplay(1), ffprobe(1), libavformat(3)
👥 AUTHORS
The FFmpeg developers. For details, see the Git history at git://source.ffmpeg.org/ffmpeg or http://source.ffmpeg.org. Maintainers are listed in the MAINTAINERS file.