Table of Contents
- 1 Synopsis
- 2 Description
- 3 Options
- 4 Writers
- 5 Timecode
- 6 Syntax
- 7 Expression Evaluation
- 8 Codec Options
- 9 Decoders
- 10 Video Decoders
- 11 Audio Decoders
- 12 Subtitles Decoders
- 13 Bitstream Filters
- 13.1 aac_adtstoasc
- 13.2 av1_metadata
- 13.3 chomp
- 13.4 dca_core
- 13.5 dovi_rpu
- 13.6 dump_extra
- 13.7 dv_error_marker
- 13.8 eac3_core
- 13.9 eia608_to_smpte436m
- 13.10 extract_extradata
- 13.11 filter_units
- 13.12 hapqa_extract
- 13.13 h264_metadata
- 13.14 h264_mp4toannexb
- 13.15 h264_redundant_pps
- 13.16 hevc_metadata
- 13.17 hevc_mp4toannexb
- 13.18 imxdump
- 13.19 mjpeg2jpeg
- 13.20 mjpegadump
- 13.21 mov2textsub
- 13.22 mpeg2_metadata
- 13.23 mpeg4_unpack_bframes
- 13.24 noise
- 13.25 null
- 13.26 pcm_rechunk
- 13.27 pgs_frame_merge
- 13.28 prores_metadata
- 13.29 remove_extra
- 13.30 setts
- 13.31 showinfo
- 13.32 smpte436m_to_eia608
- 13.33 text2movsub
- 13.34 trace_headers
- 13.35 truehd_core
- 13.36 vp9_metadata
- 13.37 vp9_superframe
- 13.38 vp9_superframe_split
- 13.39 vp9_raw_reorder
- 14 Format Options
- 15 Demuxers
- 15.1 aa
- 15.2 aac
- 15.3 apng
- 15.4 asf
- 15.5 concat
- 15.6 dash
- 15.7 dvdvideo
- 15.8 ea
- 15.9 imf
- 15.10 flv, live_flv, kux
- 15.11 gif
- 15.12 hls
- 15.13 image2
- 15.14 libgme
- 15.15 libmodplug
- 15.16 libopenmpt
- 15.17 mcc
- 15.18 mov/mp4/3gp
- 15.19 mpegts
- 15.20 mpjpeg
- 15.21 rawvideo
- 15.22 rcwt
- 15.23 sbg
- 15.24 tedcaptions
- 15.25 vapoursynth
- 15.26 w64
- 15.27 wav
- 16 Metadata
- 17 Protocol Options
- 18 Protocols
- 18.1 amqp
- 18.2 async
- 18.3 bluray
- 18.4 cache
- 18.5 concat
- 18.6 concatf
- 18.7 crypto
- 18.8 data
- 18.9 fd
- 18.10 file
- 18.11 ftp
- 18.12 gopher
- 18.13 gophers
- 18.14 http
- 18.15 Icecast
- 18.16 ipfs
- 18.17 mmst
- 18.18 mmsh
- 18.19 md5
- 18.20 pipe
- 18.21 prompeg
- 18.22 rist
- 18.23 rtmp
- 18.24 rtmpe
- 18.25 rtmps
- 18.26 rtmpt
- 18.27 rtmpte
- 18.28 rtmpts
- 18.29 libsmbclient
- 18.30 libssh
- 18.31 librtmp rtmp, rtmpe, rtmps, rtmpt, rtmpte
- 18.32 rtp
- 18.33 rtsp
- 18.34 sap
- 18.35 sctp
- 18.36 srt
- 18.37 srtp
- 18.38 subfile
- 18.39 tee
- 18.40 tcp
- 18.41 tls
- 18.42 dtls
- 18.43 udp
- 18.44 unix
- 18.45 zmq
- 19 Device Options
- 20 Input Devices
- 21 Resampler Options
- 22 Scaler Options
- 23 Filtering Introduction
- 24 graph2dot
- 25 Filtergraph description
- 26 Timeline editing
- 27 Changing options at runtime with a command
- 28 Options for filters with several inputs (framesync)
- 29 Audio Filters
- 29.1 aap
- 29.2 acompressor
- 29.3 acontrast
- 29.4 acopy
- 29.5 acrossfade
- 29.6 acrossover
- 29.7 acrusher
- 29.8 acue
- 29.9 adeclick
- 29.10 adeclip
- 29.11 adecorrelate
- 29.12 adelay
- 29.13 adenorm
- 29.14 aderivative, aintegral
- 29.15 adrc
- 29.16 adynamicequalizer
- 29.17 adynamicsmooth
- 29.18 aecho
- 29.19 aemphasis
- 29.20 aeval
- 29.21 aexciter
- 29.22 afade
- 29.23 afftdn
- 29.24 afftfilt
- 29.25 afir
- 29.26 aformat
- 29.27 afreqshift
- 29.28 afwtdn
- 29.29 agate
- 29.30 aiir
- 29.31 alimiter
- 29.32 allpass
- 29.33 aloop
- 29.34 amerge
- 29.35 amix
- 29.36 amultiply
- 29.37 anequalizer
- 29.38 anlmdn
- 29.39 anlmf, anlms
- 29.40 anull
- 29.41 apad
- 29.42 aphaser
- 29.43 aphaseshift
- 29.44 apsnr
- 29.45 apsyclip
- 29.46 apulsator
- 29.47 aresample
- 29.48 areverse
- 29.49 arls
- 29.50 arnndn
- 29.51 asdr
- 29.52 asetnsamples
- 29.53 asetrate
- 29.54 ashowinfo
- 29.55 asisdr
- 29.56 asoftclip
- 29.57 aspectralstats
- 29.58 asr
- 29.59 astats
- 29.60 asubboost
- 29.61 asubcut
- 29.62 asupercut
- 29.63 asuperpass
- 29.64 asuperstop
- 29.65 atempo
- 29.66 atilt
- 29.67 atrim
- 29.68 axcorrelate
- 29.69 bandpass
- 29.70 bandreject
- 29.71 bass, lowshelf
- 29.72 biquad
- 29.73 bs2b
- 29.74 channelmap
- 29.75 channelsplit
- 29.76 chorus
- 29.77 compand
- 29.78 compensationdelay
- 29.79 crossfeed
- 29.80 crystalizer
- 29.81 dcshift
- 29.82 deesser
- 29.83 dialoguenhance
- 29.84 drmeter
- 29.85 dynaudnorm
- 29.86 earwax
- 29.87 equalizer
- 29.88 extrastereo
- 29.89 firequalizer
- 29.90 flanger
- 29.91 haas
- 29.92 hdcd
- 29.93 headphone
- 29.94 highpass
- 29.95 join
- 29.96 ladspa
- 29.97 loudnorm
- 29.98 lowpass
- 29.99 lv2
- 29.100 mcompand
- 29.101 pan
- 29.102 replaygain
- 29.103 resample
- 29.104 rubberband
- 29.105 sidechaincompress
- 29.106 sidechaingate
- 29.107 silencedetect
- 29.108 silenceremove
- 29.109 sofalizer
- 29.110 speechnorm
- 29.111 stereotools
- 29.112 stereowiden
- 29.113 superequalizer
- 29.114 surround
- 29.115 tiltshelf
- 29.116 treble, highshelf
- 29.117 tremolo
- 29.118 vibrato
- 29.119 virtualbass
- 29.120 volume
- 29.121 volumedetect
- 29.122 whisper
- 30 Audio Sources
- 31 Audio Sinks
- 32 Video Filters
- 32.1 addroi
- 32.2 alphaextract
- 32.3 alphamerge
- 32.4 amplify
- 32.5 ass
- 32.6 atadenoise
- 32.7 avgblur
- 32.8 backgroundkey
- 32.9 bbox
- 32.10 bilateral
- 32.11 bitplanenoise
- 32.12 blackdetect, blackdetect_vulkan
- 32.13 blackframe
- 32.14 blend
- 32.15 blockdetect
- 32.16 blurdetect
- 32.17 bm3d
- 32.18 boxblur
- 32.19 bwdif
- 32.20 ccrepack
- 32.21 cas
- 32.22 chromahold
- 32.23 chromakey
- 32.24 chromanr
- 32.25 chromashift
- 32.26 ciescope
- 32.27 codecview
- 32.28 colorbalance
- 32.29 colorcontrast
- 32.30 colorcorrect
- 32.31 colorchannelmixer
- 32.32 colordetect
- 32.33 colorize
- 32.34 colorkey
- 32.35 colorhold
- 32.36 colorlevels
- 32.37 colormap
- 32.38 colormatrix
- 32.39 colorspace
- 32.40 colortemperature
- 32.41 convolution
- 32.42 convolve
- 32.43 copy
- 32.44 coreimage
- 32.45 corr
- 32.46 cover_rect
- 32.47 crop
- 32.48 cropdetect
- 32.49 cue
- 32.50 curves
- 32.51 datascope
- 32.52 dblur
- 32.53 dctdnoiz
- 32.54 deband
- 32.55 deblock
- 32.56 decimate
- 32.57 deconvolve
- 32.58 dedot
- 32.59 deflate
- 32.60 deflicker
- 32.61 deinterlace_d3d12
- 32.62 dejudder
- 32.63 delogo
- 32.64 derain
- 32.65 deshake
- 32.66 despill
- 32.67 detelecine
- 32.68 dilation
- 32.69 displace
- 32.70 dnn_classify
- 32.71 dnn_detect
- 32.72 dnn_processing
- 32.73 drawbox
- 32.74 drawgraph
- 32.75 drawgrid
- 32.76 drawtext
- 32.77 drawvg
- 32.78 edgedetect
- 32.79 elbg
- 32.80 entropy
- 32.81 epx
- 32.82 eq
- 32.83 erosion
- 32.84 estdif
- 32.85 exposure
- 32.86 extractplanes
- 32.87 fade
- 32.88 feedback
- 32.89 fftdnoiz
- 32.90 fftfilt
- 32.91 field
- 32.92 fieldhint
- 32.93 fieldmatch
- 32.94 fieldorder
- 32.95 fillborders
- 32.96 find_rect
- 32.97 floodfill
- 32.98 format
- 32.99 fps
- 32.100 framepack
- 32.101 framerate
- 32.102 framestep
- 32.103 freezedetect
- 32.104 freezeframes
- 32.105 frei0r
- 32.106 fspp
- 32.107 fsync
- 32.108 gblur
- 32.109 geq
- 32.110 gradfun
- 32.111 graphmonitor
- 32.112 grayworld
- 32.113 greyedge
- 32.114 guided
- 32.115 haldclut
- 32.116 hflip
- 32.117 histeq
- 32.118 histogram
- 32.119 hqdn3d
- 32.120 hwdownload
- 32.121 hwmap
- 32.122 hwupload
- 32.123 hwupload_cuda
- 32.124 hqx
- 32.125 hstack
- 32.126 hsvhold
- 32.127 hsvkey
- 32.128 hue
- 32.129 huesaturation
- 32.130 hysteresis
- 32.131 iccdetect
- 32.132 iccgen
- 32.133 identity
- 32.134 idet
- 32.135 il
- 32.136 inflate
- 32.137 interlace, interlace_vulkan
- 32.138 kerndeint
- 32.139 kirsch
- 32.140 lagfun
- 32.141 lenscorrection
- 32.142 lensfun
- 32.143 lcevc
- 32.144 libplacebo
- 32.145 libvmaf
- 32.146 libvmaf_cuda
- 32.147 limitdiff
- 32.148 limiter
- 32.149 loop
- 32.150 lut1d
- 32.151 lut3d
- 32.152 lumakey
- 32.153 lut, lutrgb, lutyuv
- 32.154 lut2, tlut2
- 32.155 maskedclamp
- 32.156 maskedmax
- 32.157 maskedmerge
- 32.158 maskedmin
- 32.159 maskedthreshold
- 32.160 maskfun
- 32.161 mcdeint
- 32.162 median
- 32.163 mergeplanes
- 32.164 mestimate
- 32.165 mestimate_d3d12
- 32.166 midequalizer
- 32.167 minterpolate
- 32.168 mix
- 32.169 monochrome
- 32.170 morpho
- 32.171 mpdecimate
- 32.172 msad
- 32.173 multiply
- 32.174 negate
- 32.175 nlmeans
- 32.176 nnedi
- 32.177 noformat
- 32.178 noise
- 32.179 normalize
- 32.180 null
- 32.181 ocio
- 32.182 ocr
- 32.183 ocv
- 32.184 oscilloscope
- 32.185 overlay
- 32.186 owdenoise
- 32.187 pad
- 32.188 palettegen
- 32.189 paletteuse
- 32.190 perspective
- 32.191 phase
- 32.192 photosensitivity
- 32.193 pixdesctest
- 32.194 pixelize
- 32.195 pixscope
- 32.196 pp7
- 32.197 premultiply
- 32.198 premultiply_dynamic
- 32.199 prewitt
- 32.200 pseudocolor
- 32.201 psnr
- 32.202 pullup
- 32.203 qp
- 32.204 qrencode
- 32.205 quirc
- 32.206 random
- 32.207 readeia608
- 32.208 readvitc
- 32.209 remap
- 32.210 removegrain
- 32.211 removelogo
- 32.212 repeatfields
- 32.213 reverse
- 32.214 rgbashift
- 32.215 roberts
- 32.216 rotate
- 32.217 sab
- 32.218 scale
- 32.219 scharr
- 32.220 scroll
- 32.221 scdet
- 32.222 selectivecolor
- 32.223 separatefields
- 32.224 setdar, setsar
- 32.225 setfield
- 32.226 setparams
- 32.227 shear
- 32.228 showinfo
- 32.229 showpalette
- 32.230 shuffleframes
- 32.231 shufflepixels
- 32.232 shuffleplanes
- 32.233 signalstats
- 32.234 signature
- 32.235 siti
- 32.236 smartblur
- 32.237 sobel
- 32.238 spp
- 32.239 sr
- 32.240 sr_amf
- 32.241 ssim
- 32.242 stereo3d
- 32.243 streamselect, astreamselect
- 32.244 subtitles
- 32.245 super2xsai
- 32.246 swaprect
- 32.247 swapuv
- 32.248 tblend
- 32.249 telecine
- 32.250 thistogram
- 32.251 threshold
- 32.252 thumbnail
- 32.253 tile
- 32.254 tiltandshift
- 32.255 tinterlace
- 32.256 tmedian
- 32.257 tmidequalizer
- 32.258 tmix
- 32.259 tonemap
- 32.260 tpad
- 32.261 transpose
- 32.262 trim
- 32.263 unpremultiply
- 32.264 unsharp
- 32.265 untile
- 32.266 uspp
- 32.267 v360
- 32.268 vaguedenoiser
- 32.269 varblur
- 32.270 vectorscope
- 32.271 vidstabdetect
- 32.272 vidstabtransform
- 32.273 vflip
- 32.274 vfrdet
- 32.275 vibrance
- 32.276 vif
- 32.277 vignette
- 32.278 vmafmotion
- 32.279 vpp_amf
- 32.280 vstack
- 32.281 w3fdif
- 32.282 waveform
- 32.283 weave, doubleweave
- 32.284 xbr
- 32.285 xcorrelate
- 32.286 xfade
- 32.287 xmedian
- 32.288 xpsnr
- 32.289 xstack
- 32.290 yadif
- 32.291 yaepblur
- 32.292 zoompan
- 32.293 zscale
- 33 CUDA Video Filters
- 34 OpenCL Video Filters
- 34.1 avgblur_opencl
- 34.2 boxblur_opencl
- 34.3 colorkey_opencl
- 34.4 convolution_opencl
- 34.5 erosion_opencl
- 34.6 deshake_opencl
- 34.7 dilation_opencl
- 34.8 nlmeans_opencl
- 34.9 overlay_opencl
- 34.10 pad_opencl
- 34.11 prewitt_opencl
- 34.12 program_opencl
- 34.13 remap_opencl
- 34.14 roberts_opencl
- 34.15 sobel_opencl
- 34.16 tonemap_opencl
- 34.17 unsharp_opencl
- 34.18 xfade_opencl
- 35 VAAPI Video Filters
- 36 VideoToolbox Video Filters
- 37 Vulkan Video Filters
- 38 QSV Video Filters
- 39 Video Sources
- 39.1 buffer
- 39.2 cellauto
- 39.3 coreimagesrc
- 39.4 ddagrab
- 39.5 gfxcapture
- 39.6 gradients
- 39.7 mandelbrot
- 39.8 mptestsrc
- 39.9 frei0r_src
- 39.10 life
- 39.11 perlin
- 39.12 qrencodesrc
- 39.13 allrgb, allyuv, color, colorchart, colorspectrum, haldclutsrc, nullsrc, pal75bars, pal100bars, rgbtestsrc, smptebars, smptehdbars, testsrc, testsrc2, yuvtestsrc
- 39.14 openclsrc
- 39.15 sierpinski
- 39.16 zoneplate
- 40 Video Sinks
- 41 Multimedia Filters
- 41.1 a3dscope
- 41.2 abitscope
- 41.3 adrawgraph
- 41.4 agraphmonitor
- 41.5 ahistogram
- 41.6 aphasemeter
- 41.7 avectorscope
- 41.8 bench, abench
- 41.9 concat
- 41.10 ebur128
- 41.11 interleave, ainterleave
- 41.12 latency, alatency
- 41.13 metadata, ametadata
- 41.14 perms, aperms
- 41.15 realtime, arealtime
- 41.16 segment, asegment
- 41.17 select, aselect
- 41.18 sendcmd, asendcmd
- 41.19 setpts, asetpts
- 41.20 setrange
- 41.21 settb, asettb
- 41.22 showcqt
- 41.23 showcwt
- 41.24 showfreqs
- 41.25 showspatial
- 41.26 showspectrum
- 41.27 showspectrumpic
- 41.28 showvolume
- 41.29 showwaves
- 41.30 showwavespic
- 41.31 sidedata, asidedata
- 41.32 spectrumsynth
- 41.33 split, asplit
- 41.34 zmq, azmq
- 42 Multimedia Sources
- 43 External libraries
- 43.1 Alliance for Open Media (AOM)
- 43.2 AMD AMF/VCE
- 43.3 AviSynth
- 43.4 Chromaprint
- 43.5 codec2
- 43.6 dav1d
- 43.7 davs2
- 43.8 uavs3d
- 43.9 Game Music Emu
- 43.10 Intel QuickSync Video
- 43.11 Kvazaar
- 43.12 LAME
- 43.13 LCEVCdec
- 43.14 libilbc
- 43.15 libjxl
- 43.16 libvpx
- 43.17 ModPlug
- 43.18 OpenCORE, VisualOn, and Fraunhofer libraries
- 43.19 OpenH264
- 43.20 OpenJPEG
- 43.21 rav1e
- 43.22 SVT-AV1
- 43.23 SVT-JPEG-XS
- 43.24 TwoLAME
- 43.25 VapourSynth
- 43.26 x264
- 43.27 x265
- 43.28 xavs
- 43.29 xavs2
- 43.30 eXtra-fast Essential Video Encoder (XEVE)
- 43.31 eXtra-fast Essential Video Decoder (XEVD)
- 43.32 ZVBI
- 44 Supported File Formats, Codecs or Features
- 45 See Also
- 46 Authors
1 Synopsis
ffprobe [options] input_url
2 Description
ffprobe gathers information from multimedia streams and prints it in human- and machine-readable fashion.
For example it can be used to check the format of the container used by a multimedia stream and the format and type of each media stream contained in it.
If a url is specified in input, ffprobe will try to open and probe the url content. If the url cannot be opened or recognized as a multimedia file, a positive exit code is returned.
If no output is specified as output with o ffprobe will write to stdout.
ffprobe may be employed both as a standalone application or in combination with a textual filter, which may perform more sophisticated processing, e.g. statistical processing or plotting.
Options are used to list some of the formats supported by ffprobe or for specifying which information to display, and for setting how ffprobe will show it.
ffprobe output is designed to be easily parsable by a textual filter, and consists of one or more sections of a form defined by the selected writer, which is specified by the output_format option.
Sections may contain other nested sections, and are identified by a name (which may be shared by other sections), and an unique name. See the output of sections.
Metadata tags stored in the container or in the streams are recognized and printed in the corresponding "FORMAT", "STREAM", "STREAM_GROUP_STREAM" or "PROGRAM_STREAM" section.
3 Options
All the numerical options, if not specified otherwise, accept a string representing a number as input, which may be followed by one of the SI unit prefixes, for example: ’K’, ’M’, or ’G’.
If ’i’ is appended to the SI unit prefix, the complete prefix will be interpreted as a unit prefix for binary multiples, which are based on powers of 1024 instead of powers of 1000. Appending ’B’ to the SI unit prefix multiplies the value by 8. This allows using, for example: ’KB’, ’MiB’, ’G’ and ’B’ as number suffixes.
Options which do not take arguments are boolean options, and set the corresponding value to true. They can be set to false by prefixing the option name with "no". For example using "-nofoo" will set the boolean option with name "foo" to false.
Options that take arguments support a special syntax where the argument given on the command line is interpreted as a path to the file from which the actual argument value is loaded. To use this feature, add a forward slash ’/’ immediately before the option name (after the leading dash). E.g.
ffmpeg -i INPUT -/filter:v filter.script OUTPUT
will load a filtergraph description from the file named filter.script.
3.1 Stream specifiers
Some options are applied per-stream, e.g. bitrate or codec. Stream specifiers are used to precisely specify which stream(s) a given option belongs to.
A stream specifier is a string generally appended to the option name and
separated from it by a colon. E.g. -codec:a:1 ac3 contains the
a:1 stream specifier, which matches the second audio stream. Therefore, it
would select the ac3 codec for the second audio stream.
A stream specifier can match several streams, so that the option is applied to all
of them. E.g. the stream specifier in -b:a 128k matches all audio
streams.
An empty stream specifier matches all streams. For example, -codec copy
or -codec: copy would copy all the streams without reencoding.
Possible forms of stream specifiers are:
- stream_index
Matches the stream with this index. E.g.
-threads:1 4would set the thread count for the second stream to 4. If stream_index is used as an additional stream specifier (see below), then it selects stream number stream_index from the matching streams. Stream numbering is based on the order of the streams as detected by libavformat except when a stream group specifier or program ID is also specified. In this case it is based on the ordering of the streams in the group or program.- stream_type[:additional_stream_specifier]
stream_type is one of following: ’v’ or ’V’ for video, ’a’ for audio, ’s’ for subtitle, ’d’ for data, and ’t’ for attachments. ’v’ matches all video streams, ’V’ only matches video streams which are not attached pictures, video thumbnails or cover arts. If additional_stream_specifier is used, then it matches streams which both have this type and match the additional_stream_specifier. Otherwise, it matches all streams of the specified type.
- g:group_specifier[:additional_stream_specifier]
Matches streams which are in the group with the specifier group_specifier. if additional_stream_specifier is used, then it matches streams which both are part of the group and match the additional_stream_specifier. group_specifier may be one of the following:
- group_index
Match the stream with this group index.
- #group_id or i:group_id
Match the stream with this group id.
- p:program_id[:additional_stream_specifier]
Matches streams which are in the program with the id program_id. If additional_stream_specifier is used, then it matches streams which both are part of the program and match the additional_stream_specifier.
- #stream_id or i:stream_id
Match the stream by stream id (e.g. PID in MPEG-TS container).
- m:key[:value]
Matches streams with the metadata tag key having the specified value. If value is not given, matches streams that contain the given tag with any value. The colon character ’:’ in key or value needs to be backslash-escaped.
- disp:dispositions[:additional_stream_specifier]
Matches streams with the given disposition(s). dispositions is a list of one or more dispositions (as printed by the -dispositions option) joined with ’+’.
- u
Matches streams with usable configuration, the codec must be defined and the essential information such as video dimension or audio sample rate must be present.
Note that in
ffmpeg, matching by metadata will only work properly for input files.
3.2 Generic options
These options are shared amongst the ff* tools.
- -L, -license
Show license.
- -h, -?, -help, --help [arg]
Show help. An optional parameter may be specified to print help about a specific item. If no argument is specified, only basic (non advanced) tool options are shown.
Possible values of arg are:
- long
Print advanced tool options in addition to the basic tool options.
- full
Print complete list of options, including shared and private options for encoders, decoders, demuxers, muxers, filters, etc.
- decoder=decoder_name
Print detailed information about the decoder named decoder_name. Use the -decoders option to get a list of all decoders.
- encoder=encoder_name
Print detailed information about the encoder named encoder_name. Use the -encoders option to get a list of all encoders.
- demuxer=demuxer_name
Print detailed information about the demuxer named demuxer_name. Use the -formats option to get a list of all demuxers and muxers.
- muxer=muxer_name
Print detailed information about the muxer named muxer_name. Use the -formats option to get a list of all muxers and demuxers.
- filter=filter_name
Print detailed information about the filter named filter_name. Use the -filters option to get a list of all filters.
- bsf=bitstream_filter_name
Print detailed information about the bitstream filter named bitstream_filter_name. Use the -bsfs option to get a list of all bitstream filters.
- protocol=protocol_name
Print detailed information about the protocol named protocol_name. Use the -protocols option to get a list of all protocols.
- -version
Show version.
- -buildconf
Show the build configuration, one option per line.
- -formats
Show available formats (including devices).
- -demuxers
Show available demuxers.
- -muxers
Show available muxers.
- -devices
Show available devices.
- -codecs
Show all codecs known to libavcodec.
Note that the term ’codec’ is used throughout this documentation as a shortcut for what is more correctly called a media bitstream format.
- -decoders
Show available decoders.
- -encoders
Show all available encoders.
- -bsfs
Show available bitstream filters.
- -protocols
Show available protocols.
- -filters
Show available libavfilter filters.
- -pix_fmts
Show available pixel formats.
- -sample_fmts
Show available sample formats.
- -layouts
Show channel names and standard channel layouts.
- -dispositions
Show stream dispositions.
- -colors
Show recognized color names.
- -sources device[,opt1=val1[,opt2=val2]...]
Show autodetected sources of the input device. Some devices may provide system-dependent source names that cannot be autodetected. The returned list cannot be assumed to be always complete.
ffmpeg -sources pulse,server=192.168.0.4
- -sinks device[,opt1=val1[,opt2=val2]...]
Show autodetected sinks of the output device. Some devices may provide system-dependent sink names that cannot be autodetected. The returned list cannot be assumed to be always complete.
ffmpeg -sinks pulse,server=192.168.0.4
- -loglevel [flags+]loglevel | -v [flags+]loglevel
Set logging level and flags used by the library.
The optional flags prefix can consist of the following values:
- ‘repeat’
Indicates that repeated log output should not be compressed to the first line and the "Last message repeated n times" line will be omitted.
- ‘level’
Indicates that log output should add a
[level]prefix to each message line. This can be used as an alternative to log coloring, e.g. when dumping the log to file.- ‘time’
Indicates that log lines should be prefixed with time information.
- ‘datetime’
Indicates that log lines should be prefixed with date and time information.
Flags can also be used alone by adding a ’+’/’-’ prefix to set/reset a single flag without affecting other flags or changing loglevel. When setting both flags and loglevel, a ’+’ separator is expected between the last flags value and before loglevel.
loglevel is a string or a number containing one of the following values:
- ‘quiet, -8’
Show nothing at all; be silent.
- ‘panic, 0’
Only show fatal errors which could lead the process to crash, such as an assertion failure. This is not currently used for anything.
- ‘fatal, 8’
Only show fatal errors. These are errors after which the process absolutely cannot continue.
- ‘error, 16’
Show all errors, including ones which can be recovered from.
- ‘warning, 24’
Show all warnings and errors. Any message related to possibly incorrect or unexpected events will be shown.
- ‘info, 32’
Show informative messages during processing. This is in addition to warnings and errors. This is the default value.
- ‘verbose, 40’
Same as
info, except more verbose.- ‘debug, 48’
Show everything, including debugging information.
- ‘trace, 56’
For example to enable repeated log output, add the
levelprefix, and set loglevel toverbose:ffmpeg -loglevel repeat+level+verbose -i input output
Another example that enables repeated log output without affecting current state of
levelprefix flag or loglevel:ffmpeg [...] -loglevel +repeat
By default the program logs to stderr. If coloring is supported by the terminal, colors are used to mark errors and warnings. Log coloring can be disabled setting the environment variable
AV_LOG_FORCE_NOCOLOR, or can be forced setting the environment variableAV_LOG_FORCE_COLOR.- -report
Dump full command line and log output to a file named
program-YYYYMMDD-HHMMSS.login the current directory. This file can be useful for bug reports. It also implies-loglevel debug.Setting the environment variable
FFREPORTto any value has the same effect. If the value is a ’:’-separated key=value sequence, these options will affect the report; option values must be escaped if they contain special characters or the options delimiter ’:’ (see the “Quoting and escaping” section in the ffmpeg-utils manual).The following options are recognized:
- file
set the file name to use for the report;
%pis expanded to the name of the program,%tis expanded to a timestamp,%%is expanded to a plain%- level
set the log verbosity level using a numerical value (see
-loglevel).
For example, to output a report to a file named ffreport.log using a log level of
32(alias for log levelinfo):FFREPORT=file=ffreport.log:level=32 ffmpeg -i input output
Errors in parsing the environment variable are not fatal, and will not appear in the report.
- -hide_banner
Suppress printing banner.
All FFmpeg tools will normally show a copyright notice, build options and library versions. This option can be used to suppress printing this information.
- -cpuflags flags (global)
Allows setting and clearing cpu flags. This option is intended for testing. Do not use it unless you know what you’re doing.
ffmpeg -cpuflags -sse+mmx ... ffmpeg -cpuflags mmx ... ffmpeg -cpuflags 0 ...
Possible flags for this option are:
- ‘x86’
- ‘mmx’
- ‘mmxext’
- ‘sse’
- ‘sse2’
- ‘sse2slow’
- ‘sse3’
- ‘sse3slow’
- ‘ssse3’
- ‘atom’
- ‘sse4.1’
- ‘sse4.2’
- ‘avx’
- ‘avx2’
- ‘xop’
- ‘fma3’
- ‘fma4’
- ‘3dnow’
- ‘3dnowext’
- ‘bmi1’
- ‘bmi2’
- ‘cmov’
- ‘ARM’
- ‘armv5te’
- ‘armv6’
- ‘armv6t2’
- ‘vfp’
- ‘vfpv3’
- ‘neon’
- ‘setend’
- ‘AArch64’
- ‘armv8’
- ‘vfp’
- ‘neon’
- ‘PowerPC’
- ‘altivec’
- ‘Specific Processors’
- ‘pentium2’
- ‘pentium3’
- ‘pentium4’
- ‘k6’
- ‘k62’
- ‘athlon’
- ‘athlonxp’
- ‘k8’
- -cpucount count (global)
Override detection of CPU count. This option is intended for testing. Do not use it unless you know what you’re doing.
ffmpeg -cpucount 2
- -max_alloc bytes
Set the maximum size limit for allocating a block on the heap by ffmpeg’s family of malloc functions. Exercise extreme caution when using this option. Don’t use if you do not understand the full consequence of doing so. Default is INT_MAX.
3.3 AVOptions
These options are provided directly by the libavformat, libavdevice and libavcodec libraries. To see the list of available AVOptions, use the -help option. They are separated into two categories:
- generic
These options can be set for any container, codec or device. Generic options are listed under AVFormatContext options for containers/devices and under AVCodecContext options for codecs.
- private
These options are specific to the given container, device or codec. Private options are listed under their corresponding containers/devices/codecs.
For example to write an ID3v2.3 header instead of a default ID3v2.4 to an MP3 file, use the id3v2_version private option of the MP3 muxer:
ffmpeg -i input.flac -id3v2_version 3 out.mp3
All codec AVOptions are per-stream, and thus a stream specifier should be attached to them:
ffmpeg -i multichannel.mxf -map 0:v:0 -map 0:a:0 -map 0:a:0 -c:a:0 ac3 -b:a:0 640k -ac:a:1 2 -c:a:1 aac -b:2 128k out.mp4
In the above example, a multichannel audio stream is mapped twice for output. The first instance is encoded with codec ac3 and bitrate 640k. The second instance is downmixed to 2 channels and encoded with codec aac. A bitrate of 128k is specified for it using absolute index of the output stream.
Note: the -nooption syntax cannot be used for boolean AVOptions, use -option 0/-option 1.
Note: the old undocumented way of specifying per-stream AVOptions by prepending v/a/s to the options name is now obsolete and will be removed soon.
3.4 Main options
- -f format
Force format to use.
- -unit
Show the unit of the displayed values.
- -prefix
Use SI prefixes for the displayed values. Unless the "-byte_binary_prefix" option is used all the prefixes are decimal.
- -byte_binary_prefix
Force the use of binary prefixes for byte values.
- -sexagesimal
Use sexagesimal format HH:MM:SS.MICROSECONDS for time values.
- -pretty
Prettify the format of the displayed values, it corresponds to the options "-unit -prefix -byte_binary_prefix -sexagesimal".
- -output_format, -of, -print_format writer_name[=writer_options]
Set the output printing format.
writer_name specifies the name of the writer, and writer_options specifies the options to be passed to the writer.
For example for printing the output in JSON format, specify:
-output_format json
For more details on the available output printing formats, see the Writers section below.
- -sections
Print sections structure and section information, and exit. The output is not meant to be parsed by a machine.
- -select_streams stream_specifier
Select only the streams specified by stream_specifier. This option affects only the options related to streams (e.g.
show_streams,show_packets, etc.).For example to show only audio streams, you can use the command:
ffprobe -show_streams -select_streams a INPUT
To show only video packets belonging to the video stream with index 1:
ffprobe -show_packets -select_streams v:1 INPUT
- -show_data
Show payload data, as a hexadecimal and ASCII dump (other formats can be selected using -data_dump_format). Coupled with -show_packets, it will dump the packets’ data. Coupled with -show_streams, it will dump the codec extradata.
The dump is printed as the "data" field. It may contain newlines.
- -show_data_hash algorithm
Show a hash of payload data, for packets with -show_packets and for codec extradata with -show_streams.
- -data_dump_format format
Select a format used for the data dumps enabled with the -show_data option. The default is
xxdwhich is a hexdump format compatible with the well-knownxxdprogram.base64is also supported.- -show_error
Show information about the error found when trying to probe the input.
The error information is printed within a section with name "ERROR".
- -show_format
Show information about the container format of the input multimedia stream.
All the container format information is printed within a section with name "FORMAT".
- -show_entries section_entries
Set list of entries to show.
Entries are specified according to the following syntax. section_entries contains a list of section entries separated by
:. Each section entry is composed by a section name (or unique name), optionally followed by a list of entries local to that section, separated by,.If section name is specified but is followed by no
=, all entries are printed to output, together with all the contained sections. Otherwise only the entries specified in the local section entries list are printed. In particular, if=is specified but the list of local entries is empty, then no entries will be shown for that section.Note that the order of specification of the local section entries is not honored in the output, and the usual display order will be retained.
The formal syntax is given by:
LOCAL_SECTION_ENTRIES ::= SECTION_ENTRY_NAME[,LOCAL_SECTION_ENTRIES] SECTION_ENTRY ::= SECTION_NAME[=[LOCAL_SECTION_ENTRIES]] SECTION_ENTRIES ::= SECTION_ENTRY[:SECTION_ENTRIES]
For example, to show only the index and type of each stream, and the PTS time, duration time, and stream index of the packets, you can specify the argument:
packet=pts_time,duration_time,stream_index : stream=index,codec_type
To show all the entries in the section "format", but only the codec type in the section "stream", specify the argument:
format : stream=codec_type
To show all the tags in the stream and format sections:
stream_tags : format_tags
To show only the
titletag (if available) in the stream sections:stream_tags=title
- -show_packets
Show information about each packet contained in the input multimedia stream.
The information for each single packet is printed within a dedicated section with name "PACKET".
- -show_frames
Show information about each frame and subtitle contained in the input multimedia stream.
The information for each single frame is printed within a dedicated section with name "FRAME" or "SUBTITLE".
- -show_log loglevel
Show logging information from the decoder about each frame according to the value set in loglevel, (see
-loglevel). This option requires-show_frames.The information for each log message is printed within a dedicated section with name "LOG".
- -show_streams
Show information about each media stream contained in the input multimedia stream.
Each media stream information is printed within a dedicated section with name "STREAM".
- -show_programs
Show information about programs and their streams contained in the input multimedia stream.
Each media stream information is printed within a dedicated section with name "PROGRAM_STREAM".
- -show_stream_groups
Show information about stream groups and their streams contained in the input multimedia stream.
Each media stream information is printed within a dedicated section with name "STREAM_GROUP_STREAM".
- -show_chapters
Show information about chapters stored in the format.
Each chapter is printed within a dedicated section with name "CHAPTER".
- -count_frames
Count the number of frames per stream and report it in the corresponding stream section.
- -count_packets
Count the number of packets per stream and report it in the corresponding stream section.
- -read_intervals read_intervals
-
Read only the specified intervals. read_intervals must be a sequence of interval specifications separated by ",".
ffprobewill seek to the interval starting point, and will continue reading from that.Each interval is specified by two optional parts, separated by "%".
The first part specifies the interval start position. It is interpreted as an absolute position, or as a relative offset from the current position if it is preceded by the "+" character. If this first part is not specified, no seeking will be performed when reading this interval.
The second part specifies the interval end position. It is interpreted as an absolute position, or as a relative offset from the current position if it is preceded by the "+" character. If the offset specification starts with "#", it is interpreted as the number of packets to read (not including the flushing packets) from the interval start. If no second part is specified, the program will read until the end of the input.
Note that seeking is not accurate, thus the actual interval start point may be different from the specified position. Also, when an interval duration is specified, the absolute end time will be computed by adding the duration to the interval start point found by seeking the file, rather than to the specified start value.
The formal syntax is given by:
INTERVAL ::= [START|+START_OFFSET][%[END|+END_OFFSET]] INTERVALS ::= INTERVAL[,INTERVALS]
A few examples follow.
- Seek to time 10, read packets until 20 seconds after the found seek
point, then seek to position
01:30(1 minute and thirty seconds) and read packets until position01:45.10%+20,01:30%01:45
- Read only 42 packets after seeking to position
01:23:01:23%+#42
- Read only the first 20 seconds from the start:
%+20
- Read from the start until position
02:30:%02:30
- Seek to time 10, read packets until 20 seconds after the found seek
point, then seek to position
- -show_private_data, -private
Show private data, that is data depending on the format of the particular shown element. This option is enabled by default, but you may need to disable it for specific uses, for example when creating XSD-compliant XML output.
- -show_program_version
Show information related to program version.
Version information is printed within a section with name "PROGRAM_VERSION".
- -show_library_versions
Show information related to library versions.
Version information for each library is printed within a section with name "LIBRARY_VERSION".
- -show_versions
Show information related to program and library versions. This is the equivalent of setting both -show_program_version and -show_library_versions options.
- -show_pixel_formats
Show information about all pixel formats supported by FFmpeg.
Pixel format information for each format is printed within a section with name "PIXEL_FORMAT".
- -show_optional_fields value
Some writers viz. JSON and XML, omit the printing of fields with invalid or non-applicable values, while other writers always print them. This option enables one to control this behaviour. Valid values are
always/1,never/0andauto/-1. Default is auto.- -analyze_frames
Analyze frames and/or their side data up to the provided read interval, providing additional information that may be useful at a stream level. Must be paired with the -show_streams option or it will have no effect.
Currently, the additional fields provided by this option when enabled are the
closed_captionsandfilm_grainfields.For example, to analyze the first 20 seconds and populate these fields:
ffprobe -show_streams -analyze_frames -read_intervals "%+20" INPUT
- -bitexact
Force bitexact output, useful to produce output which is not dependent on the specific build.
- -i input_url
Read input_url.
- -o output_url
Write output to output_url. If not specified, the output is sent to stdout.
- -c:media_specifier codec_name
- -codec:media_specifier codec_name
Force a specific decoder implementation for the stream identified by media_specifier, which can assume the values
a(audio),v(video),s(subtitle), andd(data).
4 Writers
A writer defines the output format adopted by ffprobe, and will be
used for printing all the parts of the output.
A writer may accept one or more arguments, which specify the options to adopt. The options are specified as a list of key=value pairs, separated by ":".
All writers support the following options:
- string_validation, sv
Set string validation mode.
The following values are accepted.
- ‘fail’
The writer will fail immediately in case an invalid string (UTF-8) sequence or code point is found in the input. This is especially useful to validate input metadata.
- ‘ignore’
Any validation error will be ignored. This will result in possibly broken output, especially with the json or xml writer.
- ‘replace’
The writer will substitute invalid UTF-8 sequences or code points with the string specified with the string_validation_replacement.
Default value is ‘replace’.
- string_validation_replacement, svr
Set replacement string to use in case string_validation is set to ‘replace’.
In case the option is not specified, the writer will assume the empty string, that is it will remove the invalid sequences from the input strings.
A description of the currently available writers follows.
4.1 default
Default format.
Print each section in the form:
[SECTION] key1=val1 ... keyN=valN [/SECTION]
Metadata tags are printed as a line in the corresponding FORMAT, STREAM, STREAM_GROUP_STREAM or PROGRAM_STREAM section, and are prefixed by the string "TAG:".
A description of the accepted options follows.
- nokey, nk
If set to 1 specify not to print the key of each field. Default value is 0.
- noprint_wrappers, nw
If set to 1 specify not to print the section header and footer. Default value is 0.
4.2 compact, csv
Compact and CSV format.
The csv writer is equivalent to compact, but supports
different defaults.
Each section is printed on a single line. If no option is specified, the output has the form:
section|key1=val1| ... |keyN=valN
Metadata tags are printed in the corresponding "format" or "stream" section. A metadata tag key, if printed, is prefixed by the string "tag:".
The description of the accepted options follows.
- item_sep, s
Specify the character to use for separating fields in the output line. It must be a single printable character, it is "|" by default ("," for the
csvwriter).- nokey, nk
If set to 1 specify not to print the key of each field. Its default value is 0 (1 for the
csvwriter).- escape, e
Set the escape mode to use, default to "c" ("csv" for the
csvwriter).It can assume one of the following values:
- c
Perform C-like escaping. Strings containing a newline (‘\n’), carriage return (‘\r’), a tab (‘\t’), a form feed (‘\f’), the escaping character (‘\’) or the item separator character SEP are escaped using C-like fashioned escaping, so that a newline is converted to the sequence ‘\n’, a carriage return to ‘\r’, ‘\’ to ‘\\’ and the separator SEP is converted to ‘\SEP’.
- csv
Perform CSV-like escaping, as described in RFC4180. Strings containing a newline (‘\n’), a carriage return (‘\r’), a double quote (‘"’), or SEP are enclosed in double-quotes.
- none
Perform no escaping.
- print_section, p
Print the section name at the beginning of each line if the value is
1, disable it with value set to0. Default value is1.
4.3 flat
Flat format.
A free-form output where each line contains an explicit key=value, such as "streams.stream.3.tags.foo=bar". The output is shell escaped, so it can be directly embedded in sh scripts as long as the separator character is an alphanumeric character or an underscore (see sep_char option).
The description of the accepted options follows.
- sep_char, s
Separator character used to separate the chapter, the section name, IDs and potential tags in the printed field key.
Default value is ‘.’.
- hierarchical, h
Specify if the section name specification should be hierarchical. If set to 1, and if there is more than one section in the current chapter, the section name will be prefixed by the name of the chapter. A value of 0 will disable this behavior.
Default value is 1.
4.4 ini
INI format output.
Print output in an INI based format.
The following conventions are adopted:
- all key and values are UTF-8
- ‘.’ is the subgroup separator
- newline, ‘\t’, ‘\f’, ‘\b’ and the following characters are escaped
- ‘\’ is the escape character
- ‘#’ is the comment indicator
- ‘=’ is the key/value separator
- ‘:’ is not used but usually parsed as key/value separator
This writer accepts options as a list of key=value pairs, separated by ‘:’.
The description of the accepted options follows.
- hierarchical, h
Specify if the section name specification should be hierarchical. If set to 1, and if there is more than one section in the current chapter, the section name will be prefixed by the name of the chapter. A value of 0 will disable this behavior.
Default value is 1.
4.5 json
JSON based format.
Each section is printed using JSON notation.
The description of the accepted options follows.
- compact, c
If set to 1 enable compact output, that is each section will be printed on a single line. Default value is 0.
For more information about JSON, see http://www.json.org/.
4.6 xml
XML based format.
The XML output is described in the XML schema description file ffprobe.xsd installed in the FFmpeg datadir.
An updated version of the schema can be retrieved at the url http://www.ffmpeg.org/schema/ffprobe.xsd, which redirects to the latest schema committed into the FFmpeg development source code tree.
Note that the output issued will be compliant to the ffprobe.xsd schema only when no special global output options (unit, prefix, byte_binary_prefix, sexagesimal etc.) are specified.
The description of the accepted options follows.
- fully_qualified, q
If set to 1 specify if the output should be fully qualified. Default value is 0. This is required for generating an XML file which can be validated through an XSD file.
- xsd_strict, x
If set to 1 perform more checks for ensuring that the output is XSD compliant. Default value is 0. This option automatically sets fully_qualified to 1.
For more information about the XML format, see https://www.w3.org/XML/.
5 Timecode
ffprobe supports Timecode extraction:
- MPEG1/2 timecode is extracted from the GOP, and is available in the video stream details (-show_streams, see timecode).
- MOV timecode is extracted from tmcd track, so is available in the tmcd stream metadata (-show_streams, see TAG:timecode).
- DV, GXF and AVI timecodes are available in format metadata (-show_format, see TAG:timecode).
6 Syntax
This section documents the syntax and formats employed by the FFmpeg libraries and tools.
6.1 Quoting and escaping
FFmpeg adopts the following quoting and escaping mechanism, unless explicitly specified. The following rules are applied:
- ‘'’ and ‘\’ are special characters (respectively used for quoting and escaping). In addition to them, there might be other special characters depending on the specific syntax where the escaping and quoting are employed.
- A special character is escaped by prefixing it with a ‘\’.
- All characters enclosed between ‘''’ are included literally in the parsed string. The quote character ‘'’ itself cannot be quoted, so you may need to close the quote and escape it.
- Leading and trailing whitespaces, unless escaped or quoted, are removed from the parsed string.
Note that you may need to add a second level of escaping when using the command line or a script, which depends on the syntax of the adopted shell language.
The function av_get_token defined in
libavutil/avstring.h can be used to parse a token quoted or
escaped according to the rules defined above.
The tool tools/ffescape in the FFmpeg source tree can be used to automatically quote or escape a string in a script.
6.1.1 Examples
- Escape the string
Crime d'Amourcontaining the'special character:Crime d\'Amour
- The string above contains a quote, so the
'needs to be escaped when quoting it:'Crime d'\''Amour'
- Include leading or trailing whitespaces using quoting:
' this string starts and ends with whitespaces '
- Escaping and quoting can be mixed together:
' The string '\'string\'' is a string '
- To include a literal ‘\’ you can use either escaping or quoting:
'c:\foo' can be written as c:\\foo
6.2 Date
The accepted syntax is:
[(YYYY-MM-DD|YYYYMMDD)[T|t| ]]((HH:MM:SS[.m...]]])|(HHMMSS[.m...]]]))[Z] now
If the value is "now" it takes the current time.
Time is local time unless Z is appended, in which case it is interpreted as UTC. If the year-month-day part is not specified it takes the current year-month-day.
6.3 Time duration
There are two accepted syntaxes for expressing time duration.
[-][HH:]MM:SS[.m...]
HH expresses the number of hours, MM the number of minutes for a maximum of 2 digits, and SS the number of seconds for a maximum of 2 digits. The m at the end expresses decimal value for SS.
or
[-]S+[.m...][s|ms|us]
S expresses the number of seconds, with the optional decimal part m. The optional literal suffixes ‘s’, ‘ms’ or ‘us’ indicate to interpret the value as seconds, milliseconds or microseconds, respectively.
In both expressions, the optional ‘-’ indicates negative duration.
6.3.1 Examples
The following examples are all valid time duration:
- ‘55’
55 seconds
- ‘0.2’
0.2 seconds
- ‘200ms’
200 milliseconds, that’s 0.2s
- ‘200000us’
200000 microseconds, that’s 0.2s
- ‘12:03:45’
12 hours, 03 minutes and 45 seconds
- ‘23.189’
23.189 seconds
6.4 Video size
Specify the size of the sourced video, it may be a string of the form widthxheight, or the name of a size abbreviation.
The following abbreviations are recognized:
- ‘ntsc’
720x480
- ‘pal’
720x576
- ‘qntsc’
352x240
- ‘qpal’
352x288
- ‘sntsc’
640x480
- ‘spal’
768x576
- ‘film’
352x240
- ‘ntsc-film’
352x240
- ‘sqcif’
128x96
- ‘qcif’
176x144
- ‘cif’
352x288
- ‘4cif’
704x576
- ‘16cif’
1408x1152
- ‘qqvga’
160x120
- ‘qvga’
320x240
- ‘vga’
640x480
- ‘svga’
800x600
- ‘xga’
1024x768
- ‘uxga’
1600x1200
- ‘qxga’
2048x1536
- ‘sxga’
1280x1024
- ‘qsxga’
2560x2048
- ‘hsxga’
5120x4096
- ‘wvga’
852x480
- ‘wxga’
1366x768
- ‘wsxga’
1600x1024
- ‘wuxga’
1920x1200
- ‘woxga’
2560x1600
- ‘wqsxga’
3200x2048
- ‘wquxga’
3840x2400
- ‘whsxga’
6400x4096
- ‘whuxga’
7680x4800
- ‘cga’
320x200
- ‘ega’
640x350
- ‘hd480’
852x480
- ‘hd720’
1280x720
- ‘hd1080’
1920x1080
- ‘2k’
2048x1080
- ‘2kflat’
1998x1080
- ‘2kscope’
2048x858
- ‘4k’
4096x2160
- ‘4kflat’
3996x2160
- ‘4kscope’
4096x1716
- ‘nhd’
640x360
- ‘hqvga’
240x160
- ‘wqvga’
400x240
- ‘fwqvga’
432x240
- ‘hvga’
480x320
- ‘qhd’
960x540
- ‘2kdci’
2048x1080
- ‘4kdci’
4096x2160
- ‘uhd2160’
3840x2160
- ‘uhd4320’
7680x4320
6.5 Video rate
Specify the frame rate of a video, expressed as the number of frames generated per second. It has to be a string in the format frame_rate_num/frame_rate_den, an integer number, a float number or a valid video frame rate abbreviation.
The following abbreviations are recognized:
- ‘ntsc’
30000/1001
- ‘pal’
25/1
- ‘qntsc’
30000/1001
- ‘qpal’
25/1
- ‘sntsc’
30000/1001
- ‘spal’
25/1
- ‘film’
24/1
- ‘ntsc-film’
24000/1001
6.6 Ratio
A ratio can be expressed as an expression, or in the form numerator:denominator.
Note that a ratio with infinite (1/0) or negative value is considered valid, so you should check on the returned value if you want to exclude those values.
The undefined value can be expressed using the "0:0" string.
6.7 Color
It can be the name of a color as defined below (case insensitive match) or a
[0x|#]RRGGBB[AA] sequence, possibly followed by @ and a string
representing the alpha component.
The alpha component may be a string composed by "0x" followed by an hexadecimal number or a decimal number between 0.0 and 1.0, which represents the opacity value (‘0x00’ or ‘0.0’ means completely transparent, ‘0xff’ or ‘1.0’ completely opaque). If the alpha component is not specified then ‘0xff’ is assumed.
The string ‘random’ will result in a random color.
The following names of colors are recognized:
- ‘AliceBlue’
0xF0F8FF
- ‘AntiqueWhite’
0xFAEBD7
- ‘Aqua’
0x00FFFF
- ‘Aquamarine’
0x7FFFD4
- ‘Azure’
0xF0FFFF
- ‘Beige’
0xF5F5DC
- ‘Bisque’
0xFFE4C4
- ‘Black’
0x000000
- ‘BlanchedAlmond’
0xFFEBCD
- ‘Blue’
0x0000FF
- ‘BlueViolet’
0x8A2BE2
- ‘Brown’
0xA52A2A
- ‘BurlyWood’
0xDEB887
- ‘CadetBlue’
0x5F9EA0
- ‘Chartreuse’
0x7FFF00
- ‘Chocolate’
0xD2691E
- ‘Coral’
0xFF7F50
- ‘CornflowerBlue’
0x6495ED
- ‘Cornsilk’
0xFFF8DC
- ‘Crimson’
0xDC143C
- ‘Cyan’
0x00FFFF
- ‘DarkBlue’
0x00008B
- ‘DarkCyan’
0x008B8B
- ‘DarkGoldenRod’
0xB8860B
- ‘DarkGray’
0xA9A9A9
- ‘DarkGreen’
0x006400
- ‘DarkKhaki’
0xBDB76B
- ‘DarkMagenta’
0x8B008B
- ‘DarkOliveGreen’
0x556B2F
- ‘Darkorange’
0xFF8C00
- ‘DarkOrchid’
0x9932CC
- ‘DarkRed’
0x8B0000
- ‘DarkSalmon’
0xE9967A
- ‘DarkSeaGreen’
0x8FBC8F
- ‘DarkSlateBlue’
0x483D8B
- ‘DarkSlateGray’
0x2F4F4F
- ‘DarkTurquoise’
0x00CED1
- ‘DarkViolet’
0x9400D3
- ‘DeepPink’
0xFF1493
- ‘DeepSkyBlue’
0x00BFFF
- ‘DimGray’
0x696969
- ‘DodgerBlue’
0x1E90FF
- ‘FireBrick’
0xB22222
- ‘FloralWhite’
0xFFFAF0
- ‘ForestGreen’
0x228B22
- ‘Fuchsia’
0xFF00FF
- ‘Gainsboro’
0xDCDCDC
- ‘GhostWhite’
0xF8F8FF
- ‘Gold’
0xFFD700
- ‘GoldenRod’
0xDAA520
- ‘Gray’
0x808080
- ‘Green’
0x008000
- ‘GreenYellow’
0xADFF2F
- ‘HoneyDew’
0xF0FFF0
- ‘HotPink’
0xFF69B4
- ‘IndianRed’
0xCD5C5C
- ‘Indigo’
0x4B0082
- ‘Ivory’
0xFFFFF0
- ‘Khaki’
0xF0E68C
- ‘Lavender’
0xE6E6FA
- ‘LavenderBlush’
0xFFF0F5
- ‘LawnGreen’
0x7CFC00
- ‘LemonChiffon’
0xFFFACD
- ‘LightBlue’
0xADD8E6
- ‘LightCoral’
0xF08080
- ‘LightCyan’
0xE0FFFF
- ‘LightGoldenRodYellow’
0xFAFAD2
- ‘LightGreen’
0x90EE90
- ‘LightGrey’
0xD3D3D3
- ‘LightPink’
0xFFB6C1
- ‘LightSalmon’
0xFFA07A
- ‘LightSeaGreen’
0x20B2AA
- ‘LightSkyBlue’
0x87CEFA
- ‘LightSlateGray’
0x778899
- ‘LightSteelBlue’
0xB0C4DE
- ‘LightYellow’
0xFFFFE0
- ‘Lime’
0x00FF00
- ‘LimeGreen’
0x32CD32
- ‘Linen’
0xFAF0E6
- ‘Magenta’
0xFF00FF
- ‘Maroon’
0x800000
- ‘MediumAquaMarine’
0x66CDAA
- ‘MediumBlue’
0x0000CD
- ‘MediumOrchid’
0xBA55D3
- ‘MediumPurple’
0x9370D8
- ‘MediumSeaGreen’
0x3CB371
- ‘MediumSlateBlue’
0x7B68EE
- ‘MediumSpringGreen’
0x00FA9A
- ‘MediumTurquoise’
0x48D1CC
- ‘MediumVioletRed’
0xC71585
- ‘MidnightBlue’
0x191970
- ‘MintCream’
0xF5FFFA
- ‘MistyRose’
0xFFE4E1
- ‘Moccasin’
0xFFE4B5
- ‘NavajoWhite’
0xFFDEAD
- ‘Navy’
0x000080
- ‘OldLace’
0xFDF5E6
- ‘Olive’
0x808000
- ‘OliveDrab’
0x6B8E23
- ‘Orange’
0xFFA500
- ‘OrangeRed’
0xFF4500
- ‘Orchid’
0xDA70D6
- ‘PaleGoldenRod’
0xEEE8AA
- ‘PaleGreen’
0x98FB98
- ‘PaleTurquoise’
0xAFEEEE
- ‘PaleVioletRed’
0xD87093
- ‘PapayaWhip’
0xFFEFD5
- ‘PeachPuff’
0xFFDAB9
- ‘Peru’
0xCD853F
- ‘Pink’
0xFFC0CB
- ‘Plum’
0xDDA0DD
- ‘PowderBlue’
0xB0E0E6
- ‘Purple’
0x800080
- ‘Red’
0xFF0000
- ‘RosyBrown’
0xBC8F8F
- ‘RoyalBlue’
0x4169E1
- ‘SaddleBrown’
0x8B4513
- ‘Salmon’
0xFA8072
- ‘SandyBrown’
0xF4A460
- ‘SeaGreen’
0x2E8B57
- ‘SeaShell’
0xFFF5EE
- ‘Sienna’
0xA0522D
- ‘Silver’
0xC0C0C0
- ‘SkyBlue’
0x87CEEB
- ‘SlateBlue’
0x6A5ACD
- ‘SlateGray’
0x708090
- ‘Snow’
0xFFFAFA
- ‘SpringGreen’
0x00FF7F
- ‘SteelBlue’
0x4682B4
- ‘Tan’
0xD2B48C
- ‘Teal’
0x008080
- ‘Thistle’
0xD8BFD8
- ‘Tomato’
0xFF6347
- ‘Turquoise’
0x40E0D0
- ‘Violet’
0xEE82EE
- ‘Wheat’
0xF5DEB3
- ‘White’
0xFFFFFF
- ‘WhiteSmoke’
0xF5F5F5
- ‘Yellow’
0xFFFF00
- ‘YellowGreen’
0x9ACD32
6.8 Channel Layout
A channel layout specifies the spatial disposition of the channels in a multi-channel audio stream. To specify a channel layout, FFmpeg makes use of a special syntax.
Individual channels are identified by an id, as given by the table below:
- ‘FL’
front left
- ‘FR’
front right
- ‘FC’
front center
- ‘LFE’
low frequency
- ‘BL’
back left
- ‘BR’
back right
- ‘FLC’
front left-of-center
- ‘FRC’
front right-of-center
- ‘BC’
back center
- ‘SL’
side left
- ‘SR’
side right
- ‘TC’
top center
- ‘TFL’
top front left
- ‘TFC’
top front center
- ‘TFR’
top front right
- ‘TBL’
top back left
- ‘TBC’
top back center
- ‘TBR’
top back right
- ‘DL’
downmix left
- ‘DR’
downmix right
- ‘WL’
wide left
- ‘WR’
wide right
- ‘SDL’
surround direct left
- ‘SDR’
surround direct right
- ‘LFE2’
low frequency 2
Standard channel layout compositions can be specified by using the following identifiers:
- ‘mono’
FC
- ‘stereo’
FL+FR
- ‘2.1’
FL+FR+LFE
- ‘3.0’
FL+FR+FC
- ‘3.0(back)’
FL+FR+BC
- ‘4.0’
FL+FR+FC+BC
- ‘quad’
FL+FR+BL+BR
- ‘quad(side)’
FL+FR+SL+SR
- ‘3.1’
FL+FR+FC+LFE
- ‘5.0’
FL+FR+FC+BL+BR
- ‘5.0(side)’
FL+FR+FC+SL+SR
- ‘4.1’
FL+FR+FC+LFE+BC
- ‘5.1’
FL+FR+FC+LFE+BL+BR
- ‘5.1(side)’
FL+FR+FC+LFE+SL+SR
- ‘6.0’
FL+FR+FC+BC+SL+SR
- ‘6.0(front)’
FL+FR+FLC+FRC+SL+SR
- ‘3.1.2’
FL+FR+FC+LFE+TFL+TFR
- ‘hexagonal’
FL+FR+FC+BL+BR+BC
- ‘6.1’
FL+FR+FC+LFE+BC+SL+SR
- ‘6.1’
FL+FR+FC+LFE+BL+BR+BC
- ‘6.1(front)’
FL+FR+LFE+FLC+FRC+SL+SR
- ‘7.0’
FL+FR+FC+BL+BR+SL+SR
- ‘7.0(front)’
FL+FR+FC+FLC+FRC+SL+SR
- ‘7.1’
FL+FR+FC+LFE+BL+BR+SL+SR
- ‘7.1(wide)’
FL+FR+FC+LFE+BL+BR+FLC+FRC
- ‘7.1(wide-side)’
FL+FR+FC+LFE+FLC+FRC+SL+SR
- ‘5.1.2’
FL+FR+FC+LFE+BL+BR+TFL+TFR
- ‘octagonal’
FL+FR+FC+BL+BR+BC+SL+SR
- ‘cube’
FL+FR+BL+BR+TFL+TFR+TBL+TBR
- ‘5.1.4’
FL+FR+FC+LFE+BL+BR+TFL+TFR+TBL+TBR
- ‘7.1.2’
FL+FR+FC+LFE+BL+BR+SL+SR+TFL+TFR
- ‘7.1.4’
FL+FR+FC+LFE+BL+BR+SL+SR+TFL+TFR+TBL+TBR
- ‘7.2.3’
FL+FR+FC+LFE+BL+BR+SL+SR+TFL+TFR+TBC+LFE2
- ‘9.1.4’
FL+FR+FC+LFE+BL+BR+FLC+FRC+SL+SR+TFL+TFR+TBL+TBR
- ‘9.1.6’
FL+FR+FC+LFE+BL+BR+FLC+FRC+SL+SR+TFL+TFR+TBL+TBR+TSL+TSR
- ‘hexadecagonal’
FL+FR+FC+BL+BR+BC+SL+SR+WL+WR+TBL+TBR+TBC+TFC+TFL+TFR
- ‘binaural’
BIL+BIR
- ‘downmix’
DL+DR
- ‘22.2’
FL+FR+FC+LFE+BL+BR+FLC+FRC+BC+SL+SR+TC+TFL+TFC+TFR+TBL+TBC+TBR+LFE2+TSL+TSR+BFC+BFL+BFR
A custom channel layout can be specified as a sequence of terms, separated by ’+’. Each term can be:
- the name of a single channel (e.g. ‘FL’, ‘FR’, ‘FC’, ‘LFE’, etc.), each optionally containing a custom name after a ’@’, (e.g. ‘FL@Left’, ‘FR@Right’, ‘FC@Center’, ‘LFE@Low_Frequency’, etc.)
A standard channel layout can be specified by the following:
- the name of a single channel (e.g. ‘FL’, ‘FR’, ‘FC’, ‘LFE’, etc.)
- the name of a standard channel layout (e.g. ‘mono’, ‘stereo’, ‘4.0’, ‘quad’, ‘5.0’, etc.)
- a number of channels, in decimal, followed by ’c’, yielding the default channel
layout for that number of channels (see the function
av_channel_layout_default). Note that not all channel counts have a default layout. - a number of channels, in decimal, followed by ’C’, yielding an unknown channel layout with the specified number of channels. Note that not all channel layout specification strings support unknown channel layouts.
- a channel layout mask, in hexadecimal starting with "0x" (see the
AV_CH_*macros in libavutil/channel_layout.h.
Before libavutil version 53 the trailing character "c" to specify a number of channels was optional, but now it is required, while a channel layout mask can also be specified as a decimal number (if and only if not followed by "c" or "C").
See also the function av_channel_layout_from_string defined in
libavutil/channel_layout.h.
7 Expression Evaluation
When evaluating an arithmetic expression, FFmpeg uses an internal formula evaluator, implemented through the libavutil/eval.h interface.
An expression may contain unary, binary operators, constants, and functions.
Two expressions expr1 and expr2 can be combined to form another expression "expr1;expr2". expr1 and expr2 are evaluated in turn, and the new expression evaluates to the value of expr2.
The following binary operators are available: +, -,
*, /, ^.
The following unary operators are available: +, -.
Some internal variables can be used to store and load intermediary
results. They can be accessed using the ld and st
functions with an index argument varying from 0 to 9 to specify which
internal variable to access.
The following functions are available:
- abs(x)
Compute absolute value of x.
- acos(x)
Compute arccosine of x.
- asin(x)
Compute arcsine of x.
- atan(x)
Compute arctangent of x.
- atan2(y, x)
Compute principal value of the arc tangent of y/x.
- between(x, min, max)
Return 1 if x is greater than or equal to min and lesser than or equal to max, 0 otherwise.
- bitand(x, y)
- bitor(x, y)
Compute bitwise and/or operation on x and y.
The results of the evaluation of x and y are converted to integers before executing the bitwise operation.
Note that both the conversion to integer and the conversion back to floating point can lose precision. Beware of unexpected results for large numbers (usually 2^53 and larger).
- ceil(expr)
Round the value of expression expr upwards to the nearest integer. For example, "ceil(1.5)" is "2.0".
- clip(x, min, max)
Return the value of x clipped between min and max.
- cos(x)
Compute cosine of x.
- cosh(x)
Compute hyperbolic cosine of x.
- eq(x, y)
Return 1 if x and y are equivalent, 0 otherwise.
- exp(x)
Compute exponential of x (with base
e, the Euler’s number).- floor(expr)
Round the value of expression expr downwards to the nearest integer. For example, "floor(-1.5)" is "-2.0".
- gauss(x)
Compute Gauss function of x, corresponding to
exp(-x*x/2) / sqrt(2*PI).- gcd(x, y)
Return the greatest common divisor of x and y. If both x and y are 0 or either or both are less than zero then behavior is undefined.
- gt(x, y)
Return 1 if x is greater than y, 0 otherwise.
- gte(x, y)
Return 1 if x is greater than or equal to y, 0 otherwise.
- hypot(x, y)
This function is similar to the C function with the same name; it returns "sqrt(x*x + y*y)", the length of the hypotenuse of a right triangle with sides of length x and y, or the distance of the point (x, y) from the origin.
- if(x, y)
Evaluate x, and if the result is non-zero return the result of the evaluation of y, return 0 otherwise.
- if(x, y, z)
Evaluate x, and if the result is non-zero return the evaluation result of y, otherwise the evaluation result of z.
- ifnot(x, y)
Evaluate x, and if the result is zero return the result of the evaluation of y, return 0 otherwise.
- ifnot(x, y, z)
Evaluate x, and if the result is zero return the evaluation result of y, otherwise the evaluation result of z.
- isinf(x)
Return 1.0 if x is +/-INFINITY, 0.0 otherwise.
- isnan(x)
Return 1.0 if x is NAN, 0.0 otherwise.
- ld(idx)
Load the value of the internal variable with index idx, which was previously stored with st(idx, expr). The function returns the loaded value.
- lerp(x, y, z)
Return linear interpolation between x and y by amount of z.
- log(x)
Compute natural logarithm of x.
- lt(x, y)
Return 1 if x is lesser than y, 0 otherwise.
- lte(x, y)
Return 1 if x is lesser than or equal to y, 0 otherwise.
- max(x, y)
Return the maximum between x and y.
- min(x, y)
Return the minimum between x and y.
- mod(x, y)
Compute the remainder of division of x by y.
- not(expr)
Return 1.0 if expr is zero, 0.0 otherwise.
- pow(x, y)
Compute the power of x elevated y, it is equivalent to "(x)^(y)".
- print(t)
- print(t, l)
Print the value of expression t with loglevel l. If l is not specified then a default log level is used. Return the value of the expression printed.
- random(idx)
Return a pseudo random value between 0.0 and 1.0. idx is the index of the internal variable used to save the seed/state, which can be previously stored with
st(idx).To initialize the seed, you need to store the seed value as a 64-bit unsigned integer in the internal variable with index idx.
For example, to store the seed with value
42in the internal variable with index0and print a few random values:st(0,42); print(random(0)); print(random(0)); print(random(0))
- randomi(idx, min, max)
Return a pseudo random value in the interval between min and max. idx is the index of the internal variable which will be used to save the seed/state, which can be previously stored with
st(idx).To initialize the seed, you need to store the seed value as a 64-bit unsigned integer in the internal variable with index idx.
- root(expr, max)
Find an input value for which the function represented by expr with argument ld(0) is 0 in the interval 0..max.
The expression in expr must denote a continuous function or the result is undefined.
ld(0) is used to represent the function input value, which means that the given expression will be evaluated multiple times with various input values that the expression can access through
ld(0). When the expression evaluates to 0 then the corresponding input value will be returned.- round(expr)
Round the value of expression expr to the nearest integer. For example, "round(1.5)" is "2.0".
- sgn(x)
Compute sign of x.
- sin(x)
Compute sine of x.
- sinh(x)
Compute hyperbolic sine of x.
- sqrt(expr)
Compute the square root of expr. This is equivalent to "(expr)^.5".
- squish(x)
Compute expression
1/(1 + exp(4*x)).- st(idx, expr)
Store the value of the expression expr in an internal variable. idx specifies the index of the variable where to store the value, and it is a value ranging from 0 to 9. The function returns the value stored in the internal variable.
The stored value can be retrieved with
ld(var).Note: variables are currently not shared between expressions.
- tan(x)
Compute tangent of x.
- tanh(x)
Compute hyperbolic tangent of x.
- taylor(expr, x)
- taylor(expr, x, idx)
Evaluate a Taylor series at x, given an expression representing the
ld(idx)-th derivative of a function at 0.When the series does not converge the result is undefined.
ld(idx) is used to represent the derivative order in expr, which means that the given expression will be evaluated multiple times with various input values that the expression can access through
ld(idx). If idx is not specified then 0 is assumed.Note, when you have the derivatives at y instead of 0,
taylor(expr, x-y)can be used.- time(0)
Return the current (wallclock) time in seconds.
- trunc(expr)
Round the value of expression expr towards zero to the nearest integer. For example, "trunc(-1.5)" is "-1.0".
- while(cond, expr)
Evaluate expression expr while the expression cond is non-zero, and returns the value of the last expr evaluation, or NAN if cond was always false.
The following constants are available:
- PI
area of the unit disc, approximately 3.14
- E
exp(1) (Euler’s number), approximately 2.718
- PHI
golden ratio (1+sqrt(5))/2, approximately 1.618
Assuming that an expression is considered "true" if it has a non-zero value, note that:
* works like AND
+ works like OR
For example the construct:
if (A AND B) then C
is equivalent to:
if(A*B, C)
In your C code, you can extend the list of unary and binary functions, and define recognized constants, so that they are available for your expressions.
The evaluator also recognizes the International System unit prefixes. If ’i’ is appended after the prefix, binary prefixes are used, which are based on powers of 1024 instead of powers of 1000. The ’B’ postfix multiplies the value by 8, and can be appended after a unit prefix or used alone. This allows using for example ’KB’, ’MiB’, ’G’ and ’B’ as number postfix.
The list of available International System prefixes follows, with indication of the corresponding powers of 10 and of 2.
- y
10^-24 / 2^-80
- z
10^-21 / 2^-70
- a
10^-18 / 2^-60
- f
10^-15 / 2^-50
- p
10^-12 / 2^-40
- n
10^-9 / 2^-30
- u
10^-6 / 2^-20
- m
10^-3 / 2^-10
- c
10^-2
- d
10^-1
- h
10^2
- k
10^3 / 2^10
- K
10^3 / 2^10
- M
10^6 / 2^20
- G
10^9 / 2^30
- T
10^12 / 2^40
- P
10^15 / 2^50
- E
10^18 / 2^60
- Z
10^21 / 2^70
- Y
10^24 / 2^80
8 Codec Options
libavcodec provides some generic global options, which can be set on all the encoders and decoders. In addition, each codec may support so-called private options, which are specific for a given codec.
Sometimes, a global option may only affect a specific kind of codec, and may be nonsensical or ignored by another, so you need to be aware of the meaning of the specified options. Also some options are meant only for decoding or encoding.
Options may be set by specifying -option value in the
FFmpeg tools, or by setting the value explicitly in the
AVCodecContext options or using the libavutil/opt.h API
for programmatic use.
The list of supported options follow:
- b integer (encoding,audio,video)
Set bitrate in bits/s. Default value is 200K.
- ab integer (encoding,audio)
Set audio bitrate (in bits/s). Default value is 128K.
- bt integer (encoding,video)
Set video bitrate tolerance (in bits/s). In 1-pass mode, bitrate tolerance specifies how far ratecontrol is willing to deviate from the target average bitrate value. This is not related to min/max bitrate. Lowering tolerance too much has an adverse effect on quality.
- flags flags (decoding/encoding,audio,video,subtitles)
Set generic flags.
Possible values:
- ‘mv4’
Use four motion vector by macroblock (mpeg4).
- ‘qpel’
Use 1/4 pel motion compensation.
- ‘loop’
Use loop filter.
- ‘qscale’
Use fixed qscale.
- ‘pass1’
Use internal 2pass ratecontrol in first pass mode.
- ‘pass2’
Use internal 2pass ratecontrol in second pass mode.
- ‘gray’
Only decode/encode grayscale.
- ‘psnr’
Set error[?] variables during encoding.
- ‘truncated’
Input bitstream might be randomly truncated.
- ‘drop_changed’
Don’t output frames whose parameters differ from first decoded frame in stream. Error AVERROR_INPUT_CHANGED is returned when a frame is dropped.
- ‘ildct’
Use interlaced DCT.
- ‘low_delay’
Force low delay.
- ‘global_header’
Place global headers in extradata instead of every keyframe.
- ‘bitexact’
Only write platform-, build- and time-independent data. (except (I)DCT). This ensures that file and data checksums are reproducible and match between platforms. Its primary use is for regression testing.
- ‘aic’
Apply H263 advanced intra coding / mpeg4 ac prediction.
- ‘ilme’
Apply interlaced motion estimation.
- ‘cgop’
Use closed gop.
- ‘output_corrupt’
Output even potentially corrupted frames.
- time_base rational number
Set codec time base.
It is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented. For fixed-fps content, timebase should be
1 / frame_rateand timestamp increments should be identically 1.- g integer (encoding,video)
Set the group of picture (GOP) size. Default value is 12.
- ar integer (decoding/encoding,audio)
Set audio sampling rate (in Hz).
- ac integer (decoding/encoding,audio)
Set number of audio channels.
- cutoff integer (encoding,audio)
Set cutoff bandwidth. (Supported only by selected encoders, see their respective documentation sections.)
- frame_size integer (encoding,audio)
Set audio frame size.
Each submitted frame except the last must contain exactly frame_size samples per channel. May be 0 when the codec has CODEC_CAP_VARIABLE_FRAME_SIZE set, in that case the frame size is not restricted. It is set by some decoders to indicate constant frame size.
- frame_number integer
Set the frame number.
- delay integer
- qcomp float (encoding,video)
Set video quantizer scale compression (VBR). It is used as a constant in the ratecontrol equation. Recommended range for default rc_eq: 0.0-1.0.
- qblur float (encoding,video)
Set video quantizer scale blur (VBR).
- qmin integer (encoding,video)
Set min video quantizer scale (VBR). Must be included between -1 and 69, default value is 2.
- qmax integer (encoding,video)
Set max video quantizer scale (VBR). Must be included between -1 and 1024, default value is 31.
- qdiff integer (encoding,video)
Set max difference between the quantizer scale (VBR).
- bf integer (encoding,video)
Set max number of B frames between non-B-frames.
Must be an integer between -1 and 16. 0 means that B-frames are disabled. If a value of -1 is used, it will choose an automatic value depending on the encoder.
Default value is 0.
- b_qfactor float (encoding,video)
Set qp factor between P and B frames.
- codec_tag integer
- bug flags (decoding,video)
Workaround not auto detected encoder bugs.
Possible values:
- ‘autodetect’
- ‘xvid_ilace’
Xvid interlacing bug (autodetected if fourcc==XVIX)
- ‘ump4’
(autodetected if fourcc==UMP4)
- ‘no_padding’
padding bug (autodetected)
- ‘amv’
- ‘qpel_chroma’
- ‘std_qpel’
old standard qpel (autodetected per fourcc/version)
- ‘qpel_chroma2’
- ‘direct_blocksize’
direct-qpel-blocksize bug (autodetected per fourcc/version)
- ‘edge’
edge padding bug (autodetected per fourcc/version)
- ‘hpel_chroma’
- ‘dc_clip’
- ‘ms’
Workaround various bugs in microsoft broken decoders.
- ‘trunc’
trancated frames
- strict integer (decoding/encoding,audio,video)
Specify how strictly to follow the standards.
Possible values:
- ‘very’
strictly conform to an older more strict version of the spec or reference software
- ‘strict’
strictly conform to all the things in the spec no matter what consequences
- ‘normal’
- ‘unofficial’
allow unofficial extensions
- ‘experimental’
allow non standardized experimental things, experimental (unfinished/work in progress/not well tested) decoders and encoders. Note: experimental decoders can pose a security risk, do not use this for decoding untrusted input.
- b_qoffset float (encoding,video)
Set QP offset between P and B frames.
- err_detect flags (decoding,audio,video)
Set error detection flags.
Possible values:
- ‘crccheck’
verify embedded CRCs
- ‘bitstream’
detect bitstream specification deviations
- ‘buffer’
detect improper bitstream length
- ‘explode’
abort decoding on minor error detection
- ‘ignore_err’
ignore decoding errors, and continue decoding. This is useful if you want to analyze the content of a video and thus want everything to be decoded no matter what. This option will not result in a video that is pleasing to watch in case of errors.
- ‘careful’
consider things that violate the spec and have not been seen in the wild as errors
- ‘compliant’
consider all spec non compliancies as errors
- ‘aggressive’
consider things that a sane encoder should not do as an error
- has_b_frames integer
- block_align integer
- rc_override_count integer
- maxrate integer (encoding,audio,video)
Set max bitrate tolerance (in bits/s). Requires bufsize to be set.
- minrate integer (encoding,audio,video)
Set min bitrate tolerance (in bits/s). Most useful in setting up a CBR encode. It is of little use elsewise.
- bufsize integer (encoding,audio,video)
Set ratecontrol buffer size (in bits).
- i_qfactor float (encoding,video)
Set QP factor between P and I frames.
- i_qoffset float (encoding,video)
Set QP offset between P and I frames.
- dct integer (encoding,video)
Set DCT algorithm.
Possible values:
- ‘auto’
autoselect a good one (default)
- ‘fastint’
fast integer
- ‘int’
accurate integer
- ‘mmx’
- ‘altivec’
- ‘faan’
floating point AAN DCT
- lumi_mask float (encoding,video)
Compress bright areas stronger than medium ones.
- tcplx_mask float (encoding,video)
Set temporal complexity masking.
- scplx_mask float (encoding,video)
Set spatial complexity masking.
- p_mask float (encoding,video)
Set inter masking.
- dark_mask float (encoding,video)
Compress dark areas stronger than medium ones.
- idct integer (decoding/encoding,video)
Select IDCT implementation.
Possible values:
- ‘auto’
- ‘int’
- ‘simple’
- ‘simplemmx’
- ‘simpleauto’
Automatically pick a IDCT compatible with the simple one
- ‘arm’
- ‘altivec’
- ‘sh4’
- ‘simplearm’
- ‘simplearmv5te’
- ‘simplearmv6’
- ‘simpleneon’
- ‘xvid’
- ‘faani’
floating point AAN IDCT
- slice_count integer
- ec flags (decoding,video)
Set error concealment strategy.
Possible values:
- ‘guess_mvs’
iterative motion vector (MV) search (slow)
- ‘deblock’
use strong deblock filter for damaged MBs
- ‘favor_inter’
favor predicting from the previous frame instead of the current
- bits_per_coded_sample integer
- aspect rational number (encoding,video)
Set sample aspect ratio.
- sar rational number (encoding,video)
Set sample aspect ratio. Alias to aspect.
- debug flags (decoding/encoding,audio,video,subtitles)
Print specific debug info.
Possible values:
- ‘pict’
picture info
- ‘rc’
rate control
- ‘bitstream’
- ‘mb_type’
macroblock (MB) type
- ‘qp’
per-block quantization parameter (QP)
- ‘dct_coeff’
- ‘green_metadata’
display complexity metadata for the upcoming frame, GoP or for a given duration.
- ‘skip’
- ‘startcode’
- ‘er’
error recognition
- ‘mmco’
memory management control operations (H.264)
- ‘bugs’
- ‘buffers’
picture buffer allocations
- ‘thread_ops’
threading operations
- ‘nomc’
skip motion compensation
- cmp integer (encoding,video)
Set full pel me compare function.
Possible values:
- ‘sad’
sum of absolute differences, fast (default)
- ‘sse’
sum of squared errors
- ‘satd’
sum of absolute Hadamard transformed differences
- ‘dct’
sum of absolute DCT transformed differences
- ‘psnr’
sum of squared quantization errors (avoid, low quality)
- ‘bit’
number of bits needed for the block
- ‘rd’
rate distortion optimal, slow
- ‘zero’
0
- ‘vsad’
sum of absolute vertical differences
- ‘vsse’
sum of squared vertical differences
- ‘nsse’
noise preserving sum of squared differences
- ‘w53’
5/3 wavelet, only used in snow
- ‘w97’
9/7 wavelet, only used in snow
- ‘dctmax’
- ‘chroma’
- subcmp integer (encoding,video)
Set sub pel me compare function.
Possible values:
- ‘sad’
sum of absolute differences, fast (default)
- ‘sse’
sum of squared errors
- ‘satd’
sum of absolute Hadamard transformed differences
- ‘dct’
sum of absolute DCT transformed differences
- ‘psnr’
sum of squared quantization errors (avoid, low quality)
- ‘bit’
number of bits needed for the block
- ‘rd’
rate distortion optimal, slow
- ‘zero’
0
- ‘vsad’
sum of absolute vertical differences
- ‘vsse’
sum of squared vertical differences
- ‘nsse’
noise preserving sum of squared differences
- ‘w53’
5/3 wavelet, only used in snow
- ‘w97’
9/7 wavelet, only used in snow
- ‘dctmax’
- ‘chroma’
- mbcmp integer (encoding,video)
Set macroblock compare function.
Possible values:
- ‘sad’
sum of absolute differences, fast (default)
- ‘sse’
sum of squared errors
- ‘satd’
sum of absolute Hadamard transformed differences
- ‘dct’
sum of absolute DCT transformed differences
- ‘psnr’
sum of squared quantization errors (avoid, low quality)
- ‘bit’
number of bits needed for the block
- ‘rd’
rate distortion optimal, slow
- ‘zero’
0
- ‘vsad’
sum of absolute vertical differences
- ‘vsse’
sum of squared vertical differences
- ‘nsse’
noise preserving sum of squared differences
- ‘w53’
5/3 wavelet, only used in snow
- ‘w97’
9/7 wavelet, only used in snow
- ‘dctmax’
- ‘chroma’
- ildctcmp integer (encoding,video)
Set interlaced dct compare function.
Possible values:
- ‘sad’
sum of absolute differences, fast (default)
- ‘sse’
sum of squared errors
- ‘satd’
sum of absolute Hadamard transformed differences
- ‘dct’
sum of absolute DCT transformed differences
- ‘psnr’
sum of squared quantization errors (avoid, low quality)
- ‘bit’
number of bits needed for the block
- ‘rd’
rate distortion optimal, slow
- ‘zero’
0
- ‘vsad’
sum of absolute vertical differences
- ‘vsse’
sum of squared vertical differences
- ‘nsse’
noise preserving sum of squared differences
- ‘w53’
5/3 wavelet, only used in snow
- ‘w97’
9/7 wavelet, only used in snow
- ‘dctmax’
- ‘chroma’
- dia_size integer (encoding,video)
Set diamond type & size for motion estimation.
- ‘(1024, INT_MAX)’
full motion estimation(slowest)
- ‘(768, 1024]’
umh motion estimation
- ‘(512, 768]’
hex motion estimation
- ‘(256, 512]’
l2s diamond motion estimation
- ‘[2,256]’
var diamond motion estimation
- ‘(-1, 2)’
small diamond motion estimation
- ‘-1’
funny diamond motion estimation
- ‘(INT_MIN, -1)’
sab diamond motion estimation
- last_pred integer (encoding,video)
Set amount of motion predictors from the previous frame.
- precmp integer (encoding,video)
Set pre motion estimation compare function.
Possible values:
- ‘sad’
sum of absolute differences, fast (default)
- ‘sse’
sum of squared errors
- ‘satd’
sum of absolute Hadamard transformed differences
- ‘dct’
sum of absolute DCT transformed differences
- ‘psnr’
sum of squared quantization errors (avoid, low quality)
- ‘bit’
number of bits needed for the block
- ‘rd’
rate distortion optimal, slow
- ‘zero’
0
- ‘vsad’
sum of absolute vertical differences
- ‘vsse’
sum of squared vertical differences
- ‘nsse’
noise preserving sum of squared differences
- ‘w53’
5/3 wavelet, only used in snow
- ‘w97’
9/7 wavelet, only used in snow
- ‘dctmax’
- ‘chroma’
- pre_dia_size integer (encoding,video)
Set diamond type & size for motion estimation pre-pass.
- subq integer (encoding,video)
Set sub pel motion estimation quality.
- me_range integer (encoding,video)
Set limit motion vectors range (1023 for DivX player).
- global_quality integer (encoding,audio,video)
- slice_flags integer
- mbd integer (encoding,video)
Set macroblock decision algorithm (high quality mode).
Possible values:
- ‘simple’
use mbcmp (default)
- ‘bits’
use fewest bits
- ‘rd’
use best rate distortion
- rc_init_occupancy integer (encoding,video)
Set number of bits which should be loaded into the rc buffer before decoding starts.
- flags2 flags (decoding/encoding,audio,video,subtitles)
-
Possible values:
- ‘fast’
Allow non spec compliant speedup tricks.
- ‘noout’
Skip bitstream encoding.
- ‘ignorecrop’
Ignore cropping information from sps.
- ‘local_header’
Place global headers at every keyframe instead of in extradata.
- ‘chunks’
Frame data might be split into multiple chunks.
- ‘showall’
Show all frames before the first keyframe.
- ‘export_mvs’
Export motion vectors into frame side-data (see
AV_FRAME_DATA_MOTION_VECTORS) for codecs that support it. See also doc/examples/export_mvs.c.- ‘skip_manual’
Do not skip samples and export skip information as frame side data.
- ‘ass_ro_flush_noop’
Do not reset ASS ReadOrder field on flush.
- ‘icc_profiles’
Generate/parse embedded ICC profiles from/to colorimetry tags.
- export_side_data flags (decoding/encoding,audio,video,subtitles)
-
Possible values:
- ‘mvs’
Export motion vectors into frame side-data (see
AV_FRAME_DATA_MOTION_VECTORS) for codecs that support it. See also doc/examples/export_mvs.c.- ‘prft’
Export encoder Producer Reference Time into packet side-data (see
AV_PKT_DATA_PRFT) for codecs that support it.- ‘venc_params’
Export video encoding parameters through frame side data (see
AV_FRAME_DATA_VIDEO_ENC_PARAMS) for codecs that support it. At present, those are H.264 and VP9.- ‘film_grain’
Export film grain parameters through frame side data (see
AV_FRAME_DATA_FILM_GRAIN_PARAMS). Supported at present by AV1 decoders.- ‘enhancements’
Export picture enhancement metadata through frame side data, e.g. LCEVC (see
AV_FRAME_DATA_LCEVC).
- threads integer (decoding/encoding,video)
Set the number of threads to be used, in case the selected codec implementation supports multi-threading.
Possible values:
- ‘auto, 0’
automatically select the number of threads to set
Default value is ‘auto’.
- dc integer (encoding,video)
Set intra_dc_precision.
- nssew integer (encoding,video)
Set nsse weight.
- skip_top integer (decoding,video)
Set number of macroblock rows at the top which are skipped.
- skip_bottom integer (decoding,video)
Set number of macroblock rows at the bottom which are skipped.
- profile integer (encoding,audio,video)
-
Set encoder codec profile. Default value is ‘unknown’. Encoder specific profiles are documented in the relevant encoder documentation.
- level integer (encoding,audio,video)
-
Set the encoder level. This level depends on the specific codec, and might correspond to the profile level. It is set by default to ‘unknown’.
Possible values:
- ‘unknown’
- lowres integer (decoding,audio,video)
Decode at 1= 1/2, 2=1/4, 3=1/8 resolutions.
- mblmin integer (encoding,video)
Set min macroblock lagrange factor (VBR).
- mblmax integer (encoding,video)
Set max macroblock lagrange factor (VBR).
- skip_loop_filter integer (decoding,video)
- skip_idct integer (decoding,video)
- skip_frame integer (decoding,video)
-
Make decoder discard processing depending on the frame type selected by the option value.
skip_loop_filter skips frame loop filtering, skip_idct skips frame IDCT/dequantization, skip_frame skips decoding.
Possible values:
- ‘none’
Discard no frame.
- ‘default’
Discard useless frames like 0-sized frames.
- ‘noref’
Discard all non-reference frames.
- ‘bidir’
Discard all bidirectional frames.
- ‘nokey’
Discard all frames excepts keyframes.
- ‘nointra’
Discard all frames except I frames.
- ‘all’
Discard all frames.
Default value is ‘default’.
- bidir_refine integer (encoding,video)
Refine the two motion vectors used in bidirectional macroblocks.
- keyint_min integer (encoding,video)
Set minimum interval between IDR-frames.
- refs integer (encoding,video)
Set reference frames to consider for motion compensation.
- trellis integer (encoding,audio,video)
Set rate-distortion optimal quantization.
- mv0_threshold integer (encoding,video)
- compression_level integer (encoding,audio,video)
- bits_per_raw_sample integer
- channel_layout integer (decoding/encoding,audio)
See (ffmpeg-utils)the Channel Layout section in the ffmpeg-utils(1) manual for the required syntax.
- rc_max_vbv_use float (encoding,video)
- rc_min_vbv_use float (encoding,video)
- color_primaries integer (decoding/encoding,video)
Possible values:
- ‘bt709’
BT.709
- ‘bt470m’
BT.470 M
- ‘bt470bg’
BT.470 BG
- ‘smpte170m’
SMPTE 170 M
- ‘smpte240m’
SMPTE 240 M
- ‘film’
Film
- ‘bt2020’
BT.2020
- ‘smpte428’
- ‘smpte428_1’
SMPTE ST 428-1
- ‘smpte431’
SMPTE 431-2
- ‘smpte432’
SMPTE 432-1
- ‘jedec-p22’
JEDEC P22
- color_trc integer (decoding/encoding,video)
Possible values:
- ‘bt709’
BT.709
- ‘gamma22’
BT.470 M
- ‘gamma28’
BT.470 BG
- ‘smpte170m’
SMPTE 170 M
- ‘smpte240m’
SMPTE 240 M
- ‘linear’
Linear
- ‘log’
- ‘log100’
Log
- ‘log_sqrt’
- ‘log316’
Log square root
- ‘iec61966_2_4’
- ‘iec61966-2-4’
IEC 61966-2-4
- ‘bt1361’
- ‘bt1361e’
BT.1361
- ‘iec61966_2_1’
- ‘iec61966-2-1’
IEC 61966-2-1
- ‘bt2020_10’
- ‘bt2020_10bit’
BT.2020 - 10 bit
- ‘bt2020_12’
- ‘bt2020_12bit’
BT.2020 - 12 bit
- ‘smpte2084’
SMPTE ST 2084
- ‘smpte428’
- ‘smpte428_1’
SMPTE ST 428-1
- ‘arib-std-b67’
ARIB STD-B67
- colorspace integer (decoding/encoding,video)
Possible values:
- ‘rgb’
RGB
- ‘bt709’
BT.709
- ‘fcc’
FCC
- ‘bt470bg’
BT.470 BG
- ‘smpte170m’
SMPTE 170 M
- ‘smpte240m’
SMPTE 240 M
- ‘ycocg’
YCOCG
- ‘bt2020nc’
- ‘bt2020_ncl’
BT.2020 NCL
- ‘bt2020c’
- ‘bt2020_cl’
BT.2020 CL
- ‘smpte2085’
SMPTE 2085
- ‘chroma-derived-nc’
Chroma-derived NCL
- ‘chroma-derived-c’
Chroma-derived CL
- ‘ictcp’
ICtCp
- color_range integer (decoding/encoding,video)
If used as input parameter, it serves as a hint to the decoder, which color_range the input has. Possible values:
- ‘tv’
- ‘mpeg’
- ‘limited’
MPEG (219*2^(n-8))
- ‘pc’
- ‘jpeg’
- ‘full’
JPEG (2^n-1)
- chroma_sample_location integer (decoding/encoding,video)
Possible values:
- ‘left’
- ‘center’
- ‘topleft’
- ‘top’
- ‘bottomleft’
- ‘bottom’
- alpha_mode integer (decoding/encoding,video)
Possible values:
- ‘premultiplied’
- ‘straight’
- log_level_offset integer
Set the log level offset.
- slices integer (encoding,video)
Number of slices, used in parallelized encoding.
- thread_type flags (decoding/encoding,video)
Select which multithreading methods to use.
Use of ‘frame’ will increase decoding delay by one frame per thread, so clients which cannot provide future frames should not use it.
Possible values:
- ‘slice’
Decode more than one part of a single frame at once.
Multithreading using slices works only when the video was encoded with slices.
- ‘frame’
Decode more than one frame at once.
Default value is ‘slice+frame’.
- audio_service_type integer (encoding,audio)
Set audio service type.
Possible values:
- ‘ma’
Main Audio Service
- ‘ef’
Effects
- ‘vi’
Visually Impaired
- ‘hi’
Hearing Impaired
- ‘di’
Dialogue
- ‘co’
Commentary
- ‘em’
Emergency
- ‘vo’
Voice Over
- ‘ka’
Karaoke
- request_sample_fmt sample_fmt (decoding,audio)
Set sample format audio decoders should prefer. Default value is
none.- pkt_timebase rational number
- sub_charenc encoding (decoding,subtitles)
Set the input subtitles character encoding.
- field_order field_order (video)
Set/override the field order of the video. Possible values:
- ‘progressive’
Progressive video
- ‘tt’
Interlaced video, top field coded and displayed first
- ‘bb’
Interlaced video, bottom field coded and displayed first
- ‘tb’
Interlaced video, top coded first, bottom displayed first
- ‘bt’
Interlaced video, bottom coded first, top displayed first
- skip_alpha bool (decoding,video)
Set to 1 to disable processing alpha (transparency). This works like the ‘gray’ flag in the flags option which skips chroma information instead of alpha. Default is 0.
- codec_whitelist list (input)
"," separated list of allowed decoders. By default all are allowed.
- dump_separator string (input)
Separator used to separate the fields printed on the command line about the Stream parameters. For example, to separate the fields with newlines and indentation:
ffprobe -dump_separator " " -i ~/videos/matrixbench_mpeg2.mpg- max_pixels integer (decoding/encoding,video)
Maximum number of pixels per image. This value can be used to avoid out of memory failures due to large images.
- apply_cropping bool (decoding,video)
Enable cropping if cropping parameters are multiples of the required alignment for the left and top parameters. If the alignment is not met the cropping will be partially applied to maintain alignment. Default is 1 (enabled). Note: The required alignment depends on if
AV_CODEC_FLAG_UNALIGNEDis set and the CPU.AV_CODEC_FLAG_UNALIGNEDcannot be changed from the command line. Also hardware decoders will not apply left/top Cropping.
9 Decoders
Decoders are configured elements in FFmpeg which allow the decoding of multimedia streams.
When you configure your FFmpeg build, all the supported native decoders
are enabled by default. Decoders requiring an external library must be enabled
manually via the corresponding --enable-lib option. You can list all
available decoders using the configure option --list-decoders.
You can disable all the decoders with the configure option
--disable-decoders and selectively enable / disable single decoders
with the options --enable-decoder=DECODER /
--disable-decoder=DECODER.
The option -decoders of the ff* tools will display the list of
enabled decoders.
10 Video Decoders
A description of some of the currently available video decoders follows.
10.1 av1
AOMedia Video 1 (AV1) decoder.
10.1.1 Options
- operating_point
Select an operating point of a scalable AV1 bitstream (0 - 31). Default is 0.
10.2 hevc
HEVC (AKA ITU-T H.265 or ISO/IEC 23008-2) decoder.
The decoder supports MV-HEVC multiview streams with at most two views. Views to
be output are selected by supplying a list of view IDs to the decoder (the
view_ids option). This option may be set either statically before
decoder init, or from the get_format() callback - useful for the case
when the view count or IDs change dynamically during decoding.
Only the base layer is decoded by default.
Note that if you are using the ffmpeg CLI tool, you should be using view
specifiers as documented in its manual, rather than the options documented here.
10.2.1 Options
- view_ids (MV-HEVC)
Specify a list of view IDs that should be output. This option can also be set to a single ’-1’, which will cause all views defined in the VPS to be decoded and output.
- view_ids_available (MV-HEVC)
This option may be read by the caller to retrieve an array of view IDs available in the active VPS. The array is empty for single-layer video.
The value of this option is guaranteed to be accurate when read from the
get_format()callback. It may also be set at other times (e.g. after opening the decoder), but the value is informational only and may be incorrect (e.g. when the stream contains multiple distinct VPS NALUs).- view_pos_available (MV-HEVC)
This option may be read by the caller to retrieve an array of view positions (left, right, or unspecified) available in the active VPS, as
AVStereo3DViewvalues. When the array is available, its elements apply to the corresponding elements of view_ids_available, i.e.view_pos_available[i]contains the position of view with IDview_ids_available[i].Same validity restrictions as for view_ids_available apply to this option.
10.3 rawvideo
Raw video decoder.
This decoder decodes rawvideo streams.
10.3.1 Options
- top top_field_first
Specify the assumed field type of the input video.
- -1
the video is assumed to be progressive (default)
- 0
bottom-field-first is assumed
- 1
top-field-first is assumed
10.4 libdav1d
dav1d AV1 decoder.
libdav1d allows libavcodec to decode the AOMedia Video 1 (AV1) codec.
Requires the presence of the libdav1d headers and library during configuration.
You need to explicitly configure the build with --enable-libdav1d.
10.4.1 Options
The following options are supported by the libdav1d wrapper.
- max_frame_delay
Set max amount of frames the decoder may buffer internally. The default value is 0 (autodetect).
- filmgrain
Apply film grain to the decoded video if present in the bitstream. Defaults to the internal default of the library. This option is deprecated and will be removed in the future. See the global option
export_side_datato export Film Grain parameters instead of applying it.- oppoint
Select an operating point of a scalable AV1 bitstream (0 - 31). Defaults to the internal default of the library.
- alllayers
Output all spatial layers of a scalable AV1 bitstream. The default value is false.
10.5 libdavs2
AVS2-P2/IEEE1857.4 video decoder wrapper.
This decoder allows libavcodec to decode AVS2 streams with davs2 library.
10.6 libuavs3d
AVS3-P2/IEEE1857.10 video decoder.
libuavs3d allows libavcodec to decode AVS3 streams.
Requires the presence of the libuavs3d headers and library during configuration.
You need to explicitly configure the build with --enable-libuavs3d.
10.6.1 Options
The following option is supported by the libuavs3d wrapper.
- frame_threads
Set amount of frame threads to use during decoding. The default value is 0 (autodetect).
10.7 libxevd
eXtra-fast Essential Video Decoder (XEVD) MPEG-5 EVC decoder wrapper.
This decoder requires the presence of the libxevd headers and library during configuration. You need to explicitly configure the build with --enable-libxevd.
The xevd project website is at https://github.com/mpeg5/xevd.
10.7.1 Options
The following options are supported by the libxevd wrapper. The xevd-equivalent options or values are listed in parentheses for easy migration.
To get a more accurate and extensive documentation of the libxevd options,
invoke the command xevd_app --help or consult the libxevd documentation.
- threads (threads)
Force to use a specific number of threads
10.8 QSV Decoders
The family of Intel QuickSync Video decoders (VC1, MPEG-2, H.264, HEVC, JPEG/MJPEG, VP8, VP9, AV1, VVC).
10.8.1 Common Options
The following options are supported by all qsv decoders.
- async_depth
Internal parallelization depth, the higher the value the higher the latency.
- gpu_copy
A GPU-accelerated copy between video and system memory
- ‘default’
- ‘on’
- ‘off’
10.8.2 HEVC Options
Extra options for hevc_qsv.
- load_plugin
A user plugin to load in an internal session
- ‘none’
- ‘hevc_sw’
- ‘hevc_hw’
- load_plugins
A :-separate list of hexadecimal plugin UIDs to load in an internal session
10.9 v210
Uncompressed 4:2:2 10-bit decoder.
10.9.1 Options
- custom_stride
Set the line size of the v210 data in bytes. The default value is 0 (autodetect). You can use the special -1 value for a strideless v210 as seen in BOXX files.
11 Audio Decoders
A description of some of the currently available audio decoders follows.
11.1 ac3
AC-3 audio decoder.
This decoder implements part of ATSC A/52:2010 and ETSI TS 102 366, as well as the undocumented RealAudio 3 (a.k.a. dnet).
11.1.1 AC-3 Decoder Options
- -drc_scale value
Dynamic Range Scale Factor. The factor to apply to dynamic range values from the AC-3 stream. This factor is applied exponentially. The default value is 1. There are 3 notable scale factor ranges:
- drc_scale == 0
DRC disabled. Produces full range audio.
- 0 < drc_scale <= 1
DRC enabled. Applies a fraction of the stream DRC value. Audio reproduction is between full range and full compression.
- drc_scale > 1
DRC enabled. Applies drc_scale asymmetrically. Loud sounds are fully compressed. Soft sounds are enhanced.
11.2 flac
FLAC audio decoder.
This decoder aims to implement the complete FLAC specification from Xiph.
11.2.1 FLAC Decoder options
- -use_buggy_lpc
The lavc FLAC encoder used to produce buggy streams with high lpc values (like the default value). This option makes it possible to decode such streams correctly by using lavc’s old buggy lpc logic for decoding.
11.3 ffwavesynth
Internal wave synthesizer.
This decoder generates wave patterns according to predefined sequences. Its use is purely internal and the format of the data it accepts is not publicly documented.
11.4 libcelt
libcelt decoder wrapper.
libcelt allows libavcodec to decode the Xiph CELT ultra-low delay audio codec.
Requires the presence of the libcelt headers and library during configuration.
You need to explicitly configure the build with --enable-libcelt.
11.5 libgsm
libgsm decoder wrapper.
libgsm allows libavcodec to decode the GSM full rate audio codec. Requires
the presence of the libgsm headers and library during configuration. You need
to explicitly configure the build with --enable-libgsm.
This decoder supports both the ordinary GSM and the Microsoft variant.
11.6 libilbc
libilbc decoder wrapper.
libilbc allows libavcodec to decode the Internet Low Bitrate Codec (iLBC)
audio codec. Requires the presence of the libilbc headers and library during
configuration. You need to explicitly configure the build with
--enable-libilbc.
11.6.1 Options
The following option is supported by the libilbc wrapper.
- enhance
-
Enable the enhancement of the decoded audio when set to 1. The default value is 0 (disabled).
11.7 libmpeghdec
libmpeghdec decoder wrapper.
libmpeghdec allows libmpeghdec to decode the MPEG-H 3D audio codec.
Requires the presence of the libmpeghdec headers and library during
configuration. You need to explicitly configure the build with
--enable-libmpeghdec --enable-nonfree.
11.8 libopencore-amrnb
libopencore-amrnb decoder wrapper.
libopencore-amrnb allows libavcodec to decode the Adaptive Multi-Rate
Narrowband audio codec. Using it requires the presence of the
libopencore-amrnb headers and library during configuration. You need to
explicitly configure the build with --enable-libopencore-amrnb.
An FFmpeg native decoder for AMR-NB exists, so users can decode AMR-NB without this library.
11.9 libopencore-amrwb
libopencore-amrwb decoder wrapper.
libopencore-amrwb allows libavcodec to decode the Adaptive Multi-Rate
Wideband audio codec. Using it requires the presence of the
libopencore-amrwb headers and library during configuration. You need to
explicitly configure the build with --enable-libopencore-amrwb.
An FFmpeg native decoder for AMR-WB exists, so users can decode AMR-WB without this library.
11.10 libopus
libopus decoder wrapper.
libopus allows libavcodec to decode the Opus Interactive Audio Codec.
Requires the presence of the libopus headers and library during
configuration. You need to explicitly configure the build with
--enable-libopus.
An FFmpeg native decoder for Opus exists, so users can decode Opus without this library.
12 Subtitles Decoders
12.1 libaribb24
ARIB STD-B24 caption decoder.
Implements profiles A and C of the ARIB STD-B24 standard.
12.1.1 libaribb24 Decoder Options
- -aribb24-base-path path
Sets the base path for the libaribb24 library. This is utilized for reading of configuration files (for custom unicode conversions), and for dumping of non-text symbols as images under that location.
Unset by default.
- -aribb24-skip-ruby-text boolean
Tells the decoder wrapper to skip text blocks that contain half-height ruby text.
Enabled by default.
12.2 libaribcaption
Yet another ARIB STD-B24 caption decoder using external libaribcaption library.
Implements profiles A and C of the Japanese ARIB STD-B24 standard, Brazilian ABNT NBR 15606-1, and Philippines version of ISDB-T.
Requires the presence of the libaribcaption headers and library
(https://github.com/xqq/libaribcaption) during configuration.
You need to explicitly configure the build with --enable-libaribcaption.
If both libaribb24 and libaribcaption are enabled, libaribcaption
decoder precedes.
12.2.1 libaribcaption Decoder Options
- -sub_type subtitle_type
Specifies the format of the decoded subtitles.
- ‘bitmap’
Graphical image.
- ‘ass’
ASS formatted text.
- ‘text’
Simple text based output without formatting.
The default is ass as same as libaribb24 decoder. Some present players (e.g., mpv) expect ASS format for ARIB caption.
- -caption_encoding encoding_scheme
Specifies the encoding scheme of input subtitle text.
- ‘auto’
Automatically detect text encoding (default).
- ‘jis’
8bit-char JIS encoding defined in ARIB STD B24. This encoding used in Japan for ISDB captions.
- ‘utf8’
UTF-8 encoding defined in ARIB STD B24. This encoding is used in Philippines for ISDB-T captions.
- ‘latin’
Latin character encoding defined in ABNT NBR 15606-1. This encoding is used in South America for SBTVD / ISDB-Tb captions.
- -font font_name[,font_name2,...]
Specify comma-separated list of font family names to be used for bitmap or ass type subtitle rendering. Only first font name is used for ass type subtitle.
If not specified, use internally defined default font family.
- -ass_single_rect boolean
ARIB STD-B24 specifies that some captions may be displayed at different positions at a time (multi-rectangle subtitle). Since some players (e.g., old mpv) can’t handle multiple ASS rectangles in a single AVSubtitle, or multiple ASS rectangles of indeterminate duration with the same start timestamp, this option can change the behavior so that all the texts are displayed in a single ASS rectangle.
The default is false.
If your player cannot handle AVSubtitles with multiple ASS rectangles properly, set this option to true or define
ASS_SINGLE_RECT=1to change default behavior at compilation.- -force_outline_text boolean
Specify whether always render outline text for all characters regardless of the indication by character style.
The default is false.
- -outline_width number (0.0 - 3.0)
Specify width for outline text, in dots (relative).
The default is 1.5.
- -ignore_background boolean
Specify whether to ignore background color rendering.
The default is false.
- -ignore_ruby boolean
Specify whether to ignore rendering for ruby-like (furigana) characters.
The default is false.
- -replace_drcs boolean
Specify whether to render replaced DRCS characters as Unicode characters.
The default is true.
- -replace_msz_ascii boolean
Specify whether to replace MSZ (Middle Size; half width) fullwidth alphanumerics with halfwidth alphanumerics.
The default is true.
- -replace_msz_japanese boolean
Specify whether to replace some MSZ (Middle Size; half width) fullwidth japanese special characters with halfwidth ones.
The default is true.
- -replace_msz_glyph boolean
Specify whether to replace MSZ (Middle Size; half width) characters with halfwidth glyphs if the fonts supports it. This option works under FreeType or DirectWrite renderer with Adobe-Japan1 compliant fonts. e.g., IBM Plex Sans JP, Morisawa BIZ UDGothic, Morisawa BIZ UDMincho, Yu Gothic, Yu Mincho, and Meiryo.
The default is true.
- -canvas_size image_size
Specify the resolution of the canvas to render subtitles to; usually, this should be frame size of input video. This only applies when
-subtitle_typeis set to bitmap.The libaribcaption decoder assumes input frame size for bitmap rendering as below:
- PROFILE_A : 1440 x 1080 with SAR (PAR) 4:3
- PROFILE_C : 320 x 180 with SAR (PAR) 1:1
If actual frame size of input video does not match above assumption, the rendered captions may be distorted. To make the captions undistorted, add
-canvas_sizeoption to specify actual input video size.Note that the
-canvas_sizeoption is not required for video with different size but same aspect ratio. In such cases, the caption will be stretched or shrunk to actual video size if-canvas_sizeoption is not specified. If-canvas_sizeoption is specified with different size, the caption will be stretched or shrunk as specified size with calculated SAR.
12.2.2 libaribcaption decoder usage examples
Display MPEG-TS file with ARIB subtitle by ffplay tool:
ffplay -sub_type bitmap MPEG.TS
Display MPEG-TS file with input frame size 1920x1080 by ffplay tool:
ffplay -sub_type bitmap -canvas_size 1920x1080 MPEG.TS
Embed ARIB subtitle in transcoded video:
ffmpeg -sub_type bitmap -i src.m2t -filter_complex "[0:v][0:s]overlay" -vcodec h264 dest.mp4
12.3 dvbsub
12.3.1 Options
- compute_clut
- -2
Compute clut once if no matching CLUT is in the stream.
- -1
Compute clut if no matching CLUT is in the stream.
- 0
Never compute CLUT
- 1
Always compute CLUT and override the one provided in the stream.
- dvb_substream
Selects the dvb substream, or all substreams if -1 which is default.
12.4 dvdsub
This codec decodes the bitmap subtitles used in DVDs; the same subtitles can also be found in VobSub file pairs and in some Matroska files.
12.4.1 Options
- palette
Specify the global palette used by the bitmaps. When stored in VobSub, the palette is normally specified in the index file; in Matroska, the palette is stored in the codec extra-data in the same format as in VobSub. In DVDs, the palette is stored in the IFO file, and therefore not available when reading from dumped VOB files.
The format for this option is a string containing 16 24-bits hexadecimal numbers (without 0x prefix) separated by commas, for example
0d00ee, ee450d, 101010, eaeaea, 0ce60b, ec14ed, ebff0b, 0d617a, 7b7b7b, d1d1d1, 7b2a0e, 0d950c, 0f007b, cf0dec, cfa80c, 7c127b.- ifo_palette
Specify the IFO file from which the global palette is obtained. (experimental)
- forced_subs_only
Only decode subtitle entries marked as forced. Some titles have forced and non-forced subtitles in the same track. Setting this flag to
1will only keep the forced subtitles. Default value is0.
12.5 libzvbi-teletext
Libzvbi allows libavcodec to decode DVB teletext pages and DVB teletext
subtitles. Requires the presence of the libzvbi headers and library during
configuration. You need to explicitly configure the build with
--enable-libzvbi.
12.5.1 Options
- txt_page
List of teletext page numbers to decode. Pages that do not match the specified list are dropped. You may use the special
*string to match all pages, orsubtitleto match all subtitle pages. Default value is *.- txt_default_region
Set default character set used for decoding, a value between 0 and 87 (see ETS 300 706, Section 15, Table 32). Default value is -1, which does not override the libzvbi default. This option is needed for some legacy level 1.0 transmissions which cannot signal the proper charset.
- txt_chop_top
Discards the top teletext line. Default value is 1.
- txt_format
Specifies the format of the decoded subtitles.
- bitmap
The default format, you should use this for teletext pages, because certain graphics and colors cannot be expressed in simple text or even ASS.
- text
Simple text based output without formatting.
- ass
Formatted ASS output, subtitle pages and teletext pages are returned in different styles, subtitle pages are stripped down to text, but an effort is made to keep the text alignment and the formatting.
- txt_left
X offset of generated bitmaps, default is 0.
- txt_top
Y offset of generated bitmaps, default is 0.
- txt_chop_spaces
Chops leading and trailing spaces and removes empty lines from the generated text. This option is useful for teletext based subtitles where empty spaces may be present at the start or at the end of the lines or empty lines may be present between the subtitle lines because of double-sized teletext characters. Default value is 1.
- txt_duration
Sets the display duration of the decoded teletext pages or subtitles in milliseconds. Default value is -1 which means infinity or until the next subtitle event comes.
- txt_transparent
Force transparent background of the generated teletext bitmaps. Default value is 0 which means an opaque background.
- txt_opacity
Sets the opacity (0-255) of the teletext background. If txt_transparent is not set, it only affects characters between a start box and an end box, typically subtitles. Default value is 0 if txt_transparent is set, 255 otherwise.
13 Bitstream Filters
When you configure your FFmpeg build, all the supported bitstream
filters are enabled by default. You can list all available ones using
the configure option --list-bsfs.
You can disable all the bitstream filters using the configure option
--disable-bsfs, and selectively enable any bitstream filter using
the option --enable-bsf=BSF, or you can disable a particular
bitstream filter using the option --disable-bsf=BSF.
The option -bsfs of the ff* tools will display the list of
all the supported bitstream filters included in your build.
The ff* tools have a -bsf option applied per stream, taking a comma-separated list of filters, whose parameters follow the filter name after a ’=’.
ffmpeg -i INPUT -c:v copy -bsf:v filter1[=opt1=str1:opt2=str2][,filter2] OUTPUT
Below is a description of the currently available bitstream filters, with their parameters, if any.
13.1 aac_adtstoasc
Convert MPEG-2/4 AAC ADTS to an MPEG-4 Audio Specific Configuration bitstream.
This filter creates an MPEG-4 AudioSpecificConfig from an MPEG-2/4 ADTS header and removes the ADTS header.
This filter is required for example when copying an AAC stream from a raw ADTS AAC or an MPEG-TS container to MP4A-LATM, to an FLV file, or to MOV/MP4 files and related formats such as 3GP or M4A. Please note that it is auto-inserted for MP4A-LATM and MOV/MP4 and related formats.
13.2 av1_metadata
Modify metadata embedded in an AV1 stream.
- td
Insert or remove temporal delimiter OBUs in all temporal units of the stream.
- ‘insert’
Insert a TD at the beginning of every TU which does not already have one.
- ‘remove’
Remove the TD from the beginning of every TU which has one.
- color_primaries
- transfer_characteristics
- matrix_coefficients
Set the color description fields in the stream (see AV1 section 6.4.2).
- color_range
Set the color range in the stream (see AV1 section 6.4.2; note that this cannot be set for streams using BT.709 primaries, sRGB transfer characteristic and identity (RGB) matrix coefficients).
- ‘tv’
Limited range.
- ‘pc’
Full range.
- chroma_sample_position
Set the chroma sample location in the stream (see AV1 section 6.4.2). This can only be set for 4:2:0 streams.
- ‘vertical’
Left position (matching the default in MPEG-2 and H.264).
- ‘colocated’
Top-left position.
- tick_rate
Set the tick rate (time_scale / num_units_in_display_tick) in the timing info in the sequence header.
- num_ticks_per_picture
Set the number of ticks in each picture, to indicate that the stream has a fixed framerate. Ignored if tick_rate is not also set.
- delete_padding
Deletes Padding OBUs.
13.3 chomp
Remove zero padding at the end of a packet.
13.4 dca_core
Extract the core from a DCA/DTS stream, dropping extensions such as DTS-HD.
13.5 dovi_rpu
Manipulate Dolby Vision metadata in a HEVC/AV1 bitstream, optionally enabling metadata compression.
- strip
If enabled, strip all Dolby Vision metadata (configuration record + RPU data blocks) from the stream.
- compression
Which compression level to enable.
- ‘none’
No metadata compression.
- ‘limited’
Limited metadata compression scheme. Should be compatible with most devices. This is the default.
- ‘extended’
Extended metadata compression. Devices are not required to support this. Note that this level currently behaves the same as ‘limited’ in libavcodec.
13.6 dump_extra
Add extradata to the beginning of the filtered packets except when said packets already exactly begin with the extradata that is intended to be added.
- freq
The additional argument specifies which packets should be filtered. It accepts the values:
- ‘k’
- ‘keyframe’
add extradata to all key packets
- ‘e’
- ‘all’
add extradata to all packets
If not specified it is assumed ‘k’.
For example the following ffmpeg command forces a global
header (thus disabling individual packet headers) in the H.264 packets
generated by the libx264 encoder, but corrects them by adding
the header stored in extradata to the key packets:
ffmpeg -i INPUT -map 0 -flags:v +global_header -c:v libx264 -bsf:v dump_extra out.ts
13.7 dv_error_marker
Blocks in DV which are marked as damaged are replaced by blocks of the specified color.
- color
The color to replace damaged blocks by
- sta
A 16 bit mask which specifies which of the 16 possible error status values are to be replaced by colored blocks. 0xFFFE is the default which replaces all non 0 error status values.
- ‘ok’
No error, no concealment
- ‘err’
Error, No concealment
- ‘res’
Reserved
- ‘notok’
Error or concealment
- ‘notres’
Not reserved
- ‘Aa, Ba, Ca, Ab, Bb, Cb, A, B, C, a, b, erri, erru’
The specific error status code
13.8 eac3_core
Extract the core from a E-AC-3 stream, dropping extra channels.
13.9 eia608_to_smpte436m
Convert from a EIA_608 stream to a SMPTE_436M_ANC data stream, wrapping the closed captions in CTA-708 CDP VANC packets.
- line_number
Choose which line number the generated VANC packets should go on. You generally want either line 9 (the default) or 11.
- wrapping_type
Choose the SMPTE 436M wrapping type, defaults to ‘vanc_frame’. It accepts the values:
- ‘vanc_frame’
VANC frame (interlaced or segmented progressive frame)
- ‘vanc_field_1’
- ‘vanc_field_2’
- ‘vanc_progressive_frame’
- sample_coding
Choose the SMPTE 436M sample coding, defaults to ‘8bit_luma’. It accepts the values:
- ‘8bit_luma’
8-bit component luma samples
- ‘8bit_color_diff’
8-bit component color difference samples
- ‘8bit_luma_and_color_diff’
8-bit component luma and color difference samples
- ‘10bit_luma’
10-bit component luma samples
- ‘10bit_color_diff’
10-bit component color difference samples
- ‘10bit_luma_and_color_diff’
10-bit component luma and color difference samples
- ‘8bit_luma_parity_error’
8-bit component luma samples with parity error
- ‘8bit_color_diff_parity_error’
8-bit component color difference samples with parity error
- ‘8bit_luma_and_color_diff_parity_error’
8-bit component luma and color difference samples with parity error
- initial_cdp_sequence_cntr
The initial value of the CDP’s 16-bit unsigned integer
cdp_hdr_sequence_cntrandcdp_ftr_sequence_cntrfields. Defaults to 0.- cdp_frame_rate
Set the CDP’s
cdp_frame_ratefield. This doesn’t actually change the timing of the data stream, it just changes the values inserted in that field in the generated CDP packets. Defaults to ‘30000/1001’.
13.10 extract_extradata
Extract the in-band extradata.
Certain codecs allow the long-term headers (e.g. MPEG-2 sequence headers, or H.264/HEVC (VPS/)SPS/PPS) to be transmitted either "in-band" (i.e. as a part of the bitstream containing the coded frames) or "out of band" (e.g. on the container level). This latter form is called "extradata" in FFmpeg terminology.
This bitstream filter detects the in-band headers and makes them available as extradata.
- remove
When this option is enabled, the long-term headers are removed from the bitstream after extraction.
13.11 filter_units
Remove units with types in or not in a given set from the stream.
- pass_types
List of unit types or ranges of unit types to pass through while removing all others. This is specified as a ’|’-separated list of unit type values or ranges of values with ’-’.
- remove_types
Identical to pass_types, except the units in the given set removed and all others passed through.
The types used by pass_types and remove_types correspond to NAL unit types (nal_unit_type) in H.264, HEVC and H.266 (see Table 7-1 in the H.264 and HEVC specifications or Table 5 in the H.266 specification), to marker values for JPEG (without 0xFF prefix) and to start codes without start code prefix (i.e. the byte following the 0x000001) for MPEG-2. For VP8 and VP9, every unit has type zero.
Extradata is unchanged by this transformation, but note that if the stream contains inline parameter sets then the output may be unusable if they are removed.
For example, to remove all non-VCL NAL units from an H.264 stream:
ffmpeg -i INPUT -c:v copy -bsf:v 'filter_units=pass_types=1-5' OUTPUT
To remove all AUDs, SEI and filler from an H.265 stream:
ffmpeg -i INPUT -c:v copy -bsf:v 'filter_units=remove_types=35|38-40' OUTPUT
To remove all user data from a MPEG-2 stream, including Closed Captions:
ffmpeg -i INPUT -c:v copy -bsf:v 'filter_units=remove_types=178' OUTPUT
To remove all SEI from a H264 stream, including Closed Captions:
ffmpeg -i INPUT -c:v copy -bsf:v 'filter_units=remove_types=6' OUTPUT
To remove all prefix and suffix SEI from a HEVC stream, including Closed Captions and dynamic HDR:
ffmpeg -i INPUT -c:v copy -bsf:v 'filter_units=remove_types=39|40' OUTPUT
13.12 hapqa_extract
Extract Rgb or Alpha part of an HAPQA file, without recompression, in order to create an HAPQ or an HAPAlphaOnly file.
- texture
Specifies the texture to keep.
- color
- alpha
Convert HAPQA to HAPQ
ffmpeg -i hapqa_inputfile.mov -c copy -bsf:v hapqa_extract=texture=color -tag:v HapY -metadata:s:v:0 encoder="HAPQ" hapq_file.mov
Convert HAPQA to HAPAlphaOnly
ffmpeg -i hapqa_inputfile.mov -c copy -bsf:v hapqa_extract=texture=alpha -tag:v HapA -metadata:s:v:0 encoder="HAPAlpha Only" hapalphaonly_file.mov
13.13 h264_metadata
Modify metadata embedded in an H.264 stream.
- aud
Insert or remove AUD NAL units in all access units of the stream.
- ‘pass’
- ‘insert’
- ‘remove’
Default is pass.
- sample_aspect_ratio
Set the sample aspect ratio of the stream in the VUI parameters. See H.264 table E-1.
- overscan_appropriate_flag
Set whether the stream is suitable for display using overscan or not (see H.264 section E.2.1).
- video_format
- video_full_range_flag
Set the video format in the stream (see H.264 section E.2.1 and table E-2).
- colour_primaries
- transfer_characteristics
- matrix_coefficients
Set the colour description in the stream (see H.264 section E.2.1 and tables E-3, E-4 and E-5).
- chroma_sample_loc_type
Set the chroma sample location in the stream (see H.264 section E.2.1 and figure E-1).
- tick_rate
Set the tick rate (time_scale / num_units_in_tick) in the VUI parameters. This is the smallest time unit representable in the stream, and in many cases represents the field rate of the stream (double the frame rate).
- fixed_frame_rate_flag
Set whether the stream has fixed framerate - typically this indicates that the framerate is exactly half the tick rate, but the exact meaning is dependent on interlacing and the picture structure (see H.264 section E.2.1 and table E-6).
- zero_new_constraint_set_flags
Zero constraint_set4_flag and constraint_set5_flag in the SPS. These bits were reserved in a previous version of the H.264 spec, and thus some hardware decoders require these to be zero. The result of zeroing this is still a valid bitstream.
- crop_left
- crop_right
- crop_top
- crop_bottom
Set the frame cropping offsets in the SPS. These values will replace the current ones if the stream is already cropped.
These fields are set in pixels. Note that some sizes may not be representable if the chroma is subsampled or the stream is interlaced (see H.264 section 7.4.2.1.1).
- sei_user_data
Insert a string as SEI unregistered user data. The argument must be of the form UUID+string, where the UUID is as hex digits possibly separated by hyphens, and the string can be anything.
For example, ‘086f3693-b7b3-4f2c-9653-21492feee5b8+hello’ will insert the string “hello” associated with the given UUID.
- delete_filler
Deletes both filler NAL units and filler SEI messages.
- display_orientation
Insert, extract or remove Display orientation SEI messages. See H.264 section D.1.27 and D.2.27 for syntax and semantics.
- ‘pass’
- ‘insert’
- ‘remove’
- ‘extract’
Default is pass.
Insert mode works in conjunction with
rotateandflipoptions. Any pre-existing Display orientation messages will be removed in insert or remove mode. Extract mode attaches the display matrix to the packet as side data.- rotate
Set rotation in display orientation SEI (anticlockwise angle in degrees). Range is -360 to +360. Default is NaN.
- flip
Set flip in display orientation SEI.
- ‘horizontal’
- ‘vertical’
Default is unset.
- level
Set the level in the SPS. Refer to H.264 section A.3 and tables A-1 to A-5.
The argument must be the name of a level (for example, ‘4.2’), a level_idc value (for example, ‘42’), or the special name ‘auto’ indicating that the filter should attempt to guess the level from the input stream properties.
13.14 h264_mp4toannexb
Convert an H.264 bitstream from length prefixed mode to start code prefixed mode (as defined in the Annex B of the ITU-T H.264 specification).
This is required by some streaming formats, typically the MPEG-2
transport stream format (muxer mpegts).
For example to remux an MP4 file containing an H.264 stream to mpegts
format with ffmpeg, you can use the command:
ffmpeg -i INPUT.mp4 -codec copy -bsf:v h264_mp4toannexb OUTPUT.ts
Please note that this filter is auto-inserted for MPEG-TS (muxer
mpegts) and raw H.264 (muxer h264) output formats.
13.15 h264_redundant_pps
This applies a specific fixup to some Blu-ray BDMV H264 streams which contain redundant PPSs. The PPSs modify irrelevant parameters of the stream, confusing other transformations which require the correct extradata.
The encoder used on these impacted streams adds extra PPSs throughout the stream, varying the initial QP and whether weighted prediction was enabled. This causes issues after copying the stream into a global header container, as the starting PPS is not suitable for the rest of the stream. One side effect, for example, is seeking will return garbled output until a new PPS appears.
This BSF removes the extra PPSs and rewrites the slice headers such that the stream uses a single leading PPS in the global header, which resolves the issue.
13.16 hevc_metadata
Modify metadata embedded in an HEVC stream.
- aud
Insert or remove AUD NAL units in all access units of the stream.
- ‘insert’
- ‘remove’
- sample_aspect_ratio
Set the sample aspect ratio in the stream in the VUI parameters.
- video_format
- video_full_range_flag
Set the video format in the stream (see H.265 section E.3.1 and table E.2).
- colour_primaries
- transfer_characteristics
- matrix_coefficients
Set the colour description in the stream (see H.265 section E.3.1 and tables E.3, E.4 and E.5).
- chroma_sample_loc_type
Set the chroma sample location in the stream (see H.265 section E.3.1 and figure E.1).
- tick_rate
Set the tick rate in the VPS and VUI parameters (time_scale / num_units_in_tick). Combined with num_ticks_poc_diff_one, this can set a constant framerate in the stream. Note that it is likely to be overridden by container parameters when the stream is in a container.
- num_ticks_poc_diff_one
Set poc_proportional_to_timing_flag in VPS and VUI and use this value to set num_ticks_poc_diff_one_minus1 (see H.265 sections 7.4.3.1 and E.3.1). Ignored if tick_rate is not also set.
- crop_left
- crop_right
- crop_top
- crop_bottom
Set the conformance window cropping offsets in the SPS. These values will replace the current ones if the stream is already cropped.
These fields are set in pixels. Note that some sizes may not be representable if the chroma is subsampled (H.265 section 7.4.3.2.1).
- width
- height
Set width and height after crop.
- level
Set the level in the VPS and SPS. See H.265 section A.4 and tables A.6 and A.7.
The argument must be the name of a level (for example, ‘5.1’), a general_level_idc value (for example, ‘153’ for level 5.1), or the special name ‘auto’ indicating that the filter should attempt to guess the level from the input stream properties.
13.17 hevc_mp4toannexb
Convert an HEVC/H.265 bitstream from length prefixed mode to start code prefixed mode (as defined in the Annex B of the ITU-T H.265 specification).
This is required by some streaming formats, typically the MPEG-2
transport stream format (muxer mpegts).
For example to remux an MP4 file containing an HEVC stream to mpegts
format with ffmpeg, you can use the command:
ffmpeg -i INPUT.mp4 -codec copy -bsf:v hevc_mp4toannexb OUTPUT.ts
Please note that this filter is auto-inserted for MPEG-TS (muxer
mpegts) and raw HEVC/H.265 (muxer h265 or
hevc) output formats.
13.18 imxdump
Modifies the bitstream to fit in MOV and to be usable by the Final Cut Pro decoder. This filter only applies to the mpeg2video codec, and is likely not needed for Final Cut Pro 7 and newer with the appropriate -tag:v.
For example, to remux 30 MB/sec NTSC IMX to MOV:
ffmpeg -i input.mxf -c copy -bsf:v imxdump -tag:v mx3n output.mov
13.19 mjpeg2jpeg
Convert MJPEG/AVI1 packets to full JPEG/JFIF packets.
MJPEG is a video codec wherein each video frame is essentially a JPEG image. The individual frames can be extracted without loss, e.g. by
ffmpeg -i ../some_mjpeg.avi -c:v copy frames_%d.jpg
Unfortunately, these chunks are incomplete JPEG images, because they lack the DHT segment required for decoding. Quoting from http://www.digitalpreservation.gov/formats/fdd/fdd000063.shtml:
Avery Lee, writing in the rec.video.desktop newsgroup in 2001, commented that "MJPEG, or at least the MJPEG in AVIs having the MJPG fourcc, is restricted JPEG with a fixed – and *omitted* – Huffman table. The JPEG must be YCbCr colorspace, it must be 4:2:2, and it must use basic Huffman encoding, not arithmetic or progressive. . . . You can indeed extract the MJPEG frames and decode them with a regular JPEG decoder, but you have to prepend the DHT segment to them, or else the decoder won’t have any idea how to decompress the data. The exact table necessary is given in the OpenDML spec."
This bitstream filter patches the header of frames extracted from an MJPEG stream (carrying the AVI1 header ID and lacking a DHT segment) to produce fully qualified JPEG images.
ffmpeg -i mjpeg-movie.avi -c:v copy -bsf:v mjpeg2jpeg frame_%d.jpg exiftran -i -9 frame*.jpg ffmpeg -i frame_%d.jpg -c:v copy rotated.avi
13.20 mjpegadump
Add an MJPEG A header to the bitstream, to enable decoding by Quicktime.
13.21 mov2textsub
Extract a representable text file from MOV subtitles, stripping the metadata header from each subtitle packet.
See also the text2movsub filter.
13.22 mpeg2_metadata
Modify metadata embedded in an MPEG-2 stream.
- display_aspect_ratio
Set the display aspect ratio in the stream.
The following fixed values are supported:
- 4/3
- 16/9
- 221/100
Any other value will result in square pixels being signalled instead (see H.262 section 6.3.3 and table 6-3).
- frame_rate
Set the frame rate in the stream. This is constructed from a table of known values combined with a small multiplier and divisor - if the supplied value is not exactly representable, the nearest representable value will be used instead (see H.262 section 6.3.3 and table 6-4).
- video_format
Set the video format in the stream (see H.262 section 6.3.6 and table 6-6).
- colour_primaries
- transfer_characteristics
- matrix_coefficients
Set the colour description in the stream (see H.262 section 6.3.6 and tables 6-7, 6-8 and 6-9).
13.23 mpeg4_unpack_bframes
Unpack DivX-style packed B-frames.
DivX-style packed B-frames are not valid MPEG-4 and were only a workaround for the broken Video for Windows subsystem. They use more space, can cause minor AV sync issues, require more CPU power to decode (unless the player has some decoded picture queue to compensate the 2,0,2,0 frame per packet style) and cause trouble if copied into a standard container like mp4 or mpeg-ps/ts, because MPEG-4 decoders may not be able to decode them, since they are not valid MPEG-4.
For example to fix an AVI file containing an MPEG-4 stream with
DivX-style packed B-frames using ffmpeg, you can use the command:
ffmpeg -i INPUT.avi -codec copy -bsf:v mpeg4_unpack_bframes OUTPUT.avi
13.24 noise
Damages the contents of packets or simply drops them without damaging the container. Can be used for fuzzing or testing error resilience/concealment.
Parameters:
- amount
Accepts an expression whose evaluation per-packet determines how often bytes in that packet will be modified. A value below 0 will result in a variable frequency. Default is 0 which results in no modification. However, if neither amount nor drop is specified, amount will be set to -1. See below for accepted variables.
- drop
Accepts an expression evaluated per-packet whose value determines whether that packet is dropped. Evaluation to a positive value results in the packet being dropped. Evaluation to a negative value results in a variable chance of it being dropped, roughly inverse in proportion to the magnitude of the value. Default is 0 which results in no drops. See below for accepted variables.
- dropamount
Accepts a non-negative integer, which assigns a variable chance of it being dropped, roughly inverse in proportion to the value. Default is 0 which results in no drops. This option is kept for backwards compatibility and is equivalent to setting drop to a negative value with the same magnitude i.e.
dropamount=4is the same asdrop=-4. Ignored if drop is also specified.
Both amount and drop accept expressions containing the following variables:
- ‘n’
The index of the packet, starting from zero.
- ‘tb’
The timebase for packet timestamps.
- ‘pts’
Packet presentation timestamp.
- ‘dts’
Packet decoding timestamp.
- ‘nopts’
Constant representing AV_NOPTS_VALUE.
- ‘startpts’
First non-AV_NOPTS_VALUE PTS seen in the stream.
- ‘startdts’
First non-AV_NOPTS_VALUE DTS seen in the stream.
- ‘duration’
- ‘d’
Packet duration, in timebase units.
- ‘pos’
Packet position in input; may be -1 when unknown or not set.
- ‘size’
Packet size, in bytes.
- ‘key’
Whether packet is marked as a keyframe.
- ‘state’
A pseudo random integer, primarily derived from the content of packet payload.
13.24.1 Examples
Apply modification to every byte but don’t drop any packets.
ffmpeg -i INPUT -c copy -bsf noise=1 output.mkv
Drop every video packet not marked as a keyframe after timestamp 30s but do not modify any of the remaining packets.
ffmpeg -i INPUT -c copy -bsf:v noise=drop='gt(pts*tb\,30)*not(key)' output.mkv
Drop one second of audio every 10 seconds and add some random noise to the rest.
ffmpeg -i INPUT -c copy -bsf:a noise=amount=-1:drop='between(mod(pts*tb\,10)\,9\,10)' output.mkv
13.25 null
This bitstream filter passes the packets through unchanged.
13.26 pcm_rechunk
Repacketize PCM audio to a fixed number of samples per packet or a fixed packet rate per second. This is similar to the (ffmpeg-filters)asetnsamples audio filter but works on audio packets instead of audio frames.
- nb_out_samples, n
Set the number of samples per each output audio packet. The number is intended as the number of samples per each channel. Default value is 1024.
- pad, p
If set to 1, the filter will pad the last audio packet with silence, so that it will contain the same number of samples (or roughly the same number of samples, see frame_rate) as the previous ones. Default value is 1.
- frame_rate, r
This option makes the filter output a fixed number of packets per second instead of a fixed number of samples per packet. If the audio sample rate is not divisible by the frame rate then the number of samples will not be constant but will vary slightly so that each packet will start as close to the frame boundary as possible. Using this option has precedence over nb_out_samples.
You can generate the well known 1602-1601-1602-1601-1602 pattern of 48kHz audio for NTSC frame rate using the frame_rate option.
ffmpeg -f lavfi -i sine=r=48000:d=1 -c pcm_s16le -bsf pcm_rechunk=r=30000/1001 -f framecrc -
13.27 pgs_frame_merge
Merge a sequence of PGS Subtitle segments ending with an "end of display set" segment into a single packet.
This is required by some containers that support PGS subtitles
(muxer matroska).
13.28 prores_metadata
Modify color property metadata embedded in prores stream.
- color_primaries
Set the color primaries. Available values are:
- ‘auto’
Keep the same color primaries property (default).
- ‘unknown’
- ‘bt709’
- ‘bt470bg’
BT601 625
- ‘smpte170m’
BT601 525
- ‘bt2020’
- ‘smpte431’
DCI P3
- ‘smpte432’
P3 D65
- transfer_characteristics
Set the color transfer. Available values are:
- ‘auto’
Keep the same transfer characteristics property (default).
- ‘unknown’
- ‘bt709’
BT 601, BT 709, BT 2020
- ‘smpte2084’
SMPTE ST 2084
- ‘arib-std-b67’
ARIB STD-B67
- matrix_coefficients
Set the matrix coefficient. Available values are:
- ‘auto’
Keep the same colorspace property (default).
- ‘unknown’
- ‘bt709’
- ‘smpte170m’
BT 601
- ‘bt2020nc’
Set Rec709 colorspace for each frame of the file
ffmpeg -i INPUT -c copy -bsf:v prores_metadata=color_primaries=bt709:color_trc=bt709:colorspace=bt709 output.mov
Set Hybrid Log-Gamma parameters for each frame of the file
ffmpeg -i INPUT -c copy -bsf:v prores_metadata=color_primaries=bt2020:color_trc=arib-std-b67:colorspace=bt2020nc output.mov
13.29 remove_extra
Remove extradata from packets.
It accepts the following parameter:
- freq
Set which frame types to remove extradata from.
- ‘k’
Remove extradata from non-keyframes only.
- ‘keyframe’
Remove extradata from keyframes only.
- ‘e, all’
Remove extradata from all frames.
13.30 setts
Set PTS and DTS in packets.
It accepts the following parameters:
- ts
- pts
- dts
Set expressions for PTS, DTS or both.
- duration
Set expression for duration.
- time_base
Set output time base.
- prescale
Set whether to convert time fields to user-set output time base before evaluation of expressions. Defaults to 0.
The expressions are evaluated through the eval API and can contain the following constants:
- N
The count of the input packet. Starting from 0.
- TS
The demux timestamp in input in case of
tsordtsoption or presentation timestamp in case ofptsoption.- POS
The original position in the file of the packet, or undefined if undefined for the current packet
- DTS
The demux timestamp in input.
- PTS
The presentation timestamp in input.
- DURATION
The duration in input.
- STARTDTS
The DTS of the first packet.
- STARTPTS
The PTS of the first packet.
- PREV_INDTS
The previous input DTS.
- PREV_INPTS
The previous input PTS.
- PREV_INDURATION
The previous input duration.
- PREV_OUTDTS
The previous output DTS.
- PREV_OUTPTS
The previous output PTS.
- PREV_OUTDURATION
The previous output duration.
- NEXT_DTS
The next input DTS.
- NEXT_PTS
The next input PTS.
- NEXT_DURATION
The next input duration.
- TB
The timebase in which time fields are denominated. The user-set output timebase if prescale is enabled, else the input timebase.
- TB_OUT
The output timebase.
- SR
The sample rate of stream packet belongs.
- NOPTS
The AV_NOPTS_VALUE constant.
For example, to set PTS equal to DTS (not recommended if B-frames are involved):
ffmpeg -i INPUT -c:a copy -bsf:a setts=pts=DTS out.mkv
13.31 showinfo
Log basic packet information. Mainly useful for testing, debugging, and development.
13.32 smpte436m_to_eia608
Convert from a SMPTE_436M_ANC data stream to a EIA_608 stream,
extracting the closed captions from CTA-708 CDP VANC packets, and ignoring all other data.
13.33 text2movsub
Convert text subtitles to MOV subtitles (as used by the mov_text
codec) with metadata headers.
See also the mov2textsub filter.
13.34 trace_headers
Log trace output containing all syntax elements in the coded stream headers (everything above the level of individual coded blocks). This can be useful for debugging low-level stream issues.
Supports AV1, H.264, H.265, (M)JPEG, MPEG-2 and VP9, but depending on the build only a subset of these may be available.
13.35 truehd_core
Extract the core from a TrueHD stream, dropping ATMOS data.
13.36 vp9_metadata
Modify metadata embedded in a VP9 stream.
- color_space
Set the color space value in the frame header. Note that any frame set to RGB will be implicitly set to PC range and that RGB is incompatible with profiles 0 and 2.
- ‘unknown’
- ‘bt601’
- ‘bt709’
- ‘smpte170’
- ‘smpte240’
- ‘bt2020’
- ‘rgb’
- color_range
Set the color range value in the frame header. Note that any value imposed by the color space will take precedence over this value.
- ‘tv’
- ‘pc’
13.37 vp9_superframe
Merge VP9 invisible (alt-ref) frames back into VP9 superframes. This fixes merging of split/segmented VP9 streams where the alt-ref frame was split from its visible counterpart.
13.38 vp9_superframe_split
Split VP9 superframes into single frames.
13.39 vp9_raw_reorder
Given a VP9 stream with correct timestamps but possibly out of order, insert additional show-existing-frame packets to correct the ordering.
14 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, i.e. the size of the data to analyze to get stream information. A higher value will enable detecting more information in case it is dispersed into the stream, but will increase latency. Must be an integer not lesser than 32. It is 5000000 by default.
- max_probe_packets integer (input)
Set the maximum number of buffered packets when probing a codec. Default is 2500 packets.
- 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 also set. In case the PTS is set, the DTS value is set to NOPTS. This is ignored when the
nofillinflag is set.- ‘ignidx’
Ignore index.
- ‘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
+nofillintoo.- ‘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 between platforms. Its primary use is for regression testing.
- ‘flush_packets’
Write out packets immediately.
- ‘shortest’
Stop muxing at the end of the shortest stream. It may be needed to increase max_interleave_delta to avoid flushing the longer streams 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. A higher value will enable detecting more accurate information, but will increase 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_detectis deprecated and should be used only via theffmpegtool.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 the wild 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 is expressed in microseconds, and defaults to 10000000 (10 seconds).
To ensure all the streams are interleaved correctly, libavformat will wait until it has at least one packet for each stream before actually writing any packets to the output file. When some streams are "sparse" (i.e. there are large gaps between successive packets), this can result in excessive buffering.
This field specifies the maximum difference between the timestamps of the first and the last packet in the muxing queue, above which libavformat will output a packet regardless of whether it has queued a packet for all the streams.
If set to 0, libavformat will continue buffering packets until it has a packet for each stream, regardless of the maximum timestamp difference 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 not non-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 the same amount. Audio, video, and subtitles desynching and relative timestamp differences are preserved compared to how they would have been 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), which means that the underlying protocol will decide, 1 enables it, and has the effect of reducing the latency, 0 disables it and may increase IO throughput in some cases.
- output_ts_offset offset (output)
Set the output time offset.
offset must be a time duration specification, see (ffmpeg-utils)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 are delayed bt the time duration specified in offset. Default value is
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 the Stream parameters. For example, to separate the fields with newlines and indentation:
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 that would require too many resources due to a large number of streams.
- skip_estimate_duration_from_pts bool (input)
Skip estimation of input duration if it requires an additional probing for PTS at end of file. At present, applicable for MPEG-PS and MPEG-TS.
- duration_probesize integer (input)
Set probing size, in bytes, for input duration estimation when it actually requires an additional probing for PTS at end of file (at present: MPEG-PS and MPEG-TS). It is aimed at users interested in better durations probing for itself, or indirectly because using the concat demuxer, for example. The typical use case is an MPEG-TS CBR with a high bitrate, high video buffering and ending cleaning with similar PTS for video and audio: in such a scenario, the large physical gap between the last video packet and the last audio packet makes it necessary to read many bytes in order to get the video stream duration. Another use case is where the default probing behaviour only reaches a single video frame which is not the last one of the stream due to frame reordering, so the duration is not accurate. Setting this option has a performance impact even for small files because the probing size is fixed. Default behaviour is a general purpose trade-off, largely adaptive, but the probing size will not be extended to get streams durations at all costs. Must be an integer not lesser than 1, or 0 for default behaviour.
- strict, f_strict integer (input/output)
Specify how strictly to follow the standards.
f_strictis deprecated and should be used only via theffmpegtool.Possible values:
- ‘very’
strictly conform to an older more strict version of the spec or reference software
- ‘strict’
strictly conform to all the things in the spec no matter what consequences
- ‘normal’
- ‘unofficial’
allow unofficial extensions
- ‘experimental’
allow non standardized experimental things, experimental (unfinished/work in progress/not well tested) decoders and encoders. Note: experimental decoders can pose a security risk, do not use this for decoding untrusted input.
14.1 Format stream specifiers
Format stream specifiers allow selection of one or more streams that match specific properties.
The exact semantics of stream specifiers is defined by the
avformat_match_stream_specifier() function declared in the
libavformat/avformat.h header and documented in the
(ffmpeg)Stream specifiers section in the ffmpeg(1) manual.
15 Demuxers
Demuxers are configured elements in FFmpeg that can read the multimedia streams from a particular type of file.
When you configure your FFmpeg build, all the supported demuxers
are enabled by default. You can list all available ones using the
configure option --list-demuxers.
You can disable all the demuxers using the configure option
--disable-demuxers, and selectively enable a single demuxer with
the option --enable-demuxer=DEMUXER, or disable it
with the option --disable-demuxer=DEMUXER.
The option -demuxers of the ff* tools will display the list of
enabled demuxers. Use -formats to view a combined list of
enabled demuxers and muxers.
The description of some of the currently available demuxers follows.
15.1 aa
Audible Format 2, 3, and 4 demuxer.
This demuxer is used to demux Audible Format 2, 3, and 4 (.aa) files.
15.2 aac
Raw Audio Data Transport Stream AAC demuxer.
This demuxer is used to demux an ADTS input containing a single AAC stream alongwith any ID3v1/2 or APE tags in it.
15.3 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 first fcTL chunk are transmitted as extradata. Frames are then split as being all the chunks between two fcTL ones, or between the last fcTL and IEND chunks.
- -ignore_loop bool
Ignore the loop variable in the file if set. Default is enabled.
- -max_fps int
Maximum framerate in frames per second. Default of 0 imposes no limit.
- -default_fps int
Default framerate in frames per second when none is specified in the file (0 meaning as fast as possible). Default is 15.
15.4 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.
15.5 concat
Virtual concatenation script demuxer.
This demuxer reads a list of files and other directives from a text file and demuxes them one after the other, as if all their packets had been muxed together.
The timestamps in the files are adjusted so that the first file starts at 0 and each next file starts where the previous one finishes. Note that it is done globally and may cause gaps if all streams do not have exactly the same length.
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 or
because the file is truncated, for example), it can cause artifacts. The
duration directive can be used to override the duration stored in
each file.
15.5.1 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. The following directive is recognized:
file pathPath to a file to read; special characters and spaces must be escaped with backslash or single quotes.
All subsequent file-related directives apply to that file.
ffconcat version 1.0Identify the script type and version.
To make FFmpeg recognize the format automatically, this directive must appear exactly as is (no extra space or byte-order-mark) on the very first line of the script.
duration durDuration of the file. This information can be specified from the file; specifying it here may be more efficient or help if the information from the file is not available or accurate.
If the duration is set for all files, then it is possible to seek in the whole concatenated video.
inpoint timestampIn point of the file. When the demuxer opens the file it instantly seeks to the specified timestamp. Seeking is done so that all streams can be presented successfully at In point.
This directive works best with intra frame codecs, because for non-intra frame ones you will usually get extra packets before the actual In point and the decoded content will most likely contain frames before In point too.
For each file, packets before the file In point will have timestamps less than the calculated start timestamp of the file (negative in case of the first file), and the duration of the files (if not specified by the
durationdirective) will be reduced based on their specified In point.Because of potential packets before the specified In point, packet timestamps may overlap between two concatenated files.
outpoint timestampOut point of the file. When the demuxer reaches the specified decoding timestamp in any of the streams, it handles it as an end of file condition and skips the current and all the remaining packets from all streams.
Out point is exclusive, which means that the demuxer will not output packets with a decoding timestamp greater or equal to Out point.
This directive works best with intra frame codecs and formats where all streams are tightly interleaved. For non-intra frame codecs you will usually get additional packets with presentation timestamp after Out point therefore the decoded content will most likely contain frames after Out point too. If your streams are not tightly interleaved you may not get all the packets from all streams before Out point and you may only will be able to decode the earliest stream until Out point.
The duration of the files (if not specified by the
durationdirective) will be reduced based on their specified Out point.file_packet_metadata key=valueMetadata of the packets of the file. The specified metadata will be set for each file packet. You can specify this directive multiple times to add multiple metadata entries. This directive is deprecated, use
file_packet_metainstead.file_packet_meta key valueMetadata of the packets of the file. The specified metadata will be set for each file packet. You can specify this directive multiple times to add multiple metadata entries.
option key valueOption to access, open and probe the file. Can be present multiple times.
streamIntroduce a stream in the virtual file. All subsequent stream-related directives apply to the last introduced stream. Some streams properties must be set in order to allow identifying the matching streams in the subfiles. If no streams are defined in the script, the streams from the first file are copied.
exact_stream_id idSet the id of the stream. If this directive is given, the string with the corresponding id in the subfiles will be used. This is especially useful for MPEG-PS (VOB) files, where the order of the streams is not reliable.
stream_meta key valueMetadata for the stream. Can be present multiple times.
stream_codec valueCodec for the stream.
stream_extradata hex_stringExtradata for the string, encoded in hexadecimal.
chapter id start endAdd a chapter. id is an unique identifier, possibly small and consecutive.
15.5.2 Options
This demuxer accepts the following option:
- safe
If set to 1, reject unsafe file paths and directives. A file path is considered safe if it does not contain a protocol specification and is relative and all components only contain characters from the portable character set (letters, digits, period, underscore and hyphen) and have no period at the beginning of a component.
If set to 0, any file name is accepted.
The default is 1.
- auto_convert
If set to 1, try to perform automatic conversions on packet data to make the streams concatenable. The default is 1.
Currently, the only conversion is adding the h264_mp4toannexb bitstream filter to H.264 streams in MP4 format. This is necessary in particular if there are resolution changes.
- segment_time_metadata
If set to 1, every packet will contain the lavf.concat.start_time and the lavf.concat.duration packet metadata values which are the start_time and the duration of the respective file segments in the concatenated output expressed in microseconds. The duration metadata is only set if it is known based on the concat file. The default is 0.
15.5.3 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 of
the first file:
ffconcat version 1.0 file file-1.wav duration 20.0 file subdir/file-2.wav
15.6 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 decide
which streams to actually receive.
Each stream mirrors the id and bandwidth properties from the
<Representation> as metadata keys named "id" and "variant_bitrate" respectively.
15.6.1 Options
This demuxer accepts the following option:
- cenc_decryption_key
Default 16-byte key, in hex, to decrypt files encrypted using ISO Common Encryption (CENC/AES-128 CTR; ISO/IEC 23001-7).
- cenc_decryption_keys
Dictionary of 16-byte key ID => 16-byte key, both in hex, to decrypt files encrypted using ISO Common Encryption (CENC/AES-128 CTR; ISO/IEC 23001-7).
15.7 dvdvideo
DVD-Video demuxer, powered by libdvdnav and libdvdread.
Can directly ingest DVD titles, specifically sequential PGCs, into a conversion pipeline. Menu assets, such as background video or audio, can also be demuxed given the menu’s coordinates (at best effort).
Block devices (DVD drives), ISO files, and directory structures are accepted.
Activate with -f dvdvideo in front of one of these inputs.
This demuxer does NOT have decryption code of any kind. You are on your own working with encrypted DVDs, and should not expect support on the matter.
Underlying playback is handled by libdvdnav, and structure parsing by libdvdread.
FFmpeg must be built with GPL library support available as well as the
configure switches --enable-libdvdnav and --enable-libdvdread.
You will need to provide either the desired "title number" or exact PGC/PG coordinates. Many open-source DVD players and tools can aid in providing this information. If not specified, the demuxer will default to title 1 which works for many discs. However, due to the flexibility of the format, it is recommended to check manually. There are many discs that are authored strangely or with invalid headers.
If the input is a real DVD drive, please note that there are some drives which may silently fail on reading bad sectors from the disc, returning random bits instead which is effectively corrupt data. This is especially prominent on aging or rotting discs. A second pass and integrity checks would be needed to detect the corruption. This is not an FFmpeg issue.
15.7.1 Background
DVD-Video is not a directly accessible, linear container format in the traditional sense. Instead, it allows for complex and programmatic playback of carefully muxed MPEG-PS streams that are stored in headerless VOB files. To the end-user, these streams are known simply as "titles", but the actual logical playback sequence is defined by one or more "PGCs", or Program Group Chains, within the title. The PGC is in turn comprised of multiple "PGs", or Programs", which are the actual video segments (and for a typical video feature, sequentially ordered). The PGC structure, along with stream layout and metadata, are stored in IFO files that need to be parsed. PGCs can be thought of as playlists in easier terms.
An actual DVD player relies on user GUI interaction via menus and an internal VM to drive the direction of demuxing. Generally, the user would either navigate (via menus) or automatically be redirected to the PGC of their choice. During this process and the subsequent playback, the DVD player’s internal VM also maintains a state and executes instructions that can create jumps to different sectors during playback. This is why libdvdnav is involved, as a linear read of the MPEG-PS blobs on the disc (VOBs) is not enough to produce the right sequence in many cases.
There are many other DVD structures (a long subject) that will not be discussed here. NAV packets, in particular, are handled by this demuxer to build accurate timing but not emitted as a stream. For a good high-level understanding, refer to: https://code.videolan.org/videolan/libdvdnav/-/blob/master/doc/dvd_structures
15.7.2 Options
This demuxer accepts the following options:
- title int
The title number to play. Must be set if pgc and pg are not set. Not applicable to menus. Default is 0 (auto), which currently only selects the first available title (title 1) and notifies the user about the implications.
- chapter_start int
The chapter, or PTT (part-of-title), number to start at. Not applicable to menus. Default is 1.
- chapter_end int
The chapter, or PTT (part-of-title), number to end at. Not applicable to menus. Default is 0, which is a special value to signal end at the last possible chapter.
- angle int
The video angle number, referring to what is essentially an additional video stream that is composed from alternate frames interleaved in the VOBs. Not applicable to menus. Default is 1.
- region int
The region code to use for playback. Some discs may use this to default playback at a particular angle in different regions. This option will not affect the region code of a real DVD drive, if used as an input. Not applicable to menus. Default is 0, "world".
- menu bool
Demux menu assets instead of navigating a title. Requires exact coordinates of the menu (menu_lu, menu_vts, pgc, pg). Default is false.
- menu_lu int
The menu language to demux. In DVD, menus are grouped by language. Default is 1, the first language unit.
- menu_vts int
The VTS where the menu lives, or 0 if it is a VMG menu (root-level). Default is 1, menu of the first VTS.
- pgc int
The entry PGC to start playback, in conjunction with pg. Alternative to setting title. Chapter markers are not supported at this time. Must be explicitly set for menus. Default is 0, automatically resolve from value of title.
- pg int
The entry PG to start playback, in conjunction with pgc. Alternative to setting title. Chapter markers are not supported at this time. Default is 1, the first PG of the PGC.
- preindex bool
Enable this to have accurate chapter (PTT) markers and duration measurement, which requires a slow second pass read in order to index the chapter marker timestamps from NAV packets. This is non-ideal extra work for real optical drives. It is recommended and faster to use this option with a backup of the DVD structure stored on a hard drive. Not compatible with pgc and pg. Default is 0, false.
- trim bool
Skip padding cells (i.e. cells shorter than 1 second) from the beginning. There exist many discs with filler segments at the beginning of the PGC, often with junk data intended for controlling a real DVD player’s buffering speed and with no other material data value. Not applicable to menus. Default is 1, true.
15.7.3 Examples
- Open title 3 from a given DVD structure:
ffmpeg -f dvdvideo -title 3 -i <path to DVD> ...
- Open chapters 3-6 from title 1 from a given DVD structure:
ffmpeg -f dvdvideo -chapter_start 3 -chapter_end 6 -title 1 -i <path to DVD> ...
- Open only chapter 5 from title 1 from a given DVD structure:
ffmpeg -f dvdvideo -chapter_start 5 -chapter_end 5 -title 1 -i <path to DVD> ...
- Demux menu with language 1 from VTS 1, PGC 1, starting at PG 1:
ffmpeg -f dvdvideo -menu 1 -menu_lu 1 -menu_vts 1 -pgc 1 -pg 1 -i <path to DVD> ...
15.8 ea
Electronic Arts Multimedia format demuxer.
This format is used by various Electronic Arts games.
15.8.1 Options
- merge_alpha bool
-
Normally the VP6 alpha channel (if exists) is returned as a secondary video stream, by setting this option you can make the demuxer return a single video stream which contains the alpha channel in addition to the ordinary video.
15.9 imf
Interoperable Master Format demuxer.
This demuxer presents audio and video streams found in an IMF Composition, as specified in SMPTE ST 2067-2.
ffmpeg [-assetmaps <path of ASSETMAP1>,<path of ASSETMAP2>,...] -i <path of CPL> ...
If -assetmaps is not specified, the demuxer looks for a file called
ASSETMAP.xml in the same directory as the CPL.
15.10 flv, live_flv, kux
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. KUX is a flv variant used on the Youku platform.
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.
15.11 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 (or infinitely). If ignore_loop is set to 1, then the loop setting from 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 to the GIF. Default value is 1.
For example, with the overlay filter, place an infinitely looping GIF over 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 is used 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 loops infinitely.
15.12 hls
HLS demuxer
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 setting the 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 is available in a metadata key named "variant_bitrate".
It accepts the following options:
- live_start_index
segment index to start live streams at (negative values are from the end).
- prefer_x_start
prefer to use #EXT-X-START if it’s in playlist instead of live_start_index.
- allowed_extensions
’,’ separated list of file extensions that hls is allowed to access.
- extension_picky
This blocks disallowed extensions from probing It also requires all available segments to have matching extensions to the format except mpegts, which is always allowed. It is recommended to set the whitelists correctly instead of depending on extensions Enabled by default.
- max_reload
Maximum number of times a insufficient list is attempted to be reloaded. Default value is 1000.
- m3u8_hold_counters
The maximum number of times to load m3u8 when it refreshes without new segments. 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.
- http_seekable
Use HTTP partial requests for downloading HTTP segments. 0 = disable, 1 = enable, -1 = auto, Default is auto.
- seg_format_options
Set options for the demuxer of media segments using a list of key=value pairs separated by
:.- seg_max_retry
Maximum number of times to reload a segment on error, useful when segment skip on network error is not desired. Default value is 0.
15.13 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 the option pattern_type.
The pattern may contain a suffix which is used to automatically determine the format of the images contained in the files.
The size, the pixel format, and the format of each image must be the same 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 specified image. You should use this option if you do not want to create sequences from multiple images and your filenames may contain special pattern characters.
- sequence
Select a sequence pattern type, used to specify a sequence of files indexed by sequential numbers.
A sequence pattern may contain the string "%d" or "%0Nd", which specifies the position of the characters representing a sequential number in each filename matched by the pattern. If the form "%d0Nd" is used, the string representing the number in each filename is 0-padded and N is the total number of 0-padded digits representing the number. The literal character ’%’ can be specified in the pattern with the string "%%".
If the sequence pattern contains "%d" or "%0Nd", the first filename of the file list specified by the pattern must contain a number inclusively contained between start_number and start_number+start_number_range-1, and all the following numbers must be sequential.
For example the pattern "img-%03d.bmp" will match a sequence of filenames of the form img-001.bmp, img-002.bmp, ..., img-010.bmp, etc.; the pattern "i%%m%%g-%d.jpg" will match a sequence 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 file img.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 only selectable if libavformat was compiled with globbing support.
Default value is sequence.
- pixel_format
Set the pixel format of the images to read. If not specified the pixel format is guessed