MainConcept AVC/H.264 Broadcast Encoder Plug-in for FFmpeg 3.1.0
AVC Broadcast Encoder plug-in usage

This section describes how to use the MainConcept AVC Broadcast Encoder plug-in for FFmpeg.

The command line format should follow the structure below, depending on which operating system you are using.

On Windows

ffmpeg <ffmpeg-params> \
-c:v omx_enc_avc \
-omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video \
-omx_param "<mc-general-params>" \
[AVC Settings] "<mc-codec-params>" \
-f omx_mxf_mux \
-omx_core omxil_core.dll -omx_format_name OMX.MainConcept.mux_mxf.other \
-omx_format_param "<mc-mux-params>" \
<ffmpeg-output-parameters>\

Below are two basic command-line examples:

ffmpeg -r 25 -pix_fmt yuv420p -s 1920x1080 -i 1920x1080p_25p_YV12.yuv -b:v 3500k -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param " force_omx_param=1:preset=H264_HIGH_10:perf_level=10:acc_type=sw:[AVC Settings]:time_scale=20000000:num_units_in_tick=1000000" 1920x1080p_25p_YV12_ffmpeg.h264 -y
ffmpeg -i source.mp4 -map 0:v:0 -c:v:0 omx_enc_avc -omx_core omxil_core.dll -omx_name:v OMX.MainConcept.enc_avc.video -map 0:a:0 -c:a:0 pcm_s24le -r:a 48000 -f omx_mxf_mux -omx_core omxil_core.dll -omx_format_name OMX.MainConcept.mux_mxf.other output.mxf -y 

The following is a command line using a configuration file:

ffmpeg -r 25 -pix_fmt yuv420p -s 1920x1080 -i 1920x1080p_25p_YV12.yuv -b:v 3500k -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "force_omx_param=0:cfg_file_path=avc_config.ini" 1920x1080p_25p_YV12_ffmpeg.h264 -y 

On Linux

Note
The modified FFmpeg executable is installed in /opt/mainconcept/ffmpeg-omx/bin/. Ensure this folder is in your search path for the following examples.

ffmpeg <ffmpeg-params> \
-c:v omx_enc_avc \ 
-omx_core libomxil_core.so -omx_name OMX.MainConcept.enc_avc.video \
-omx_param "<mc-general-params>" \
[AVC Settings] "<mc-codec-params>" \
-f omx_mxf_mux \
-omx_core libomxil_core.so -omx_format_name OMX.MainConcept.mux_mxf.other \
-omx_format_param "<mc-mux-params>" \
<ffmpeg-output-parameters> \ 

Below are two basic command-line examples:

ffmpeg -r 25 -pix_fmt yuv420p -s 1920x1080 -i 1920x1080p_25p_YV12.yuv -b:v 15000k -c:v omx_enc_avc -omx_core libomxil_core.so -omx_name OMX.MainConcept.enc_avc.video -omx_param " force_omx_param=1:preset=H264_LONG_GOP_420_CLASS_G12:perf_level=10:acc_type=sw:[AVC Settings]:time_scale=20000000:num_units_in_tick=1000000" 1920x1080p_25p_YV12_ffmpeg.h264 -y 
ffmpeg -i source.mp4 -map 0:v:0 -c:v:0 omx_enc_avc -omx_core libomxil_core.so -omx_name:v OMX.MainConcept.enc_avc.video -map 0:a:0 -c:a:0 pcm_s24le -r:a 48000 -f omx_mxf_mux -omx_core libomxil_core.so -omx_format_name OMX.MainConcept.mux_mxf.other output.mxf -y

Here is a command-line example using a configuration file:

ffmpeg -r 25 -pix_fmt yuv420p -s 1920x1080 -i 1920x1080p_25p_YV12.yuv -b:v 10000k -c:v omx_enc_avc -omx_core libomxil_core.so -omx_name OMX.MainConcept.enc_avc.video -omx_param "force_omx_param=0:cfg_file_path=avc_config.ini" 1920x1080p_25p_YV12_ffmpeg.h264 -y

FFmpeg options mapped to the MainConcept AVC/H.264 Broadcast Encoder

The following FFmpeg options are mapped from the command-line to the MainConcept AVC/H.264 Broadcast Encoder:

FFmpeg option Usage example
bit_rate -b:v 1M -b:a 192k
pix_fmt -pix_fmt yuv420p
gop_size -g 4
max_b_frames -bf 2
interlace_mode -flags +ildct
framerate -r 30
width; height -s 720x480

Note
We recommend the use of "floating" frame rates on the command line in a format such as 24000/1001, 30000/1001, 60000/1001 etc. If you must define a frame rate with an exact value, such as 29.97, specify it in a format such as 30000/1001.

omx_param parameters (mc-general-params)

All settings below are optional parameters for omx_param (mc-general-params):

Function Description
force_omx_param Specifies whether to prioritize the FFmpeg generic global options or the MainConcept codec specific settings:
  • 0: The force_omx_param flag is not set (default), i.e. FFmpeg generic global options will overwrite the omx_param settings.
  • 1: The FFmpeg generic global options are ignored, i.e. the MainConcept codec specific settings are exclusively used.
perf_level Specifies the predefined performance level 1 to 15 for encoding. Other predefined values permitted are:
  • "fastest" = 1
  • "faster" = 4
  • "balanced" = 9 (default)
  • "better_quality" = 12
  • "best_quality" = 15
acc_type Specifies whether you want to use software ("sw"), Intel Quick Sync Video ("iqsv") or NVIDIA NVENC ("nvenc") encoding. IQSV and NVENC are GPU-encoding modes.
preset Specifies the built-in encoder presets. Available options are "H264_BASELINE", "H264_CIF", "H264_MAIN", "H264_D1", "H264_HIGH_10", "H264_HIGH_422", "H264_DASH_L1"..."H264_DASH_L12", "H264_HLS_L1" ... "H264_HLS_9", "H264_LONG_GOP_422_CLASS_G50", "H264_XAVC_4K_INTRA_CLASS_480_CBG", "H264_P2_4K_INTRA_422", "H264_INTRA_CLASS_200_RP2027", etc.. For more details, see Command line examples
cfg_file_path Specifies path to AVC/H.264 encoder configuration file containing all parameters for encoding.
    -omx_param "cfg_file_path=avc_config.ini"
pass 2-pass encoding is an option to achieve better visual quality but with strict target bitrate and HRD compliance. It cannot be used in live encoding. In the first encoding pass, called analysis, intermediate statistics are saved for further use in the second pass where the actual encoding will take place. 2-pass encoding can take up to twice as long as single-pass encoding.
  • 1: Analysis pass.
  • 2: Encoding pass that uses statistics saved in a temporary file during the analysis pass.

    For 2-pass encoding, you must run FFmpeg twice; the first pass covers the analyzing step and the second pass the actual encoding step. The following are command-line examples:
          ffmpeg -r 30 -vsync 0 -pix_fmt yuv420p -s 1920x1080 -i converted_file_raw.yuv -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "pass=1" ffmpeg_2pass.h264 

          ffmpeg -r 30 -vsync 0 -pix_fmt yuv420p -s 1920x1080 -i converted_file_raw.yuv -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "pass=2" ffmpeg_2pass.h264 
passlogfile Specifies the filename and path where you store the log file that includes the data and statistics from the first analyzing pass. This parameter is optional. If not specified, the file is created using default naming conventions in the current working directory. The following are command-line examples:
     ffmpeg -r 30 -vsync 0 -pix_fmt yuv420p -s 1920x1080 -i converted_file_raw.yuv -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "pass=1:passlogfile=mc_mpass_avc" ffmpeg_2pass.h264 

     ffmpeg -r 30 -vsync 0 -pix_fmt yuv420p -s 1920x1080 -i converted_file_raw.yuv -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "pass=2:passlogfile=mc_mpass_avc" ffmpeg_2pass.h264 
[AVC Settings] Specifies parameters from the AVC/H.264 encoder configuration on the command line, which can be applied under "[AVC Settings]". Use : as a separator and = as a value set for the key. They must have the same structure and order as they would appear in an *.ini file, e.g.
      -omx_param "force_omx_param=1:preset=H264_MAIN:acc_type=sw:[AVC Settings]:bit_rate_mode=0:bit_rate=1000000: ... : ..."
These arguments match the MainConcept AVC/H.264 Encoder settings (see [AVC Settings] as a reference later or an AVC Encoder configuration file as an example).

omx_format_param parameters (mc-general-params)

Function Description
mplex_type Specifies the MXF stream type to multiplex:
  • XDCAM_HD: Sony XDCAM-HD compliant MPEG-2 video and AES-3 382M audio; OP1a SMPTE 378M. (SMPTE RDD-9).
  • XDCAM_IMX: Sony XDCAM IMX compliant MPEG D-10 video and AES-3 331M audio; OP1a SMPTE 378M.
  • XDCAM_DV: Sony XDCAM DV compliant DV-DIF video and AES-3 382M audio; OP1a SMPTE 378M.
  • XDCAM_SXS_HD: Sony Professional Memory Card (SxS) XDCAM HD File Format.
  • XDCAM_SXS_IMX: Sony Professional Memory Card (SxS) XDCAM IMX File Format.
  • XDCAM_SXS_DV: Sony Professional Memory Card (SxS) XDCAM DV File Format.
  • XAVC_SXS: Sony XAVC File Format, Single Essence Location Style. (SMPTE RDD-32 7.3.1) XAVC compliant AVC-Intra CBR, VBR and AVC-LongGOP video and up to 16 channels of AES-3 382M audio.
  • XAVC_MEL: Sony XAVC File Format, Multiple Essence Location Style. (SMPTE RDD-32 7.3.2) XAVC compliant AVC-Intra VBR and AVC-LongGOP video and up to 16 channels of AES-3 382M audio.
  • P2_DVCPRO: Panasonic P2 compliant DV/DVCPRO video and AES-3 382M audio; Specialized Operational Pattern Atom SMPTE 390M.
  • P2_AVCI: Panasonic P2 compliant AVC-Intra 50/100/200 video and AES-3 382M audio; Specialized Operational Pattern Atom SMPTE 390M.
  • P2_AVC_ULTRA: Panasonic P2 AVC-Ultra compliant AVC-Intra or AVC-LongG video and AES-3 382M audio; Op1b SMPTE 391M.
  • J2K_DCI_2K: DCI 2K compliant JPEG2000 video and AES-BWF 382M audio; Specialized Operational Pattern Atom SMPTE 390M.
  • J2K_DCI_4K: DCI 4K compliant JPEG2000 video and AES-BWF 382M audio; Specialized Operational Pattern Atom SMPTE 390M.
  • AS11_DPP_SD: AS-11 UKDPP SD compliant MPEG2, AVC video and AES-BWF 382M audio.
  • AS11_DPP_HD: AS-11 UKDPP HD compliant MPEG2, AVC video and AES-BWF 382M audio.
  • DEFAULT: Generic MXF files; all supported operational patterns, all supported essence types.
profile Specifies the MXF format type you want to multiplex:
  • MXF_PROF_SONY_XDCAM: Sony XDCAM and XAVC type files (OP1a frame-wrapped essences).
  • MXF_PROF_PANASONIC_P2: Panasonic P2 type files (Op1b frame-wrapped or OpAtom clip-wrapped essence).
  • MXF_PROF_DCI_2K: DCI 2K MXF files (OpAtom frame-wrapped essences, each stream in a separate file).
  • MXF_PROF_DCI_4K: DCI 4K MXF files (OpAtom frame-wrapped essences, each stream in a separate file).
  • MXF_PROF_DEFAULT: Generic MXF files (OP1a, OP1b, OPAtom, all supported essence types).
  • MXF_PROF_AS11_DPP: AS-11 UK DPP compliant MXF files (OP1a frame-wrapped essences).
dm_xml_filename The Panasonic P2 AVC-Ultra compliant AVC-Intra or AVC-LongG formats require that a descriptive metadata is specified for encoding. You need to run the P2_LongG_dm_creation.py Python script on the source file to create the XML file (see Panasonic P2 AVC Ultra Pre-Encoding Notes for more details). Once this is done, use the dm_xml_filename parameter to specify location and filename of the XML file (file extension: *.xml).
dm_thumbnail_filename Panasonic P2 AVC-Ultra compliant AVC-Intra or AVC-LongG formats require that a thumbnail is specified for encoding. You need to run the P2_LongG_dm_creation.py Python script on the source file to create the thumbnail (see Panasonic P2 AVC Ultra Pre-Encoding Notes for more details). Once this is done, use the dm_thumbnail_filename parameter to specify location and filename of the thumbnail file (file extension: *.bmp).
operational_pattern Specifies the operational pattern that should be used for MXF wrapping:
  • OPATOM: Specialized Operational Pattern "Atom" (spec. SMPTE 390M).
  • OP1A: Generalized Operational Pattern 1A (spec. SMPTE 378M).
  • OP1B: Operational Pattern 1B (spec. SMPTE 391M).

Additional FFmpeg parameters

Function Description
split_channel Depending on the Panasonic P2 AVC-Intra format, the encoded files need to be separate video and audio MXF files. In this case, the different audio channels are encoded as separate mono PCM files in an MXF container, e.g. a four channel input file will be encoded to a Panasonic P2 AVC-Intra with one MXF video file and four mono channel MXF audio files.
Usage: -split_channel 1 (see Panasonic for more details).
split_track Some MXF specifications require one separate video and one separate audio MXF file with all tracks included. In this case, the different audio channels are encoded in a separate single PCM file in an MXF container, e.g. a four channel input file will be encoded to one MXF video file and one MXF audio file with four audio tracks.
Usage: -split_track 1 (see Command line examples for more details)

Force key frame settings

The MainConcept AVC Broadcast Encoder plug-in offers an option to force the current frame to become an IDR frame with FFmpeg. This option is essential for adaptive bitrate streaming formats like Apple HLS and MPEG-DASH for creating segments that only occur at key frames. This will provide smooth proper playback of the segments.

You can use FFmpeg's generic force_key_frames parameter to specify when a new IDR frame should be set. However, you also need to define some MainConcept AVC/H.264 Video Encoder parameters via -omx_param. So if -force_key_frames 'expr:gte(t,n_forced*N)' is present (N is the number of seconds) then you should disable internal idr_interval (set it to 0), which means infinite GOP. If you want to get additional I-frames at scene cuts, the vcsd_mode must be set to 1.

There are currently two typical use cases to set force_key_frames in FFmpeg:

  1. ...-force_key_frames 'expr:gte(t,n_forced*N) ... -omx_param "... :idr_interval=0:vcsd_mode= 0:..."

    IDR-frames are only at every framerate*N position.

  2. ...-force_key_frames 'expr:gte(t,n_forced*N) ... -omx_param "... :idr_interval=0:vcsd_mode= 1:idr_frequency=0:..."

    IDR-frames are at every framerate*N position plus I-frames at scene cuts. The idr_frequency parameter disables IDR at scene cuts, so they are simple I-frames.

Command line examples

Note
The command line examples below are Windows specific. To run examples on Linux, you must slightly modify them. Instead of -omx_core omxil_core.dll, you need to specify -omx_core libomxil_core.so on Linux.

Sony

fmpeg -i source_1920x1080.m2ts -vf scale=3840:2160 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_XAVC_4k:acc_type=sw" output_h264_xavc_4k_3840x2160.264
ffmpeg -i source_1920x1080.m2ts -vf scale=3840:2160 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_XAVC_4k_422:acc_type=sw" output_h264_xavc_4k_422_3840x2160.264
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_XAVC_HD_MP4:acc_type=sw" output_h264_xavc_hd_1920x1080.mp4
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_XAVC_HD_MXF:acc_type=sw" output_h264_xavc_hd_1920x1080.264
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_XAVC_HD_INTRA_VBR:acc_type=sw" output_h264_xavc_hd_intra_vbr_1920x1080.mp4
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_XAVC_HD_INTRA_CLASS_50_CBG:acc_type=sw" output_h264_xavc_hd_intra_50_cbg_1920x1080.264
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_XAVC_HD_INTRA_CLASS_100_CBG:acc_type=sw" output_h264_xavc_hd_intra_100_cbg_1920x1080.264
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_XAVC_HD_INTRA_CLASS_200_CBG:acc_type=sw" output_h264_xavc_hd_intra_200_cbg_1920x1080.264
ffmpeg -i source_1920x1080.m2ts -vf scale=3840:2160 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_XAVC_2K_INTRA_CLASS_100_CBG:acc_type=sw" output_h264_xavc_4k_intra_100_cbg_3840x2160.264
ffmpeg -i source_1920x1080.m2ts -vf scale=3840:2160 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_XAVC_4K_INTRA_CLASS_300_CBG:acc_type=sw" output_h264_xavc_4k_intra_300_cbg_3840x2160.264
ffmpeg -i source_1920x1080.m2ts -vf scale=4096:2160 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_XAVC_4K_INTRA_CLASS_480_CBG:acc_type=sw" output_h264_xavc_4k_intra_480_cbg_4096x2160.264
ffmpeg -i source_1920x1080.m2ts -vf scale=3840:2160 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_XAVC_2K_INTRA_CLASS_100_VBR:acc_type=sw" output_h264_xavc_4k_intra_100_vbr_3840x2160.264
ffmpeg -i source_1920x1080.m2ts -vf scale=3840:2160 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_XAVC_4K_INTRA_CLASS_300_VBR:acc_type=sw" output_h264_xavc_4k_intra_300_vbr_3840x2160.264
ffmpeg -i source_1920x1080.m2ts -vf scale=4096:2160 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_XAVC_4K_INTRA_CLASS_480_VBR:acc_type=sw" output_h264_xavc_4k_intra_480_vbr_4096x2160.264
ffmpeg -i source_1920x1080.m2ts -vf scale=3840:2160 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_XAVC_QFHD_INTRA_CLASS_300_CBG:acc_type=sw" output_h264_xavc_qfhd_intra_300_cbg_3840x2160.264
ffmpeg -i source_1920x1080.m2ts -vf scale=3840:2160 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_XAVC_QFHD_INTRA_CLASS_480_CBG:acc_type=sw" output_h264_xavc_qfhd_intra_480_cbg_3840x2160.264
ffmpeg -i source_1920x1080.m2ts -vf scale=3840:2160 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_XAVC_QFHD_INTRA_CLASS_300_VBR:acc_type=sw" output_h264_xavc_qfhd_intra_300_vbr_3840x2160.264
ffmpeg -i source_1920x1080.m2ts -vf scale=3840:2160 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_XAVC_QFHD_INTRA_CLASS_480_VBR:acc_type=sw" output_h264_xavc_qfhd_intra_480_vbr_3840x2160.264
ffmpeg -i source.h264 -c copy -f omx_mxf_mux -omx_core omxil_core.dll -omx_format_name OMX.MainConcept.mux_mxf.other -omx_format_param "mplex_type=XAVC_MEL:profile=MXF_PROF_SONY_XDCAM:operational_pattern=OP1A" output.mxf -y
ffmpeg -i source.h264 -c copy -f omx_mxf_mux -omx_core omxil_core.dll -omx_format_name OMX.MainConcept.mux_mxf.other -omx_format_param "mplex_type=XAVC_SXS:profile=MXF_PROF_SONY_XDCAM: operational_pattern=OP1A" 468908959_output2.mxf -y
ffmpeg -i source_1920x1080.m2ts  -vf scale=3840:2160 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_XAVC_4K_INTRA_CLASS_300_VBR:acc_type=sw" -f omx_mxf_mux -omx_core omxil_core.dll -omx_format_name OMX.MainConcept.mux_mxf.other -omx_format_param "mplex_type=XAVC_SXS:profile=MXF_PROF_SONY_XDCAM: operational_pattern=OP1A" output_H264_XAVC_4K_INTRA_CLASS_300_VBR.mxf -y

Panasonic

ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_INTRA_CLASS_50:acc_type=sw" output_h264intra_class_50_1920x1080.264
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_INTRA_CLASS_100:acc_type=sw" output_h264intra_class_100_1920x1080.264
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_INTRA_CLASS_200:acc_type=sw" output_h264intra_class_200_1920x1080.264
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_P2_HD_INTRA_422:acc_type=sw" output_h264intra_hd_422_1920x1080.264
ffmpeg -i source_1920x1080.m2ts -vf scale=2048:1080 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_P2_2K_INTRA_422:acc_type=sw" output_h264intra_2k_422_2048x1080.264
ffmpeg -i source_1920x1080.m2ts -vf scale=3840:2160 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_P2_4K_INTRA_422:acc_type=sw" output_h264intra_4k_422_3840x2160.264
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_LONG_GOP_420_CLASS_G6:acc_type=sw" output_h264longgop_420_g6_1920x1080.264
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_LONG_GOP_420_CLASS_G12:acc_type=sw" output_h264longgop_420_g12_1920x1080.264
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_LONG_GOP_422_CLASS_G25:acc_type=sw" output_h264longgop_422_g25_1920x1080.264
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_LONG_GOP_422_CLASS_G50:acc_type=sw" output_h264longgop_422_g50_1920x1080.264
ffmpeg -i avcIntra100.h264 -c copy -f omx_mxf_mux -omx_core omxil_core.dll -omx_format_name OMX.MainConcept.mux_mxf.other -omx_format_param "mplex_type=P2_AVCI:profile=MXF_PROF_PANASONIC_P2:operational_pattern=OPATOM" 1234AB.mxf -y
ffmpeg -I source.h264 -c copy -f omx_mxf_mux -omx_core omxil_core.dll -omx_format_name OMX.MainConcept.mux_mxf.other -omx_format_param "mplex_type=P2_AVC_ULTRA:profile=MXF_PROF_PANASONIC_P2:operational_pattern=OP1B" AB12CD0EF.mxf -y
ffmpeg -i source.mp4 -c copy -f omx_mxf_mux -omx_core omxil_core.dll -omx_format_name OMX.MainConcept.mux_mxf.other -omx_format_param "mplex_type=P2_AVC_ULTRA:profile=MXF_PROF_PANASONIC_P2:dm_xml_filename=003CC0CC.xml:dm_thumbnail_filename=003CC0CC.bmp:operational_pattern=OP1B" AA23AB0CD.mxf -y
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_INTRA_CLASS_200:acc_type=sw" -f omx_mxf_mux -omx_core omxil_core.dll -omx_format_name OMX.MainConcept.mux_mxf.other -omx_format_param "mplex_type=P2_AVCI:profile=MXF_PROF_PANASONIC_P2:operational_pattern=OPATOM" -split_channel 1 123456.mxf -y
ffmpeg -i source.wmv -vf scale=1920:1080 -c:v omx_enc_avc -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_LONG_GOP_420_CLASS_G6:acc_type=sw" -c:a pcm_s24le -ar 48000 -f omx_mxf_mux -omx_core omxil_core.dll -omx_format_name OMX.MainConcept.mux_mxf.other -omx_format_param "mplex_type=P2_AVC_ULTRA:profile=MXF_PROF_PANASONIC_P2:dm_xml_filename=source.XML:dm_thumbnail_filename=source.BMP:operational_pattern=OP1B" 001KB0OR.mxf -y

If your input has two or more audio streams and if it is required to split it by channel, you should map the video before the audio like in the example below:

ffmpeg -i source_1920x1080.m2ts -map 0:v -map 0:a -c:a pcm_s24le -c:v omx_enc_avc -omx_name:v OMX.MainConcept.enc_avc.video -f omx_mxf_mux -omx_core omxil_core.dll -omx_format_name OMX.MainConcept.mux_mxf.other -omx_format_param "mplex_type=P2_AVCI:profile=MXF_PROF_PANASONIC_P2" -split_channels 1 1234AB.mxf -y
Note
The muxed Panasonic P2 DVCPRO and the P2 AVC-Intra Class presets require a special filename structure, otherwise format verification tests might fail. Valid P2 filenames must consist of six characters of which the first four are numbers (0 - 9) and the last two either numbers (0 - 9) or letters (A - Z), e.g. 1234AB or 123456.
For the multiplexed Panasonic P2 AVC-Intra 422 HD, 2K and 4K, as well as all P2 AVC LongG presets, a different scheme applies. These files must be named in the form of NNNAANAA, where N is a digit and A is a digit or a capital letter, e.g. AA23AB0CD.

Apple HLS

ffmpeg -i source_1920x1080.m2ts -vf scale=416:234 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_HLS_L1:acc_type=sw" output_hls_l1_416x234_145kb.mp4
ffmpeg -i source_1920x1080.m2ts -vf scale=480:270 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_HLS_L2:acc_type=sw" output_hls_l2_480x270_365kb.mp4
ffmpeg -i source_1920x1080.m2ts -vf scale=640:360 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_HLS_L3:acc_type=iqsv" output_hls_l3_640x360_730kb.mp4
ffmpeg -i source_1920x1080.m2ts -vf scale=768:432 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_HLS_L4:acc_type=sw" output_hls_l4_768x432_1100kb.mp4
ffmpeg -i source_1920x1080.m2ts -vf scale=960:540 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_HLS_L5:acc_type=iqsv" output_hls_l5_960x540_2000kb.mp4
ffmpeg -i source_1920x1080.m2ts -vf scale=1280:720 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_HLS_L6:acc_type=sw" output_hls_l6_1280x720_3000kb.mp4
ffmpeg -i source_1920x1080.m2ts -vf scale=1280:720 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_HLS_L7:acc_type=iqsv" output_hls_l7_1280x720_4500kb.mp4
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_HLS_L8:acc_type=iqsv" output_hls_l8_1920x1080_6000kb.mp4
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_HLS_L9:acc_type=sw" output_hls_l9_1920x1080_7800kb.mp4

MPEG-DASH

ffmpeg -i source_1920x1080.m2ts -vf scale=768:432 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_DASH_L1:acc_type=sw" output_dash_l1_768x432_400kb.mp4
ffmpeg -i source_1920x1080.m2ts -vf scale=768:432 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_DASH_L2:acc_type=sw" output_dash_l2_768x432_600kb.mp4
ffmpeg -i source_1920x1080.m2ts -vf scale=768:432 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_DASH_L3:acc_type=iqsv" output_dash_l3_768x432_800kb.mp4
ffmpeg -i source_1920x1080.m2ts -vf scale=1280:720 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_DASH_L4:acc_type=sw" output_dash_l4_1280x720_1200kb.mp4
ffmpeg -i source_1920x1080.m2ts -vf scale=1280:720 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_DASH_L5:acc_type=iqsv" output_dash_l5_1280x720_1750kb.mp4
ffmpeg -i source_1920x1080.m2ts -vf scale=1280:720 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_DASH_L6:acc_type=sw" output_dash_l6_1280x720_2400kb.mp4
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_DASH_L7:acc_type=sw" output_dash_l7_1920x1080_3500kb.mp4
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_DASH_L8:acc_type=iqsv" output_dash_l8_1920x1080_5300kb.mp4
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_DASH_L9:acc_type=sw" output_dash_l9_1920x1080_8400kb.mp4
ffmpeg -i source_1920x1080.m2ts -vf scale=3840:2160 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_DASH_L10:acc_type=sw" output_dash_l10_3840x2160_15mb.mp4
ffmpeg -i source_1920x1080.m2ts -vf scale=3840:2160 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_DASH_L11:acc_type=sw" output_dash_l11_3840x2160_20mb.mp4
ffmpeg -i source_1920x1080.m2ts -vf scale=3840:2160 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_DASH_L12:acc_type=iqsv" output_dash_l12_3840x2160_25mb.mp4

Miscellaneous

ffmpeg -i source_1920x1080.m2ts -vf scale=768:432 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_Baseline:acc_type=sw" output_h264baseline_768x432.mp4
ffmpeg -i source_1920x1080.m2ts -vf scale=416:234 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_CIF:acc_type=sw" output_h264baseline_416x432.mp4
ffmpeg -i source_1920x1080.m2ts -vf scale=720:576 -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_D1:acc_type=iqsv" output_h264d1_720x576.mp4
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_MAIN:acc_type=sw" output_h264main_1920x1080.mp4
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_HIGH:acc_type=iqsv" output_h264high_1920x1080.mp4
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_OPTIMIZED_HIGH:acc_type=sw" output_h264high_1920x1080.mp4
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_HIGH_10:acc_type=sw" output_h264high_10_1920x1080.mp4
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_HIGH_422:acc_type=sw" output_h264high_422_1920x1080.mp4
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_INTRA_HIGH_10:acc_type=sw" output_h264intra_high_10_1920x1080.264
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_INTRA_CLASS_50_RP2027:acc_type=sw" output_h264intra_class_50_rp2027_1920x1080.264
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_INTRA_CLASS_100_RP2027:acc_type=sw" output_h264intra_class_100_rp2027_1920x1080.264
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_avc -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_avc.video  -omx_param "preset=H264_INTRA_CLASS_200_RP2027:acc_type=sw" output_h264intra_class_200_rp2027_1920x1080.264
ffmpeg -i source.mp4 -map 0:v:0 -c:v:0 copy -map 0:a:0 -c:a:0 pcm_s24le -r:a 48000 -f omx_mxf_mux -omx_core omxil_core.dll -omx_format_name OMX.MainConcept.mux_mxf.other -opatom 0 -r 29.97 output.mxf -y
ffmpeg -i source.mp4 -map 0:v:0 -c:v:0 copy -map 0:a:0 -c:a:0 pcm_s24le -r:a 48000 -f omx_mxf_mux -omx_core omxil_core.dll -omx_format_name OMX.MainConcept.mux_mxf.other -opatom 1 -r 29.97 output.mxf -y
ffmpeg -i source.mp4 -map 0:v:0 -c:v:0 omx_enc_avc -omx_core omxil_core.dll -omx_name:v OMX.MainConcept.enc_avc.video -map 0:a:0 -c:a:0 pcm_s24le -r:a 48000 -f omx_mxf_mux -omx_core omxil_core.dll -omx_format_name OMX.MainConcept.mux_mxf.other output.mxf -y
ffmpeg -i source.mp4 -map 0:v:0 -c:v:0 copy -map 0:a:0 -c:a:0 pcm_s24le -r:a:0 48000 -map 0:a:0 -c:a:1 pcm_s24le -r:a:1 48000 -map 0:a:0 -c:a:2 pcm_s24le -r:a:2 48000 -f omx_mxf_mux -omx_core omxil_core.dll -omx_format_name OMX.MainConcept.mux_mxf.other -opatom 1 -r 29.97 output.mxf -y
ffmpeg -ac 2 -f s16le -acodec pcm_s16le -i source_ac2_s16le.pcm -i source.h264 -f omx_mxf_mux -omx_core omxil_core.dll -omx_format_name OMX.MainConcept.mux_mxf.other output2.mxf -y
ffmpeg -i source.mp4 -vf scale=1920:1080 -c:v omx_enc_avc -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_INTRA_CLASS_100_RP2027:acc_type=sw" -c:a pcm_s24le -ar 48000 -f omx_mxf_mux -omx_core omxil_core.dll -omx_format_name OMX.MainConcept.mux_mxf.other -omx_format_param "mplex_type=DEFAULT:profile=MXF_PROF_DEFAULT" -split_track 1 output_h264intra_class_100_rp2027_1920x1080.mxf -y

Parameters

The MainConcept AVC Broadcast Encoder plug-in for FFmpeg comes with a couple of sample config (*.ini) files that cover the following encoder settings and parameters. You can modify them manually in a normal text editor and pass them to FFmpeg via

-omx_param "cfg_file_path=<...>"
Note
It is also possible to create additional AVC/H.264 Encoder configuration files using TotalCode Studio. In the application, select the desired AVC/H.264 preset and then export the settings within the configuration file. Navigate to File > Export > Target Settings and specify a name for the *.ini file. The "....video.ini" file can now be used in the FFmpeg plug-in.

Parameter priority order

There is a specific priority order when passing parameters to FFmpeg on the command-line. It is important to be aware of this as it can have a crucial impact on the expected encoder output:

  • omx_param: This has the highest priority and overrides everything that was previously set via cfg_file or via FFmpeg options
  • cfg_file: This only overrides FFmpeg options
  • FFmpeg options: These have the lowest priority

Parameter priority order example

Method Setting
file.ini
(setting framerate to 24 fps)
    [AVC Settings]
    time_scale=27000000
    num_units_in_tick=1125000
ffmpeg_cmdline
(Windows)
   ffmpeg -r 27 -pix_fmt yuv420p -s 1920x1080 -i file1920x1080.yuv \ 
   -c:v omx_enc_avc -omx_core omxil_core.dll \ 
   -omx_name OMX.MainConcept.enc_avc.video \ 
   -omx_param "force_omx_param=1:cfg_file_path=file.ini:[AVC Settings]:time_scale=20000000:num_units_in_tick=1000000" ffmpeg_res_filename.h264
ffmpeg_cmdline
(Linux)
    ffmpeg -r 27 -pix_fmt yuv420p -s 1920x1080 -i file1920x1080.yuv \ 
   -c:v omx_enc_avc -omx_core libomxil_core.so \ 
   -omx_name OMX.MainConcept.enc_avc.video \ 
   -omx_param "force_omx_param=1:cfg_file_path=file.ini:[AVC Settings]:time_scale=20000000:num_units_in_tick=1000000" ffmpeg_res_filename.h264 

The resulting file will have 20 fps (as defined in omx_param) instead of 24 fps, which was pre-defined in the cfg_file and defined in the FFmpeg settings as 27 fps.

[AVC Settings]

AVC settings are covered under the following:


General parameters

profile_id

AVC/H.264 Profile used to encode.
  • 0: Baseline
  • 1: Main
  • 2: Extended
  • 3: High
  • 4: High 10
  • 5: High 4:2:2

level_id

AVC/H.264 level used to maintain conformance of encoded file. Depending on the level_id, there are several limits, e.g. maximal frame size in macroblocks or maximal bitrate. See Table A-1 of the AVC/H.264 Encoder standard (ISO/IEC 14496-10) for details.
  • 10: Level 1
  • 11: Level 1.1
  • 12: Level 1.2
  • 13: Level 1.3
  • 16: Level 1b
  • 20: Level 2
  • 21: Level 2.1
  • 22: Level 2.2
  • 30: Level 3
  • 31: Level 3.1
  • 32: Level 3.2
  • 40: Level 4
  • 41: Level 4.1
  • 42: Level 4.2
  • 50: Level 5
  • 51: Level 5.1
  • 52: Level 5.2
  • 60: Level 6
  • 61: Level 6.1
  • 62: Level 6.2
  • 100: Auto mode. The encoder detects the level according to the picture size, bitrate, frame rate, etc.

idr_frequency

Defines how often I-frames are IDRs. Note that you can correctly re-encode only those parts of a stream which begin from IDR and end with a frame just before IDR.
Note
If you set the FFmpeg generic force_key_frames parameter, see Force key frame settings.
  • 0: Only first picture will be IDR
  • 1: Every I-picture will be IDR
  • 2: Every second I-picture will be IDR, etc.

idr_interval

Maximum distance between two I-frames. The value must be a multiple of the reordering_delay field.
If you set the FFmpeg generic force_key_frames parameter, see Force key frame settings.
  • Valid values are 0 .. 300 (default value is 33).
  • Set value 0 to enable infinite GOP.
  • With value 1 only I-frames are generated.

reordering_delay

Maximum distance between two P-frames. If this value is set to 1, there will be no B-frames generated. Available range is 1 .. 8.

interlace_mode

Specifies whether video is encoded frame-based or field-based.
  • 0: Progressive
  • 1: Interlaced
  • 2: MABFF

def_horizontal_size

Width of the encoded video frame.

def_vertical_size

Height of the encoded video frame.

frame_rate

Framerate of the encoded video.

Motion search settings

num_reference_frames

Number of reference pictures used. Available range is between 0 .. 16.

search_range

Motion vector search range in units of luma frame samples that defines the maximum length of a vector. This field depends on level_id. See Table A-1 of the AVC/H.264 Encoder standard (ISO/IEC 14496-10).

max_l0_active

Maximum index of reference frames in List0. Default value is 0 (Auto).

max_l1_active

Maximum index of reference frames in List1. Default value is 0 (Auto).

Quantization parameters

quant_pI

Macroblock quantization parameter value for I slices to use in constant quantization bitrate mode. Available range is 0 .. 51.

quant_pP

Macroblock quantization parameter value for P slices to use in constant quantization bitrate mode. Available range is 0 .. 51.

quant_pB

Macroblock quantization parameter value for B slices to use in constant quantization bitrate mode. Available range is 0 .. 51.

Bitrate control

bit_rate_mode

Bitrate control mode.
  • 0: CBR
  • 1: CQT
  • 2: VBR

bit_rate_buffer_size

VBV size. This field specifies the size of the Hypothetical Reference Decoder (HRD) Coded Picture Buffer (CPB) or VBV (old MPEG name). This value should be adjusted to bit_rate (CBR), respectively max_bit_rate (VBR), to avoid DTS/PTS underflows during multiplexing. Depending on vbv_buffer_units, this value is taken as bits (vbv_buffer_units = H264_HRD_UNIT_BIT or H264_HRD_UNIT_BIT_90K) or bytes (vbv_buffer_units = H264_HRD_UNIT_BYTE_PERCENT). Due to encoder limitations, the value is restricted to the maximum signed integer value for bits and (maximum signed integer value)/8 for bytes accordingly.

bit_rate

Target bitrate (bits per second) of encoded video sequence. Due to encoder limitations value is restricted to maximum signed integer value.

max_bit_rate

Hypothetical Stream Scheduler (HSS) delivery rate or the rate at which VBV buffer is filled, not real maximum peak rate. Maximum peak rate is unrestricted by AVC spec. Restrictions come from HSS rate and VBV buffer size, so reducing any of them will result in peak rate reduction. This value is only needed for H264_VBR mode and should be greater than bit_rate to give rate controller a bit more space for work. Due to encoder limitations, the value is restricted to the maximum signed integer value.

Prediction

inter_search_shape

Type of subblock search for macroblocks.

Coding mode

entropy_coding_mode

Entropy coding mode.
  • 0: CAVLC
  • 1: CABAC

use_hadamard_transform

Use Hadamard transformation to get higher compression ratio. Available values are 0, 1 and 2 (use Hadamard transformation only on reference frames).

VUI parameters

sar_width

Sample aspect ratio: vertical sample size in arbitrary units. Cannot be used together with picture aspect ratio parameters as soon as these parameters are interchangeable. If usage of sample aspect ratio is preferable, set both picture aspect ratio parameters (pic_ar_x and pic_ar_y) to -1 and vice versa.

sar_height

Sample aspect ratio: horizontal sample size in arbitrary units. Cannot be used together with picture aspect ratio parameters as soon as these parameters are interchangeable. If usage of sample aspect ratio is preferable, set both picture aspect ratio parameters (pic_ar_x and pic_ar_y) to -1 and vice versa.

video_format

Type of video representation.
  • -1: Auto
  • 0: Component
  • 1: PAL
  • 2: NTSC
  • 3: SECAM
  • 4: MAC
  • 5: Unspecified

time_scale

Number of time units that pass in one second. Use together with num_units_in_tick (frame_rate = time_scale / num_units_in_tick) to calculate exact frame rate of a stream. By default, time_scale is set to 27000000 (27 MHz clock).

num_units_in_tick

Number of time units of a clock operating at the frequency time_scale Hz that corresponds to one clock tick. Use together with time_scale (frame_rate = time_scale / num_units_in_tick) to calculate exact frame rate of a stream.

Advanced settings

vbv_buffer_fullness

Initial VBV fullness. See the HRD Buffer Model in the ISO/IEC 14496-10 specifications for details. For best quality we recommend setting the VBV Buffer to the level limit.

vbv_buffer_fullness_trg

Target VBV fullness when decoding is done.

vbv_buffer_units

Units of VBV-fullness and buffer size.
  • 0: Original units (byte percent)
  • 1: All parameters are in bits
  • 2: All parameters are in 90 kHz clock units

cpb_removal_delay

CPB removal delay for the first picture (needed for segment merging). Information on CPB removal delay is carried in the Picture timing SEI message. The cpb_removal_delay value should be equal to the distance to the previous IDR frame given in field units. This parameter may be used for segment re-encodings or seamless joining of several H.264 streams.

bit_rate_scale

External setting of bit_rate_scale (avoids recalculation of bitrate).

cpb_size_scale

External setting of cpb_size_scale (avoids recalculation of bitrate)

max_frame_size

Maximum byte size for I, P, B-reference and B frames. This value has no effect for CQT.

min_frame_size

Minimum byte size for I, P, B-reference and B frames.

hrd_maintain

HRD conformance. Maintain NAL-based hypothetical reference decoder model.
  • 0: Disable HRD model.
  • 1: Enable HRD model.

hrd_low_delay

Enables HRD low delay mode.
  • 0: Low delay HRD disabled
  • 1: Low delay HRD enabled

smooth_factor

Specifies the quantizer curve compression smooth factor. If set to 0, the feature is disabled.

hrd_preview

Quality feature (turned on by default). The encoder performs preliminary analysis on defined frame window. Frame window is set by the means of encoding_buffering. Frames are delivered with an expected delay in this case.

slice_arg

Number of slices per picture. Available range is from 1 slice per picture to the height of the encoded picture in macroblock units (or macroblock pairs for H264_MBAFF). On the systems with multiple logical or physical CPU using of more than 1 slice will accelerate encoding due to independent slice encoding.

b_slice_reference

Enables usage B pictures as a reference pictures.

b_slice_pyramid

Enables usage of pyramidal GOP structure (...B Br B...).

cb_offset

Chroma quality offset (-X to increase quality, +X to decrease quality). For High profile and higher this is Cb chroma quantization offset. For the rest of the profiles it is used as chroma quantization offset (both Cb and Cr). Should be in the range [-12, 12]. This parameter used together with cr_offset can save (or cut) some quality in chroma components, therefore chroma quality can either be increased (cb_offset < 0) or decreased (cb_offset > 0). Suitable values are between -2 and 2 or potentially slightly more.

cr_offset

Chroma quality offset (-X to increase quality, +X to decrease quality). For High profile and higher this is Cr chroma quantization offset. For the rest of the profiles it is unused and is not written in an stream. Should be in the range [-12, 12]. This parameter used together with cb_offset can save (or cut) some quality in chroma components, therefore chroma quality can either be increased (cr_offset < 0) or decreased (cr_offset > 0). Suitable values are between -2 and 2 or potentially slightly more.

me_subpel_mode

Describes subpixel motion search depth.
  • 0: Full Pel
  • 1: Half Pel
  • 2: Quarter Pel
  • 3: Quarter Pel on reference picture

me_weighted_p_mode

Enables explicit weighted prediction usage for P-frames. Useful for compensating flashes, fades etc.

me_weighted_b_mode

Enables explicit weighted prediction usage for B-frames.

enable_fast_intra_decisions

Enables fast intra coding decision metrics usage to speed up encoding process. Can slightly decrease quality but will give noticeable speed improvements.
  • 0: No fast intra decisions.
  • 1: Fast intra decisions are enabled.
  • 2: Use slow decisions on reference frames and fast - on non-reference.

enable_fast_inter_decisions

Enables fast inter coding decision metrics usage to speed up encoding process. Can slightly decrease quality but will give noticeable speed improvement.
  • 0: No fast inter decisions.
  • 1: Fast inter decisions are enabled.
  • 2: Use slow decisions on reference frames and fast - on non-reference.

pic_ar_x

Picture (display) aspect ratio width. Cannot be used together with sample aspect ratio parameters as soon as these parameters are interchangeable. If usage of picture aspect ratio is preferable, set both sample aspect ratio parameters (sar_width and sar_height) to -1 and vice versa.

pic_ar_y

Picture (display) aspect ratio height. Cannot be used together with sample aspect ratio parameters as soon as these parameters are interchangeable. If usage of picture aspect ratio is preferable set both sample aspect ratio parameters (sar_width and sar_height) to -1 and vice versa.

calc_quality

Enables quality metrics calculation.
  • 0: Disabled.
  • 1: PSNR metric calculation for information purposes.
  • 2: SSIM metric calculation for information purposes.
  • 3: PSNR and SSIM metrics calculation for information purposes.

cpu_opt

Defines CPU acceleration to be used during encoding.
  • 0: Auto
  • 1: Unknown
  • 2: MMX
  • 3: MMX Ext
  • 4: SSE
  • 5: SSE2
  • 6: SSE3
  • 7: SSE4
  • 8: AVX
  • 9: AVX2

num_threads

Number of threads to be used during encoding.
  • 0: Auto mode
  • 1: Single threaded encoding
  • 2 ..256: More threads will use more CPUs/cores

live_mode

Reduces the number of reencodings to one; disables consequent reencoding of frames.

buffering

Defines the encoder input queue length in frames. Specifies the size of a buffer for input pictures. Available range is 0 .. 900. Value of 0 sets minimal possible buffer for the current settings. Beware of large values, since source frames may need a substantial amount of memory to store. This feature is useful for live capture as it may decrease frame dropping. Usage of this feature is required for hrd_preview.

min_quant

Minimum quantization parameter to use. Value range is 0 to 51.

max_quant

Maximum quantization parameter to use. Value range is 0 to 51.

max_slice_size

Maximum slice size in bits. This specifies the maximum number of bits for a slice. Default value is 0 (no limit imposed).

encoding_buffering

Number of frames to buffer encoding queue. Available range is 0 .. 900 (should be less than or equal to buffering and greater). This feature is useful for efficient maintainance of target HRD buffer fullness (vbv_buffer_fullness_trg). Use of this feature is required for hrd_preview.

ow_delay

Forces minimum encoding delay. Settings that affect encoding latency will be disabled. Default value is 0. If low_delay is set to 1, the encoder overwrites other settings to encode IPPP stream without frames buffering. low_delay can be used in two modes: synchronous (detach_thread = 0) and asynchronous (detach_thread = 1). In synchronous mode, the encoder freezes the calling thread in put frame and resumes the thread after a frame has been encoded. In asynchronous mode, the encoder works in a separate thread. All frames to be encoded are stored in a frames pool. The size of this is defined by the setting buffering.

air_mode

Defines adaptive intra refresh mode. Using this feature may be useful for improving error robustness of encoded video.
  • 0: Off
  • 1: Slow. 1 (SD) or 2 (HD) rows of intra macroblocks in every P frame.
  • 2: Medium. 2 (SD) or 4 (HD) rows of intra macroblocks in every P frame.
  • 3: Fast. 3 (SD) or 6 (HD) rows of intra macroblocks in every P frame.
  • 4: Split. 1 row of intra macroblocks per number of rows.

air_split_frequency

Specifies the frequency of intra lines for adaptive air mode split.

air_qp_offset

Specifies the QP offset for adaptive intra mode lines.

detach_thread

Runs encoder core in a new thread.

constrained_intra_pred

Constrained intra prediction for improving error resilience.

hw_acceleration

Choose hardware encoder type.
  • 0: Pure software encoding mode.
  • 1: Intel Quick Sync Video hardware acceleration.
  • 2: NVIDIA NVENC hardware acceleration.

hw_acc_idx

Hardware acceleration device index.
  • 1: Ignored. Any available device is used.
  • 2: Index of NVIDIA CUDA devices.

In-loop filter

use_deblocking_filter

Indicates whether to use deblocking for smoothing video frames.
  • 0: Do not use deblocking filter.
  • 1: Use deblocking filter.

deblocking_alphaC0_offset

Specifies the offset used in accessing alpha deblocking filter table for filtering operations controlled by the macroblocks within a slice. The value should be in the range of -6 to +6, inclusive. deblocking_beta_offset
Specifies the offset used in accessing beta deblocking filter table for filtering operations controlled by the macroblocks within a slice. The value should be in the range of -6 to +6, inclusive.

adaptive_deblocking

Enables the usage of deblocking filter with alternative offsets related to the quantizer or with standard ones. With alternative offsets, encoder applies less deblocking for lower quantizers to keep more details in the encoded video).

Type parameters

video_type

AVC/H.264 encoder preset.

video_pulldown_flag

Specifies the NTSC pulldown generated in the video stream. It should only be used if the input (original) video frame rate is 23.976 or 24 frames per second. When enabled, it encodes 23.976fps as 29.97 (59.94) fps or 24fps as 30 (60) fps, using the pic_struct flag in the Picture timing SEI message. The frame_rate parameter should be specified as target frame rate (i.e. 29.97, 30, 59.94 or 60). Video pulldown can only be applied to a frame, i.e. interlace_mode can be equal only to H.264 Progressive or H.264 MBAFF.
  • 0: No pulldown.
  • 1: 2:3 pulldown (frame 1 is 2 fields, frame 2 is 3 fields, ...). 23.97 and 24 played as 29.97 and 30, respectively.
  • 2: 3:2 pulldown (frame 1 is 3 fields, frame 2 is 2 fields, ...). 23.97 and 24 played as 29.97 and 30, respectively.
  • 4: 2:3 pulldown (frame doubling, frame tripling, ...). 23.97/24 played as 59.94 and 60, respectively.
  • 5: 3:2 pulldown (frame tripling, frame doubling, ...). 23.97/24 played as 59.94 and 60, respectively.
  • 6: Auto. Adaptive mode.
  • 7: 2:2 pulldown. Every frame is displayed twice.
  • 8: 3:3 pulldown. Every frame is displayed three times.

File/stream parameters

stream_type

Defines the sort of NALU types being written into stream.
  • 0: Stream Type I. NALUs + filler data
  • 1: Stream Type I SEI. NALUs + filler data + SEI messages.
  • 2: Stream Type II. All NALU type.
  • 3: Stream Type II, except SEI messages.

bit_depth_luma

Bit depth of the encoded luminance samples. Note that bit_depth_luma and bit_depth_chroma need to be set to the same value.
  • 8: 8-bit
  • 10: 10-bit

bit_depth_chroma

Bit depth of the encoded chrominance samples. Note that bit_depth_chroma and bit_depth_luma need to be set to the same value.
  • 8: 8-bit
  • 10: 10-bit

chroma_format

Chrominance sampling
  • 1: 4:0:0
  • 2: 4:2:0
  • 3: 4:2:2

vui_presentation

Configures video usability information (VUI) parameters header appearing in SPS. Parameter can be either set to 0 and encoder configures VUI parameters automatically depending on the other settings.
  • 0: Auto. Configures the video usability information appearing in the SPS header automatically (depending on the other encoder settings).
  • 1: Customize. Enable combination of the following flags for configure the video usability information appearing in the SPS.
  • 2: Enable aspect_ratio_info_present_flag.
  • 4: Enable overscan_info_present_flag.
  • 8: Enable video_signal_type_present_flag.
  • 10: Enable colour_description_present_flag. The "video_signal_type_present_flag" should be enabled as well.
  • 20: Enable chroma_loc_info_present_flag (not supported).
  • 40: Enable timing_info_present_flag.
  • 80: Enable nal_hrd_parameters_present_flag.
  • 100: Enable vcl_hrd_parameters_present_flag.
  • 200: Enable pic_struct_present_flag.
  • 400: Enable bitstream_restriction_flag.

write_au_delimiters

Write access unit delimiters. Access unit delimiters may be used to indicate the type of slices present in a primary coded picture and to simplify the detection of the boundary between access units (e.g. frames).

write_seq_end_code

Write sequence end code. End of sequence code may be used to specify that the next subsequent access unit in the bitstream in decoding order should be an IDR access unit, starting with new sequence parameter set.
  • 0: Do not write sequence end code.
  • 1: Write sequence end code at the end of a stream.
  • 2: Write sequence end code before IDR picture and at the end of a stream.
Note
FFmpeg does not support end of sequence AU code when using the AVC Encoder plug-in. If you use it, this will lead to variable or wrong frame rates reported by Mediainfo. As a workaround, you can set write_seq_end_code=0 to avoid variable or wrong frame rates.

write_timestamps

Write picture timing information into Picture Timing SEI of the encoded stream.
  • 0: Do not write timecode information.
  • 1: Write timecodes using format with full_timestamp_flag = 0 and optional timecode fields (seconds_flag, minutes_flag, hour_flag).
  • 2: Write timecodes using format with full_timestamp_flag = 1 and persistent timecode fields.

timestamp_offset

Frame-based offset (in number of frames) for timestamps (i.e DTS/PTS). Can be used for example for segment reencoding to guarantee continuous timings.

drop_frame_timecode

Use NTSC drop frame timecode notation for 29.97 and 59.94 target frame rates.

write_single_sei_per_nalu

Encapsulates each SEI message into its own NAL unit.

write_seq_par_set

Controls writing of sequence parameter set (SPS) into a stream.
  • 0: SPS once per IDR.
  • 1: SPS once per I frame.

write_pic_par_set

Controls writing of picture parameter set (PPS) into a stream.
  • 0: PPS once per IDR.
  • 1: PPS once per I-frame.
  • 2: PPS once per picture.

log2_max_poc

Specifies custom log2_max_pic_order_cnt_lsb_minus4 value. Available range is [4, 16], default value is 8.

log2_max_frame_num

Specifies custom log2_max_frame_num_minus4 value. Available range is [4, 16], default value is 8.

pic_order_cnt_type

Specifies custom pic_order_cnt_type value. Available values are 0 (default) and 2. Picture order count type 2 can only be used for streams with identical decoding and presentation orders, i.e. containing no B frames.

pic_order_present_flag

Controls bottom_field_pic_order_in_frame_present_flag value in PPS (e.g. for SBTVD-T).

fixed_frame_rate

Controls fixed_frame_rate_flag in VUI. frame_based_timing
Write frame rate in VUI (instead of field rate by default).
  • 0: VUI's time_scale / num_units_in_tick equals to the field rate
  • 1: VUI's time_scale / num_units_in_tick equals to the frame rate

frame_packing_arrangement_mode

Specifies a mode for writing frame packing arrangement SEI messages.
  • 0: Do not write frame packing arrangement SEI messages.
  • 1: Write SEI messages with frame_packing_arrangement_type = 0. Each component plane of the decoded frames contains a "checkerboard" based interleaving of corresponding planes of two constituent frames.
  • 2: Write SEI messages with frame_packing_arrangement_type = 1. Each component plane of the decoded frames contains a column-based interleaving of corresponding planes of two constituent frames.
  • 3: Write SEI messages with frame_packing_arrangement_type = 2. Each component plane of the decoded frames contains a row-based interleaving of corresponding planes of two constituent frames.
  • 4: Write SEI messages with frame_packing_arrangement_type = 3. Each component plane of the decoded frames contains a side-by-side packing arrangement of corresponding planes of two constituent frames.
  • 5: Write SEI messages with frame_packing_arrangement_type = 4. Each component plane of the decoded frames contains a top-bottom packing arrangement of corresponding planes of two constituent frames.

write_pic_timing_sei

Enables the writing of a Picture timing SEI message.
  • 0: Do not write Picture timing SEI message
  • 1: Write Picture timing SEI message

normalize_dts

Makes the decoded timestamp (DTS) start with 0.

Scene detection

vcsd_mode

Visual content scene detection (VCSD). Feature is useful for getting better quality on scene changes.
If you set the FFmpeg generic force_key_frames parameter, see Force key frame settings.
  • 0: Disable scene detection.
  • 1: Sets IDR frame at any scene change.

Advanced GOP settings

min_idr_interval

Minimum number of frames between I-frames. This parameter forces the usual distance between I-frames if SCD detects I-frame after less than min_idr_interval frames from previous one. The SCD forced I-frame can be discarded when the distance to the next chapter point is less than min_idr_interval. Available values from 1 to idr_interval if idr_interval > 0, otherwise min_idr_interval can be from 1 (which means no limitation for minimal GOP length) to maximal signed 32-bit integer (which means in practice that no I-frames will be inserted at scene changes).

adaptive_b_frames

Enables adaptive B-frames placement. This parameter is used together with vcsd_mode and allows to use adaptive B-frames placement depending on sequence complexity.
  • 0: Fixed placement.
  • 1: Adaptive placement.

idr_frequency

Defines how often I-frames are IDRs.
  • 0: Only first picture will be IDR.
  • 1: Every I-picture will be IDR.
  • 2: Every second I-picture will be IDR, etc.

field_order

Sets field order.
  • 0: Top field first.
  • 1: Bottom field first.

fixed_i_position

Sets I-frame at multiple of idr_interval positions.

isoleted_gops

Allows to limit referencing for frames come after non-IDR I-frame to frames before non-IDR I-picture. It may be useful for avoiding certain stream seeking problems when idr_frequency is not equal to 1 (i.e. some I-frames are non-IDR I-frames).
  • 0: Do not limit referencing.
  • 1: Only allow the first group of B-frames to use frames before non-IDR I-frame as a reference picture.

leading_b_frames

Enables placement of B-frames before an I-frame in display order. For correct usage of this feature, isolated_gops should be set to 0.
  • 0: Disable placement of B-frames
  • 1: Enable placement of B-frames
Note
B frames that precede an IDR frame will have a negative picture order count (POC).

Advanced ME settings

fast_multi_ref_me

Enables fast decisions for multi-ref motion estimation.
  • 0: Use greedy search mode (slower but can achieve better quality)
  • 1: Use heuristic search mode (significantly faster but can loss some quality)
  • 2: Use mode 0 on reference frames and mode 1 - on non-reference

fast_sub_block_me

Enables fast decisions for sub-block motion estimation.
  • 0: Use greedy search mode (slower but can achieve better quality).
  • 1: Use heuristic search mode (significantly faster but can loss some quality).
  • 2: Use mode 0 on reference frames and mode 1 - on non-reference.

allow_out_of_pic_mvs

Controls using pixels beyond the picture boundaries for motion compensation.
  • 0: Do not use pixels outside the picture boundaries.
  • 1: Enables out of picture motion vectors.

constrained_ref_list

Use constrained reference picture list.
  • 0: Do not apply any constraints.
  • 1: Use only nearest I/P-frames for B-frame motion compensation, do not use reference B-frames for P-frame motion compensation.

motion_search_pattern

Specifies the pattern that the motion search algorithm uses to choose vectors.
  • 0: Diamond-shaped search algorithm with 9 points to check
  • 1: Thick horizontal hexagonal motion search algorithm, 7 points to check
  • 2: Flat horizontal hexagonal motion search algorithm, 7 points to check
  • 3: Thick vertical hexagonal motion search algorithm, 7 points to check
  • 4: Flat vertical hexagonal motion search algorithm, 7 points to check

Advanced Intra settings

enable_intra_big

Allows to use 16x16 intra prediction modes in intra slices. Parameter can be set to 0, 1 or combination of flags. 0 indicates 16x16 intra prediction modes won't be used for I-slices. 1 means all 16x16 intra prediction modes will be used. Combination of following flags can be used to disable specific 16x16 intra prediction modes.
  • 1: Enable 16x16 intra prediction modes usage
  • 2: Disable vertical 16x16 intra prediction mode
  • 4: Disable horizontal 16x16 intra prediction mode
  • 0: Disable plane 16x16 intra prediction mode

enable_intra_8x8

Allows to use 8x8 intra prediction modes in intra slices. Parameter can be set to 0, 1 or combination of flags. 0 indicates 8x8 intra prediction modes will not be used for I-slices. 1 means all 8x8 intra prediction modes will be used. Combination of following flags can be used to disable specific 8x8 intra prediction modes:
  • 1: Enable 8x8 intra prediction modes usage
  • 2: Disable vertical 8x8 intra prediction mode
  • 4: Disable horizontal 8x8 intra prediction mode
  • 10: Disable diagonal down left 8x8 intra prediction mode
  • 20: Disable diagonal down right 8x8 intra prediction mode
  • 40: Disable vertical right 8x8 intra prediction mode
  • 80: Disable horizontal down 8x8 intra prediction mode
  • 100: Disable vertical left 8x8 intra prediction mode
  • 200: Disable horizontal up 8x8 intra prediction mode

enable_intra_4x4

Allows to use 4x4 intra prediction modes in intra slices. Parameter can be set to 0, 1 or a combination of flags. 0 indicates 4x4 intra prediction modes will not be used for I-slices. 1 means all 4x4 intra prediction modes will be used. Combination of the following flags can be used to disable specific 4x4 intra prediction modes:
  • 1: Enable 4x4 intra prediction modes usage
  • 2: Disable vertical 4x4 intra prediction mode
  • 4: Disable horizontal 4x4 intra prediction mode
  • 10: Disable diagonal down left 4x4 intra prediction mode
  • 20: Disable diagonal down right 4x4 intra prediction mode
  • 40: Disable vertical right 4x4 intra prediction mode
  • 80: Disable horizontal down 4x4 intra prediction mode
  • 100: Disable vertical left 4x4 intra prediction mode
  • 200: Disable horizontal up 4x4 intra prediction mode

enable_intra_pcm

Allows to use PCM intra prediction mode in intra slices.

enable_inter_big

Allows to use 16x16 intra prediction modes in inter slices. Parameter can be set to 0, 1 or combination of flags. 0 indicates 16x16 intra prediction modes will not be used for inter slices. 1 means all 16x16 intra prediction modes will be used. Combination of the following flags can be used to disable specific 16x16 intra prediction modes:
  • 1: Enable 16x16 intra prediction modes usage
  • 2: Disable vertical 16x16 intra prediction mode
  • 4: Disable horizontal 16x16 intra prediction mode
  • 10: Disable plane 16x16 intra prediction mode

enable_inter_8x8

Allows to use 8x8 inter prediction modes in inter slices. Parameter can be set to 0, 1 or combination of flags. 0 indicates 8x8 inter prediction modes will not be used for I-slices. 1 means all 8x8 inter prediction modes will be used. Combination of the following flags can be used to disable specific 8x8 inter prediction modes:
  • 1: Enable 8x8 inter prediction modes usage
  • 2: Disable vertical 8x8 inter prediction mode
  • 4: Disable horizontal 8x8 inter prediction mode
  • 10: Disable diagonal down left 8x8 inter prediction mode
  • 20: Disable diagonal down right 8x8 inter prediction mode
  • 40: Disable vertical right 8x8 inter prediction mode
  • 80: Disable horizontal down 8x8 inter prediction mode
  • 100: Disable vertical left 8x8 inter prediction mode
  • 200: Disable horizontal up 8x8 inter prediction mode

enable_inter_4x4

Allows to use 4x4 inter prediction modes in intra slices. Parameter can be set to 0, 1 or combination of flags. 0 indicates 4x4 inter prediction modes will not be used for I-slices. 1 means all 4x4 inter prediction modes will be used. Combination of the following flags can be used to disable specific 4x4 inter prediction modes:
  • 1: Enable 4x4 inter prediction modes usage
  • 2: Disable vertical 4x4 inter prediction mode
  • 4: Disable horizontal 4x4 inter prediction mode
  • 10: Disable diagonal down left 4x4 inter prediction mode
  • 20: Disable diagonal down right 4x4 inter prediction mode
  • 40: Disable vertical right 4x4 inter prediction mode
  • 80: Disable horizontal down 4x4 inter prediction mode
  • 100: Disable vertical left 4x4 inter prediction mode
  • 200: Disable horizontal up 4x4 inter prediction mode

enable_inter_pcm

Allows to use PCM inter prediction mode in inter slices.

Advanced Rate Distortion Optimization (RDO) settings

fast_rd_optimization

Fast Rate Distortion (RD) methods.
  • 0: Use greedy RD-optimization method without any simplifications. Very slow, but can achieve highest possible quality. It is recommended to set this flag to 0 only when all fast decision and algorithms are disabled and all parameters that can increase quality are enabled.
  • 1: Use simplified RD-optimization method. It is much faster but can lose some quality (usual very small amount). It is recommended to use this value in usual encoding scenarios.
  • 2: Use mode 0 on reference frames and mode 1 - on non-reference ones.

quant_mode

Specifies quantization optimization mode.
  • 0: Use reference plain quantization method without any optimization. It is for debug/testing purposes only.
  • 1: Use Mode1 quant optimization. In most cases produce better results than Mode0, but never worse.
  • 2: Use Mode2 quant optimization. In most cases produce better results than Mode1 especially for Chroma components. It is recommended to increase cb_offset and cr_offset by 1 or even 2 so luminance component becomes even better while chroma will be the same as for Mode1.

grain_mode

Granular noise optimization mode. Currently not used.

grain_opt_strength

Scalable film grain optimization. This parameter is used to limit the use of intra prediction on videos with intense noise/film grain. The actual value defines penalty distortion for intra prediction modes in inter frames, which is introduced due to the fact that intra-coded macroblocks usually look a lot blockier than inter-coded ones. It is recommended to use higher strengths for very grainy or noisy material and lower strengths for less grainy material. It also makes sense to set the strength to 50 every time, although it may drop PSNR by up to 0.5 dB, but visual quality will be superior to strength 0. Computational complexity of this feature is usually negligible, so it is not considered for further descriptions of speed/quality presets. Available range is from 0 (off) to 100.

rdo_ip_4x4

Allows the RDO-based selection of the best 4x4 intra prediction mode.
  • 0: Disable RDO based selection of the best intra prediction mode for 4x4
  • 1: Enable fast RDO based selection of the best intra prediction mode for 4x4
  • 2: Enable slow RDO based selection of the best intra prediction mode for 4x4

Psycho-visual enhancement

adaptive_quant_strength

Specifies the strengths for every mode of adaptive quantization. Positive values denote coarser quantization for macroblocks with brightness / contrast / complexity higher than the average value for the current picture and vice versa. Available range for every element is -100..100, default value is 0.
  • 0: Adaptive quantization mode is driven by macroblock brightness.
  • 1: Adaptive quantization mode is driven by macroblock contrast.
  • 2: Adaptive quantization mode is driven by macroblock complexity.

denoise_strength_y

Denoise strength for luma [0..100].

denoise_strength_c

Denoise strength for chroma [0..100].

black_norm_level

Specifies pre-encoding black normalization level. Ensures any luma sample value less than or equal to black_norm_level will be set to 16. Available range is 0..255.

pulse_reduction

Specifies the strength of key frame pulsing reduction. The available range is from 0 (off) to 10 (default is 0). The feature can be useful on relatively low bitrates where key-frame pulsing reduction may be noticeable.

aq_mode

Specifies the Adaptive Quantization (AQ) mode.
  • 0: Disable adaptive quantization.
  • 2: Temporal adaptive quantization. Temporal AQ distributes bits across the pictures of a scene to improve quality on the most referenced macroblocks.
  • 3: Spatial adaptive quantization. Spatial AQ distributes bits inside the picture according to the adaptive_quant_strength setting.
Note
Temporal AQ mode is currently supported with these conditions:
  • interlace_mode must be equal to H264_PROGRESSIVE
  • me_weighted_p_mode must be equal to 0
  • me_weighted_b_mode must be equal to 0
  • adaptive_b_frames must be equal to 0

input_filtering

Specifies spatial or temporal filtering of input pictures.
  • 0: Disable input filtering
  • 1: Apply median spatial filter by 3x3 kernel
  • 2: Apply mean spatial filter by 3x3 kernel
  • 3: Apply temporal filter
Note
Input filtering is currently supported with these conditions:
  • video_type must be equal to H264_OPTIMIZED_HIGH
  • interlace_mode must be equal to H264_PROGRESSIVE
  • me_weighted_p_mode must be equal to 0
  • me_weighted_b_mode must be equal to 0
  • adaptive_b_frames must be equal to 0
  • leading_b_frames must be equal to 0
  • aq_mode must not equal H264_AQ_MODE_SPATIAL
Filtering improves the results of internal quality measurement (PSNR, SSIM). This is made possible by filtering being carried out prior to encoding. The filtered pictures are then used as the reference pictures in the quality metric calculations. It is strongly recommended to disable the internal quality metrics.

filter_low_delay_mode

Specifies a zero delay temporal filtering mode
  • 0: Use forward and backward directions for filtering (input-to-output delay is higher)
  • 1: Use only backward direction for filtering to reduce processing delay

filter_accuracy

Specifies the desired accuracy level of temporal filtering.
  • 0: Use less accurate but faster filtering
  • 1: Use balanced filtering
  • 2: Use more accurate but slower filtering

Scaling lists

seq_scaling_matrix_present_flag

Specifies that scaling_list_present_flags are present. If the scaling_matrix_present_flag is set to 0, it specifies that scaling_list_present_flags are not present and flat matrices will be used for all scaling lists (ITU-T Rec. H.264, 7.4.2.1.1).
  • 1: Apply corresponding user defined scaling list will be used for i-th scaling list.
  • 0: The corresponding default matrices will be used for i-th scaling list.

seq_scaling_list_present_flag

Specifies that the syntax structure for scaling list i is present in the sequence parameter set (SPS).
Value Block size MB prediction type Component
0 4x4 Intra Y
1 4x4 Intra Cb
2 4x4 Intra Cr
3 4x4 Inter Y
4 4x4 Inter Cb
5 4x4 Inter Cr
6 8x8 Intra Y
7 8x8 Inter Y

Appendix

This appendix contains information on the following:

Panasonic P2 AVC-Intra Folder Structure Creation

For full compliance with the Panasonic specifications, the P2 AVC-Intra presets require a special folder structure to be created. The MainConcept AVC Broadcast Encoder plug-in for FFmpeg comes with a special multi-platform python script (P2_AVCI_folder_creation.py) which allows this. It is installed together with the plug-in.

Operating system Package
Windows
C:\Program Files\MainConcept\FFmpeg-PlugIns\bin\P2_AVCI_folder_creation.py
Linux
/opt/mainconcept/sdk/share/doc/mc-mux-mxf/examples/P2_AVCI_folder_creation.py
Note
As already mentioned above, Python is required to run the script for P2 folder generation. If it is not yet available on your system, you need to download and install Python 3 before using the script. It can be found here: https://www.python.org/downloads/

In the Windows and Linux locations of the MainConcept plug-in installation, you will also find an example Panasonic P2 XML metadata file (p2_intra.xml) which is referenced in the python script.

The script creates the correct Panasonic P2 folder structure after encoding, generates a thumbnail from the video file and then renames as well as copies all required files to the corresponding P2 location. You need to run the script for the folder where the encoded Panasonic P2 MXF streams and the p2_intra.xml metadata file are located.

  • Windows
    py P2_AVCI_folder_creation.py test_folder 
    
  • Linux
    python P2_AVCI_folder_creation.py test_folder
    

The python script then automatically creates the P2 AVC-Intra folder structure (CONTENT) and updates some of the descriptive metadata from the encoded MXF files by using the p2_intra.xml as a template and copies the updated version of the XML file to /CONTENT/CLIP/1000A0.XML applying the correct P2 naming conventions. It also generates a thumbnail from the first frame of the encoded MXF file and copies it to the correct location, e.g. /CONTENT/ICON/1000A0.BMP. Finally, it renames the actual MXF audio and video files to the correct Panasonic P2 AVC-Intra naming scheme and copies them to the corresponding folders /CONTENT/AUDIO/1000A0.MXF and /CONTENT/VIDEO/1000A0.MXF.

Panasonic P2 AVC Ultra Pre-Encoding Notes

For full compliance with the Panasonic specifications, the P2 AVC-Ultra compliant AVC-Intra or AVC-LongG (Op1b SMPTE 391M) presets require some descriptive metadata (XML and thumbnail file) to be passed to the MXF multiplexer in the FFmpeg command-line. To obtain the XML and the thumbnail, you need to run a special multi-platform python script (P2_LongG_dm_creation.py) on your source file. The script is installed with the MainConcept AVC Broadcast Encoder plug-in for FFmpeg and needs to be applied prior to encoding.

  • Windows
    C:\Program Files\MainConcept\FFmpeg-PlugIns\bin\P2_LongG_dm_creation.py 
    
  • Linux
    /opt/mainconcept/sdk/share/doc/mc-mux-mxf/examples/P2_LongG_dm_creation.py
    
Note
As already mentioned above, Python is required to run the script for descriptive metadata generation. If it is not yet available on your system, you need to download and install Python 3 before using the script. It can be found here: https://www.python.org/downloads/

In the Windows and Linux locations of the MainConcept plug-in installation, you will also find an example Panasonic P2 XML metadata file (p2_long_gop.xml) that gives you an idea of how the descriptive metadata (dm) looks like.

If you want to create a valid Panasonic P2 AVC-Ultra compliant AVC-Intra or AVC-LongG file, you need to apply the script on the source (input) file before the actual FFmpeg encoding. It creates the correct XML as well as thumbnail file for encoding.

  • Windows
    py P2_LongG_dm_creation.py [source file]
    
  • Linux
    python P2_LongG_dm_creation.py [source file] 
    

After running the script on your input, two files are created: source file.XML and source file.bmp . These descriptive metadata files are now required for encoding, i.e. you must specify them on the FFmpeg command-line as follows:

  • Windows
    ffmpeg -i newsflash.mp4 -vf scale=1920:1080 -c:v omx_enc_avc -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_LONG_GOP_420_CLASS_G6:acc_type=sw" -c:a pcm_s24le -ar 48000 -f omx_mxf_mux -omx_core omxil_core.dll -omx_format_name OMX.MainConcept.mux_mxf.other -omx_format_param "mplex_type=P2_AVC_ULTRA:profile=MXF_PROF_PANASONIC_P2:dm_xml_filename=source file.XML:dm_thumbnail_filename=source file.bmp:operational_pattern=OP1B" 001KB0OR.mxf -y  
    
  • Linux
    fffmpeg -i newsflash.mp4 -vf scale=1920:1080 -c:v omx_enc_avc -omx_name OMX.MainConcept.enc_avc.video -omx_param "preset=H264_LONG_GOP_420_CLASS_G6:acc_type=sw" -c:a pcm_s24le -ar 48000 -f omx_mxf_mux -omx_core libomxil_core.so -omx_format_name OMX.MainConcept.mux_mxf.other -omx_format_param "mplex_type=P2_AVC_ULTRA:profile=MXF_PROF_PANASONIC_P2:dm_xml_filename=source file.XML:dm_thumbnail_filename=source file.bmp:operational_pattern=OP1B" 001KB0OR.mxf -y
    

The file encoded with the MainConcept AVC Broadcast Encoder plug-in for FFmpeg now includes the descriptive metadata as outlined above.

Panasonic P2 AVC Ultra Folder Structure Creation

For full compliance with the Panasonic specifications, the P2 AVC-Ultra compliant AVC-Intra or AVC-LongG (Op1b SMPTE 391M) presets require a special folder structure to be created. The MainConcept AVC Broadcast Encoder plug-in for FFmpeg comes with a special multi-platform python script (P2_LongG_folder_creation.py) that allows this. It is installed together with the plug-in. To apply this script, you need the encoded MXF file as well as a thumbnail (BMP) and descriptive metadata (XML) files generated from running the Python script (P2_LongG_dm_creation.py) from the previous chapter on the source file.

  • Windows
    C:\Program Files\MainConcept\FFmpeg-PlugIns\bin\P2_LongG_folder_creation.py
    
  • Linux
    /opt/mainconcept/sdk/share/doc/mc-mux-mxf/examples/P2_LongG_folder_creation.py 
    
Note
As already mentioned above, Python is required to run the script for P2 folder generation. If it is not yet available on your system, you need to download and install Python 3 before using the script. It can be found here: https://www.python.org/downloads/

In the Windows and Linux locations of the MainConcept plug-in installation, you also find an example Panasonic P2 XML metadata file (p2_long_gop.xml) that is referenced in the python script.

This script creates the correct Panasonic P2 folder structure after encoding. You need to run the script for the folder where the encoded Panasonic P2 MXF stream, the BMP and the XML files are located, i.e. they need to be present in the same folder. When running the script, it generates the correct P2 AVC Ultra folder structure and copies the video, thumbnail and XML files to the corresponding P2 location.

  • Windows
    py P2_LongG_folder_creation.py test_folder 
    
  • Linux
    python P2_LongG_folder_creation.py test_folder
    

The python script then automatically creates the P2 AVC Ultra or AVC-LongG (Op1b SMPTE 391M) folder structure (CONTENTS) and copies the descriptive metadata XML file to /CONTENTS/CLIP/001KB0OR.XML applying the correct P2 naming conventions. It also copies a thumbnail from the first frame of the encoded MXF file to the correct location, e.g. /CONTENTS/ICON/001KB0OR.BMP. Finally, it renames the actual MXF file to the correct Panasonic P2 naming scheme and copies it to the right folder /CONTENTS/AVCLIP/001KB0OR.MXF.