Advanced Video options

'-pix_fmt[:stream_specifier] format (input/output,per-stream)'

Set pixel format. Use -pix_fmts to show all the supported pixel formats. If the selected pixel format can not be selected, ffmpeg will print a warning and select the best pixel format supported by the encoder. If pix_fmt is prefixed by a +, ffmpeg will exit with an error if the requested pixel format can not be selected, and automatic conversions inside filtergraphs are disabled. If pix_fmt is a single +, ffmpeg selects the same pixel format as the input (or graph output) and automatic conversions are disabled.

'-sws_flags flags (input/output)'

Set SwScaler flags.

'-rc_override[:stream_specifier] override (output,per-stream)'

Rate control override for specific intervals, formatted as "int,int,int" list separated with slashes. Two first values are the beginning and end frame numbers, last one is quantizer to use if positive, or quality factor if negative.

'-ilme'

Force interlacing support in encoder (MPEG-2 and MPEG-4 only). Use this option if your input file is interlaced and you want to keep the interlaced format for minimum losses. The alternative is to deinterlace the input stream with '-deinterlace', but deinterlacing introduces losses.

'-psnr'

Calculate PSNR of compressed frames.

'-vstats'

Dump video coding statistics to 'vstats_HHMMSS.log'.

'-vstats_file file'

Dump video coding statistics to file.

'-vstats_version file'

Specifies which version of the vstats format to use. Default is 2.

version = 1 :

frame= %5d q= %2.1f PSNR= %6.2f f_size= %6d s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s

version > 1:

out= %2d st= %2d frame= %5d q= %2.1f PSNR= %6.2f f_size= %6d s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s

'-top[:stream_specifier] n (output,per-stream)'

top=1/bottom=0/auto=-1 field first

'-dc precision'

Intra_dc_precision.

'-vtag fourcc/tag (output)'

Force video tag/fourcc. This is an alias for -tag:v.

'-qphist (global)'

Show QP histogram

'-vbsf bitstream_filter'

Deprecated see -bsf

'-force_key_frames[:stream_specifier] time[,time...] (output,per-stream)'
'-force_key_frames[:stream_specifier] expr:expr (output,per-stream)'

Force key frames at the specified timestamps, more precisely at the first frames after each specified time.

If the argument is prefixed with expr:, the string expr is interpreted like an expression and is evaluated for each frame. A key frame is forced in case the evaluation is non-zero.

If one of the times is "chapters[delta]", it is expanded into the time of the beginning of all chapters in the file, shifted by delta, expressed as a time in seconds. This option can be useful to ensure that a seek point is present at a chapter mark or any other designated place in the output file.

For example, to insert a key frame at 5 minutes, plus key frames 0.1 second before the beginning of every chapter:

-force_key_frames 0:05:00,chapters-0.1

The expression in expr can contain the following constants:

'n'

the number of current processed frame, starting from 0

'n_forced'

the number of forced frames

'prev_forced_n'

the number of the previous forced frame, it is NAN when no keyframe was forced yet

'prev_forced_t'

the time of the previous forced frame, it is NAN when no keyframe was forced yet

't'

the time of the current processed frame

For example to force a key frame every 5 seconds, you can specify:

-force_key_frames expr:gte(t,n_forced*5)

To force a key frame 5 seconds after the time of the last forced one, starting from second 13:

-force_key_frames expr:if(isnan(prev_forced_t),gte(t,13),gte(t,prev_forced_t+5))

Note that forcing too many keyframes is very harmful for the lookahead algorithms of certain encoders: using fixed-GOP options or similar would be more efficient.

'-copyinkf[:stream_specifier] (output,per-stream)'

When doing stream copy, copy also non-key frames found at the beginning.

'-init_hw_device type[=name][:device[,key=value...]]'

Initialise a new hardware device of type type called name, using the given device parameters. If no name is specified it will receive a default name of the form "type%d".

The meaning of device and the following arguments depends on the device type:

'cuda'

device is the number of the CUDA device.

'dxva2'

device is the number of the Direct3D 9 display adapter.

'vaapi'

device is either an X11 display name or a DRM render node. If not specified, it will attempt to open the default X11 display ($DISPLAY) and then the first DRM render node (/dev/dri/renderD128).

'vdpau'

device is an X11 display name. If not specified, it will attempt to open the default X11 display ($DISPLAY).

'qsv'

device selects a value in 'MFX_IMPL_*'. Allowed values are:

'auto'
'sw'
'hw'
'auto_any'
'hw_any'
'hw2'
'hw3'
'hw4'

If not specified, 'auto_any' is used. (Note that it may be easier to achieve the desired result for QSV by creating the platform-appropriate subdevice ('dxva2' or 'vaapi') and then deriving a QSV device from that.)

'opencl'

device selects the platform and device as platform_index.device_index.

The set of devices can also be filtered using the key-value pairs to find only devices matching particular platform or device strings.

The strings usable as filters are:

'platform_profile'
'platform_version'
'platform_name'
'platform_vendor'
'platform_extensions'
'device_name'
'device_vendor'
'driver_version'
'device_version'
'device_profile'
'device_extensions'
'device_type'

The indices and filters must together uniquely select a device.

Examples:

-init_hw_device opencl:0.1

Choose the second device on the first platform.

-init_hw_device opencl:,device_name=Foo9000

Choose the device with a name containing the string Foo9000.

-init_hw_device opencl:1,device_type=gpu,device_extensions=cl_khr_fp16

Choose the GPU device on the second platform supporting the cl_khr_fp16 extension.

'-init_hw_device type[=name]@source'

Initialise a new hardware device of type type called name, deriving it from the existing device with the name source.

'-init_hw_device list'

List all hardware device types supported in this build of ffmpeg.

'-filter_hw_device name'

Pass the hardware device called name to all filters in any filter graph. This can be used to set the device to upload to with the hwupload filter, or the device to map to with the hwmap filter. Other filters may also make use of this parameter when they require a hardware device. Note that this is typically only required when the input is not already in hardware frames - when it is, filters will derive the device they require from the context of the frames they receive as input.

This is a global setting, so all filters will receive the same device.

'-hwaccel[:stream_specifier] hwaccel (input,per-stream)'

Use hardware acceleration to decode the matching stream(s). The allowed values of hwaccel are:

'none'

Do not use any hardware acceleration (the default).

'auto'

Automatically select the hardware acceleration method.

'vdpau'

Use VDPAU (Video Decode and Presentation API for Unix) hardware acceleration.

'dxva2'

Use DXVA2 (DirectX Video Acceleration) hardware acceleration.

'vaapi'

Use VAAPI (Video Acceleration API) hardware acceleration.

'qsv'

Use the Intel QuickSync Video acceleration for video transcoding.

Unlike most other values, this option does not enable accelerated decoding (that is used automatically whenever a qsv decoder is selected), but accelerated transcoding, without copying the frames into the system memory.

For it to work, both the decoder and the encoder must support QSV acceleration and no filters must be used.

This option has no effect if the selected hwaccel is not available or not supported by the chosen decoder.

Note that most acceleration methods are intended for playback and will not be faster than software decoding on modern CPUs. Additionally, ffmpeg will usually need to copy the decoded frames from the GPU memory into the system memory, resulting in further performance loss. This option is thus mainly useful for testing.

'-hwaccel_device[:stream_specifier] hwaccel_device (input,per-stream)'

Select a device to use for hardware acceleration.

This option only makes sense when the '-hwaccel' option is also specified. It can either refer to an existing device created with '-init_hw_device' by name, or it can create a new device as if '-init_hw_device' type:hwaccel_device were called immediately before.

'-hwaccels'

List all hardware acceleration methods supported in this build of ffmpeg.