MainConcept MPEG-2 Production Format Encoder Plug-in for FFmpeg 3.1.0
MPEG-2 Production Format Encoder plug-in usage

The following briefly describes how to use the MainConcept MPEG-2 Production Format 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_mp2v \
-omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mp2v.video \
-omx_param "<mc-general-params>" \
[MP2V Settings] "<mc-codec-params>" \
<ffmpeg-output-parameters>

The following is a sample command line:

ffmpeg -s 1920x1080 -r 29.97 -i input.yuv -c:v omx_enc_mp2v -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mp2v.video -omx_param "preset=39:video_format=ntsc" ffmpeg_output.m2v

The following is a sample command line using a configuration file:

ffmpeg -s 1920x1080 -r 29.97 -i input.yuv -c:v omx_enc_mp2v -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mp2v.video -omx_param "cfg_file_path= mpeg2_config.cfg" ffmpeg_output.m2v

On Linux

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.

ffmpeg <ffmpeg-params> \
-c:v omx_enc_mp2v\
-omx_core libomxil_core.so -omx_name OMX.MainConcept.enc_mp2v.video \
-omx_param "<mc-general-params>" \
[MP2V Settings] "<mc-codec-params>" \
<ffmpeg-output-parameters>

The following is a sample command line:

ffmpeg -s 1920x1080 -r 29.97 -i input.yuv -c:v omx_enc_mp2v -omx_core omxil_core.so -omx_name OMX.MainConcept.enc_mp2v.video -omx_param "preset=39:video_format=ntsc" ffmpeg_output.m2v

The following is a sample command line using a configuration file:

ffmpeg -s 1920x1080 -r 29.97 -i input.yuv -c:v omx_enc_mp2v -omx_core omxil_core.so -omx_name OMX.MainConcept.enc_mp2v.video -omx_param "cfg_file_path= mpeg2_config.cfg" ffmpeg_output.m2v

FFmpeg options mapped to the MainConcept MPEG-2 Production Format Encoder

The following FFmpeg options are mapped from the command-line to the MainConcept MPEG-2 Production Format Encoder:

FFmpeg option Usage example
bit_rate -b:v 1M -b:a 192k
pix_fmt -pix_fmt yuv420p
gop_size -g 12
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 for the MPEG-2 Production Format Encoder (mc-general-params)

All settings below are optional parameters for omx_param parameters for the MainConcept MPEG-2 Production Format Encoder (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.
preset Specifies the built-in encoder presets. Available options are "MPEG_D10_30", "MPEG_XDCAM_IMX_30", "MPEG_XDCAM_1080_VBR_17_5", "MPEG_XDCAM_HD_422_1920", "MPEG_XDCAM_EX_1440", "MPEG_MPEG2", etc. You can also use the preset number. For more details, see Command line examples
cfg_file_path Specifies path to MPEG-2 Encoder configuration file containing all parameters for encoding.
    -omx_param "cfg_file_path=mpeg2_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 -s 1440x1080 -r 29.97 -pix_fmt yuyv422 -f rawvideo -i 1440x1080_ntsc_YUY2.raw -c:v omx_enc_mp2v -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mp2v.video -omx_param "preset=34:pass=1:passlogfile=ffmpeg_file:video_format=ntsc:cfg_file_path=config.cfg" first_ffmpeg_output.m2v -y 
    ffmpeg -s 1440x1080 -r 29.97 -pix_fmt yuyv422 -f rawvideo -i 1440x1080_ntsc_YUY2.raw -c:v omx_enc_mp2v -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mp2v.video -omx_param "preset=34:pass=2:passlogfile=ffmpeg_file:video_format=ntsc:cfg_file_path=config.cfg" second_ffmpeg_output.m2v -y 
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 -s 1440x1080 -r 29.97 -pix_fmt yuyv422 -f rawvideo -i 1440x1080_ntsc_YUY2.raw -c:v omx_enc_mp2v -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mp2v.video -omx_param "preset=34:pass=1:passlogfile=ffmpeg_file:video_format=ntsc:cfg_file_path=config.cfg" first_ffmpeg_output.m2v -y 
    ffmpeg -s 1440x1080 -r 29.97 -pix_fmt yuyv422 -f rawvideo -i 1440x1080_ntsc_YUY2.raw -c:v omx_enc_mp2v -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mp2v.video -omx_param "preset=34:pass=2:passlogfile=ffmpeg_file:video_format=ntsc:cfg_file_path=config.cfg" second_ffmpeg_output.m2v -y
[MP2V Settings] Specifies parameters from the MPEG-2 encoder configuration on the command line, which can be applied under "[MP2V 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=MPEG_XDCAM_HD_422_1920:[MP2V Settings]:video_format=1:frame_rate_code=3:bit_rate=500000: ... : ..."  
These arguments match the MainConcept MPEG-2 encoder settings (see [MP2V Settings] or an MPEG-2 encoder configuration file as an example).

omx_format_param for the MXF Multiplexer (mc-general-params)

All settings below are optional parameters for omx_format_param for the MXF Multiplexer (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).
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 Command line examples 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)

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.

ffmpeg -s 1920x1080 -r 29.97 -i input.yuv -c:v omx_enc_mp2v -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mp2v.video -omx_param "preset=39:video_format=ntsc" ffmpeg_output.m2v
ffmpeg -s 1920x1080 -r 29.97 -i input.yuv -c:v omx_enc_mp2v -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mp2v.video -omx_param "preset=39:video_format=ntsc:cfg_file_path=config.cfg" ffmpeg_output.m2v
ffmpeg -s 1440x540 -r 29.970030 -pix_fmt yuyv422 -f rawvideo -i 1440x540_ntsc_YUY2.raw -c:v omx_enc_mp2v -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mp2v.video -omx_param "preset=35:video_format=ntsc" ffmpeg_output.m2v -y 
ffmpeg -s 1440x540 -r 29.970030 -pix_fmt yuyv422 -f rawvideo -i 1440x540_ntsc_YUY2.raw -c:v omx_enc_mp2v -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mp2v.video -omx_param "preset=36:video_format=ntsc" ffmpeg_output.m2v -y
ffmpeg -s 1440x1080 -r 29.970030 -pix_fmt yuyv422 -f rawvideo -i 1440x1080_ntsc_YUY2.raw -c:v omx_enc_mp2v -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mp2v.video -omx_param "preset=32:video_format=ntsc" ffmpeg_output.m2v -y
ffmpeg -s 1440x1080 -r 29.970030 -pix_fmt yuyv422 -f rawvideo -i 1440x1080_ntsc_YUY2.raw -c:v omx_enc_mp2v -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mp2v.video -omx_param "preset=42:video_format=ntsc" ffmpeg_output.m2v -y
ffmpeg -s 1920x1080 -r 29.970030 -pix_fmt yuyv422 -f rawvideo -i 1920x1080_YUY2_100frames.raw -c:v omx_enc_mp2v -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mp2v.video -omx_param "preset=49:video_format=2" ffmpeg_output.m2v -y
ffmpeg -s 1280x720 -r 59.940060 -pix_fmt yuyv422 -f rawvideo -i 1280x720_YUY2_100frames.raw -c:v omx_enc_mp2v -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mp2v.video -omx_param "preset=48:video_format=ntsc" ffmpeg_output.m2v -y
ffmpeg -i source.mp2v -c copy -f omx_mxf_mux -omx_core omxil_core.dll -omx_format_name OMX.MainConcept.mux_mxf.other -omx_format_param "mplex_type=XDCAM_IMX:profile=MXF_PROF_SONY_XDCAM:operational_pattern=OP1A" output.mxf -y
ffmpeg -i source.mp2v -c copy -f omx_mxf_mux -omx_core omxil_core.dll -omx_format_name OMX.MainConcept.mux_mxf.other -omx_format_param "mplex_type=XDCAM_HD:profile=MXF_PROF_SONY_XDCAM: operational_pattern=OP1A" output_ MPEG_XDCAM_HD_420_1280.mxf -y
ffmpeg -i source_1920x1080.m2ts -c:v omx_enc_mp2v -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mp2v.video -omx_param "preset=MPEG_XDCAM_IMX_40" -f omx_mxf_mux -omx_core omxil_core.dll -omx_format_name OMX.MainConcept.mux_mxf.other -omx_format_param "mplex_type=XDCAM_IMX:profile=MXF_PROF_SONY_XDCAM: operational_pattern=OP1A" output_MPEG_XDCAM_IMX_40.mxf -y
ffmpeg -i source_1920x1080.m2ts  -c:v omx_enc_mp2v -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mp2v.video  -omx_param "preset=30" -f omx_mxf_mux -omx_core omxil_core.dll -omx_format_name OMX.MainConcept.mux_mxf.other -omx_format_param "mplex_type=XDCAM_IMX:profile=MXF_PROF_SONY_XDCAM: operational_pattern=OP1A" output_MPEG_XDCAM_IMX_40.mxf -y

2-pass encoding

ffmpeg -s 1440x1080 -r 29.97 -pix_fmt yuyv422 -f rawvideo -i 1440x1080_ntsc_YUY2.raw -c:v omx_enc_mp2v -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mp2v.video -omx_param "preset=34:pass=1:passlogfile=ffmpeg_file:video_format=ntsc:cfg_file_path=config.cfg" first_ffmpeg_output.m2v -y
ffmpeg -s 1440x1080 -r 29.97 -pix_fmt yuyv422 -f rawvideo -i 1440x1080_ntsc_YUY2.raw -c:v omx_enc_mp2v -omx_core omxil_core.dll -omx_name OMX.MainConcept.enc_mp2v.video -omx_param

Parameters

The MainConcept MPEG-2 Production Format Encoder plug-in for FFmpeg comes with some sample configuration (*.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 MPEG-2 Encoder configuration files using TotalCode Studio (https://www.mainconcept.com/products/for-professionals/vod-transcoding/totalcode-studio.html). In the application, select a desired MPEG-2 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

[MP2V Settings]

MP2V settings are covered under the following:

Coding model parameters

video_type

Specifies the MPEG video stream type to encode.
  • 0: MPEG_MPEG1
  • 1: MPEG_VCD
  • 2: MPEG_MPEG2
  • 3: MPEG_SVCD
  • 4: MPEG_DVD
  • 8: MPEG_DVB
  • 9: MPEG_MMV
  • 10: MPEG_DVHS
  • 11: MPEG_ATSC
  • 12: MPEG_ATSCHI
  • 13: MPEG_DVD_MPEG1
  • 14: MPEG_DVD_DVR
  • 15: MPEG_DVD_DVR_MPEG1
  • 16: MPEG_DVD_PVR
  • 17: MPEG_DVD_PVR_MPEG1
  • 18: MPEG_HDV_HD1
  • 19: MPEG_HDV_HD2
  • 21: MPEG_D10_30
  • 22: MPEG_D10_40
  • 23: MPEG_D10_50
  • 24: MPEG_CABLELABS
  • 25: MPEG_HD_DVD
  • 26: MPEG_BD
  • 27: MPEG_BD_HDMV
  • 29: MPEG_XDCAM_IMX_30
  • 30: MPEG_XDCAM_IMX_40
  • 31: MPEG_XDCAM_IMX_50
  • 32: MPEG_XDCAM_1080_CBR_25
  • 33: MPEG_XDCAM_1080_VBR_17_5
  • 34: MPEG_XDCAM_1080_VBR_35
  • 35: MPEG_XDCAM_540_CBR_12_5
  • 36: MPEG_XDCAM_540_VBR_8_75
  • 37: MPEG_XDCAM_540_VBR_17_5
  • 38: MPEG_XDCAM_HD_420_1280
  • 39: MPEG_XDCAM_HD_422_1920
  • 40: MPEG_XDCAM_HD_422_1280
  • 41: MPEG_XDCAM_EX_1920
  • 42: MPEG_XDCAM_EX_1440
  • 43: MPEG_XDCAM_EX_1280
  • 45: MPEG_1SEG
  • 46: MPEG_XDCAM_HD_422_1920_540
  • 47: MPEG_ATT
  • 48: MPEG_CABLELABS_HD1
  • 49: MPEG_CABLELABS_HD2
  • 50: MPEG_ATSC_C
  • 51: MPEG_DTV
  • 52: MPEG_HLS
  • 53: MPEG_CABLELABS_HD3

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.976 fps as 29.97 (59.94) fps or 24 fps as 30 (60) fps, using the top field first and repeat first field flags in the picture coding extension. This is for MPEG-2 only.
  • 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

constrparms

This flag (MPEG-1 only) specifies whether the following video coding parameters meet these constraints:
Parameter Constraint
horizontal_size <= 768 pixels
vertical_size <= 576 pixels
((horizontal_size+15)/16)*((vertical_size+15)/16) <= 396
((horizontal_size+15)/16)*((vertical_size+15)/16)* picture_rate <= 396*25
picture_rate <= 30fps
forward_f_code <= 4
backward_f_code <= 4
vbv_buffer_size <= 20
bit_rate <= 1856000
The values are:
  • 0: Parameters not constrained
  • 1: Parameters are constrained

N

Specifies the maximum number of frames in a GOP (Group of Pictures). The maximum number of frames in a group of pictures (between any I frames) is N-1. If this field is 1, only I-frames are generated. Some GOPs of a stream will be shorter if a new scene was found. The value range is 1 .. 128.

M

Specifies the distance between reference frames. The number of B-frames between P- or I-frames is M-1. If this value is set to 1, no B-frames will be generated. The value range is 1 .. 8.

drop_frame_tc

Specifies whether the timecode in a GOP is drop-frame or non-drop-frame and how the PTS values are computed. It is only used if the frame rate is 29.97 fps and, if set, the input video must be 30 fps to work correctly. Additionally, if set, the timecode in the GOP is drop-frame and the PTS generated for the multiplexer are for 30 fps video.
  • 0: Non-drop-frame
  • 1: Drop-frame

tc0

Sets the timecode encoded into the first GOP header. The value is the number of frames to be considered as the starting time of this stream. If the desired start time is 1 minute and the frame rate is 30 fps, the value should be set like 1 * 60 seconds/min * 30 frames/sec = 1800. The value range is 0 .. 5399999 (default is 0 in all presets).

closedGOP_Interval

Specifies the distance between closed GOPs.
  • 0: No closed GOP
  • 1: Every GOP is closed
  • 2: Every second GOP is closed
  • 3: Every third GOP is closed
  • n: Every n-th GOP is closed

deinterlacing_mode

Specifies the deinterlacing mode.
  • 0: DEINTERLACE_NONE - do not deinterlace (default in all presets)
  • 1: DEINTERLACE_AUTO - deinterlace input picture by stretching first field
  • 2: DEINTERLACE_USETOPFIELD - deinterlace input picture by stretching top field
  • 3: DEINTERLACE_USEBOTTOMFIELD - deinterlace input picture by stretching bottom field
  • 4: DEINTERLACE_USEBOTHFIELDS - deinterlace input picture by blending both fields

ignore_frame_interval

Specifies the distance between frames to be ignored (dropped), e.g. set to 1000 it will ignore each 1000-th frame.
  • 0: Do not ignore frames
  • 1: Ignore all frames
  • 2: Ignore every other frame
  • n: Ignore every n-th frame

Sequence specific data (sequence header)

aspectratio

Specifies the display aspect ratio code which is different depending on the MPEG type. The following table shows the aspect ratio codes:
MPEG-1
Value Aspect ratio
1 1.0000 - Square pels
2 0.6735
3 0.7031 - 16:9 625 lines
4 0.7615
5 0.8055
6 0.8437 - 16:9 525 lines
7 0.8935
8 0.9157 - CCIR601 625 lines (PAL) (default in PAL MPEG-1 presets)
9 0.9815
10 1.0255
11 1.0695
12 1.0950 - CCIR601 525 lines (NTSC) (default in NTSC MPEG-1 presets)
13 1.1575
14 1.2015
MPEG-2
Value Aspect ratio
1 Square pels
2 4:3 display
3 16:9 display
4 2.21:1 display

frame_rate_code

Specifies the frame rate code but not the actual frame rate. However, we recommend not using this option because it redefines the fps only for the video stream without giving any notice to the container or feeding process. You should use another option such as frame_rate, video_pulldown_flag, N, M, etc. Use one of the following frame rate code parameters:
  • 0: Use the default frame rate
  • 1: 24000/1001 23.976 fps - NTSC encapsulated film rate
  • 2: 24 Standard international cinema film rate
  • 3: 25 PAL (625/50) video frame rate
  • 4: 30000/1001 29.97 - NTSC video frame rate
  • 5: 30 NTSC drop-frame (525/60) video frame rate
  • 6: 50 double frame rate/progressive PAL
  • 7: 60000/1001 double frame rate NTSC
  • 8: 60 double frame rate drop-frame NTSC
  • 9: 48.0 frames per second (DCI)

frame_rate

Specifies the actual frame rate and can be used for frame rates that cannot be set by the frame rate code (e.g. 12 or 15). In this case, the encoder overwrites the frame rate code and calculates the frame rate extension values which are written to the sequence extension header.
  • 0: The encoder uses the frame rate given by the frame_rate_code option
  • >0: The encoder uses the specified frame rate

bit_rate

Specifies the target bitrate (bits per second) of the encoded video sequence in constant bitrate mode.

max_bit_rate

Specifies the maximum instant bitrate in variable bitrate mode.

mquant_limit

Defines a maximum limitation for macroblock quantization, e.g. to avoid bad coded frames. This especially makes sense for segment reencoding by taking quantization of the first encode and use this information to restrict quantization for the reencode. The value range stored in each eight bits is 1 .. 31.

vbv_buffer_size

Specifies the size of the video buffer verifier (VBV) in 16384 bit units. If set to 0, the encoder will compute an appropriate value. For MPEG-1, the range is up to 1023; for MPEG-2, the maximum value can be higher. The value limit depends on the profile/level selected. Some presets have a particular value that cannot be changed.
Profile Buffer size Level
High Profile 746 High Level
597 High Level 1440
149 Main Level
Main Profile 597 High Level
448 High Level 1440
112 Main Level
29 Low Level
Simple Profile 112 Main Level
4:2:2 Profile 2880 High Level
576 Main Level

constant_bitrate

Defines the bitrate mode.
  • 0: Variable bitrate
  • 1: Constant bitrate (default in all presets)
  • 2: Constant quantization
  • 3: Strict constant quantization

mquant_value

Specifies the macroblock quantization value to be used in constant quantization, variable bitrate and strict constant quantization modes. The value range stored in each eight bits is 1 .. 31.

write_sh

Specifies whether to write a sequence header every GOP or just one at the beginning of the stream. Note that VCD, SVCD and DVD should have this option turned on.
  • 0: Only put a sequence header at the beginning of the stream
  • 1: Put a sequence header before every GOP (default in all presets)

write_sec

Specifies whether the encoder writes a sequence end code at the end of the stream.
  • 0: Do not write a sequence end code
  • 1: Write a sequence end code

Sequence specific data (sequence extension)

profile

Specifies a subset of the MPEG-2 syntax and parameter constraints required for decoding the stream. Currently only the High, Main, Low and 4:2:2 profiles are supported.
Value Meaning Typical use case
1 High Profile Production equipment requiring 4:2:2
4 Main Profile 95% of TVs, VCRs, cable applications (default in all presets)
5 Simple Profile Low cost memory, e.g. no B-pictures
7 4:2:2 Profile Allows high bitrate and 4:2:2

level

Specifies coded parameter and syntax constraints for MPEG-2 only, e.g. bitrate, sample rate, and the maximum allowed motion vector range.
Value Meaning Typical use case
4 High Level HDTV production rates, e.g. 1920 x 1080 x 30 Hz
6 Main Level 1440 HDTV consumer rates, e.g. 1440 x 960 x 30 Hz
7 Main Level CCIR 601 rates, e.g. 720 x 480 x 30 Hz (default in all presets)
10 Low Level SIF video rate, e.g. 352 x 240 x 30 Hz

prog_seq

Specifies whether the stream can contain interlaced video. This field must be set to 1 for MPEG-1 video.
  • 0: Interlaced frames (default in all MPEG-2 presets)
  • 1: Progressive frames (default in all MPEG-1 presets)

chroma_format

Specifies the resolution of the chrominance data.
  • CHROMA420: 4:2:0 - half resolution in both dimensions (default in all presets)
  • CHROMA422: 4:2:2 - valid only for the MPEG-2 High and 4:2:2 Profiles

Sequence specific data (sequence display extension)

video_format

Indicates the representation of the pictures before being encoded (MPEG-2 only). It is a flag (in the sequence display extension header) to the video decoder and does not affect the video encoding at all.
  • 0: Component
  • 1: PAL (default in PAL presets)
  • 2: NTSC (default in NTSC presets)
  • 3: SECAM
  • 4: MAC
  • 5: Unspecified video format

color_primaries

Specifies the x, y chromaticity coordinates of the source primaries (MPEG-2 only). It is a flag (in the sequence display extension header) to the video decoder and does not affect the video encoding at all.
  • 1: ITU-R BT. 709-2
  • 2: Unspecified
  • 4: ITU-R BT. 470-2 System M
  • 5: ITU-R BT. 470-2 System B, G, ITU-R BT.601 (625)
  • 6: SMPTE 170M, ITU-R BT.601 (525)
  • 7: SMPTE 240M (1987)

transfer_characteristics

Specifies the opto-electronic transfer characteristic of the source picture (MPEG-2 only). It is a flag (in the sequence display extension header) to the video decoder and does not affect the video encoding at all.
  • 1: ITU-R BT. 709-2, BT.601
  • 2: Unspecified
  • 4: ITU-R BT. 470-2 System M
  • 5: ITU-R BT. 470-2 System B, G
  • 6: SMPTE 170M
  • 7: SMPTE 240M (1987)
  • 8: Linear transfer characteristics

matrix_coefficients

Specifies the matrix coefficients used in deriving luminance and chrominance signals from the green, blue, and red primaries. It is a flag (in the sequence display extension header) for the video encoder.
  • 1: ITU-R BT. 709-2
  • 2: Unspecified
  • 4: FCC
  • 5: ITU-R BT. 470-2 System B, G, BT.601
  • 6: SMPTE 170M
  • 7: SMPTE 240M (1987)

display_horizontal_size

Specifies the "intended display" active region (which may be smaller or larger than the encoded frame size). This field does not affect the encoding in any way; this is only for the video decoder. The value range is 2 .. 16383.

display_vertical_size

Specifies the "intended display" active region (which may be smaller or larger than the encoded frame size). This field does not affect the encoding in any way; it is only for the video decoder. The value range is 2 .. 16383.

write_sde

Specifies whether a sequence display extension is written in every GOP (MPEG-2 only). Some players have problems playing SVCDs that have the extensions present, so this flag is present to turn the extensions off if needed.
  • 0: Do not write any sequence display extensions
  • 1: Write a sequence display extension in every GOP

prefiltering

Used for blurring out video, which can be useful for complex content with low bitrates (when quantization reaches maximum and bitrate cannot be maintained). Suitable values are between 1 and 15. Set this field to 0 if you do not want to use prefiltering.

target_size_restriction

Triggers planned target size of a frame (-50 .. +50 percent, 0 = no restriction). To achieve more optimistic behaviour, choose a negative value. However, this increases the probability of vbv underflows.

user_iquant

Used to enable user-defined quantization matrices for intra macroblocks. It can be any combination of the following flags:
  • USE_LUMA_QUANT_MATRIX: Enable user-defined matrix for luma blocks
  • USE_CHROMA_QUANT_MATRIX: Enable user-defined matrix for chroma blocks

user_niquant

Used to enable user-defined quantization matrices for non-intra blocks. It can be any combination of the following flags:
  • USE_LUMA_QUANT_MATRIX: Enable user-defined matrix for luma blocks
  • USE_CHROMA_QUANT_MATRIX: Enable user-defined matrix for chroma blocks

Advanced GOP parameters

min_N

Specifies the minimum GOP length. It should be used together with AUTO_GOP features to avoid consecutive I-frames. This field prevents scene detection from setting an I-frame after less than min_N frames from previous one. The valid range is 1..N. To prevent the encoder setting consecutive I-frames, min_N has to be greater than 1.

Motion data

motion_data

Allows for manual setting of the motion estimation parameters.
Value Max Search Width/Height in Pixels
1 7
2 15
3 31
4 63
5 127
6 255
7 511
8 1023
9 2047

Picture specific data (picture coding extension)

dc_prec

Specifies the effective precision of the DC coefficient in MPEG-2 intra coded macroblocks. 10-bit usually achieves quality saturation. This field must be 0 for MPEG-1 video.
  • 0: 8-bit (must be zero for MPEG-1, default for SVCD)
  • 1: 9-bit (default in all other MPEG-2 presets)
  • 2: 10-bit
  • 3: 11-bit (only valid with high profile)

topfirst

Specifies which of the two fields of an interlaced frame comes earlier in time, i.e. the top (odd) field or the bottom (even) field. If NTSC pulldown is in effect, this field is set automatically. This parameter is MPEG-2 only.
  • 0: Bottom field first
  • 1: Top field first (default in all MPEG-2 presets)

frame_pred_dct_tab

Specifies whether to restrict motion compensation to frame prediction and DCT to frame DCT or to use either frame or field prediction and DCT. These fields must be 1 for MPEG-1 video or MPEG-2 progressive encoding.
  • 0: Use field or frame prediction and DCT (default in MPEG-2 presets)
  • 1: Use frame prediction and DCT (default in MPEG-1 presets)

conceal_tab

Enables the usage of concealment motion vectors (I,P,B).
  • 0: Do not use concealment motion vectors (default)
  • 1: Use concealment motion vectors

qscale_tab

Specifies whether to use linear or non-linear quantization scale types. Each frame type (I, P and B) has its own flag; index 0 is the I-frame flag, index 1 is the P-frame flag and index 2 is the B-frame flag. These fields must be 0 for MPEG-1 video.
  • 0: Linear quantization scale type (default in all MPEG-1 presets)
  • 1: Non-linear quantization scale type (default in all MPEG-2 presets)

intravlc_tab

Specifies the Intra vlc format (I,P,B,current), i.e. one of the two variable length coding tables for intra coded blocks. Table 1 is considered to be statistically optimized for Intra coded pictures coded within the sweet spot range (e.g. 0.3 to 0.6 bit/pixel) of MPEG-2. Each frame type (I, P and B) has its own flag, index 0 is the I-frame flag, index 1 is the P-frame flag and index 2 is the B-frame flag. These fields must be 0 for MPEG-1 video.
  • 0: Table 0 (default in all presets, must be zero for MPEG-1)
  • 1: Table 1

altscan_tab

Specifies the Alternate scan (I,P,B,current), i.e. one of two entropy scanning patterns defining the order in which quantized DCT coefficients are run-length coded. The alternate scanning pattern is considered to be better suited to interlaced video if the encoder does not employ sophisticated forward quantization. Each frame type (I, P and B) has its own flag, index 0 is the I-frame flag, index 1 is the P-frame flag and index 2 is the B-frame flag. These fields must be 0 for MPEG-1 video.
  • 0: Zig-Zag scan (must be zero for MPEG-1)
  • 1: Alternate scan (default in all MPEG-2 presets)

repeatfirst

Specifies whether to repeat the first field of a frame after displaying the two fields. The exact function depends on prog_seq and topfirst. This field is mainly intended to serve as a signal for a decoder to perform 2:3 or 3:2 NTSC pulldown. If pulldown is in effect, this field is set automatically by the encoder.
  • 0: Display first and second fields (default in all presets)
  • 1: Display first and second fields, then display the first again

prog_frame

Specifies whether the frames are interlaced or progressive. This field must be 1 for MPEG-1. video.
  • 0: Interlaced frames (default in all MPEG-2 presets)
  • 1: Progressive frames(default in all MPEG-1 presets)

encoding_delay

This field specifies number of frames in the input queue for preprocessing. It should be equal to 1 to reduce latency.
  • 0: Auto; encoding delay will be calculated based on stream settings
  • 1: Disable preprocessing
  • n: Number of frames for preprocessing

Rate control vars

fixed_vbv_delay

Specifies whether the vbv delay value in the picture header is computed (constant bitrate mode) or set to 0xffff (variable bitrate mode only).
  • 0: Computed vbv delay (default in all CBR presets, must be zero for CBR)
  • 1: vbv delay = 0xffff (default in all VBR presets)

min_frame_percent

Specifies the initial fullness of the VBV buffer at startup in percentage or in bits (0x80000000 | vbv_fullness_in_bits). The number of free bits is calculated by:
free_bits = (vbv_buffer_bits*(100 - min_frame_percent))/100 range is 0..100 (default is 25 in all presets)
free_bits = vbv_buffer_bits - (0x7FFFFFFF & min_frame_percent)

pad_frame_percent

Specifies the limit in percent, when zero padding is added to the stream in variable bitrate mode. Padding is done if the actual bitrate * pad_frame_percent / 100 is less than the minimum bitrate. The value range is 0 .. 100 (default is 90 in all presets).

intra_q

Defines a quantization table for intra blocks. If chroma_format is 4:2:0 and USE_LUMA_QUANT_MATRIX is set, this matrix is used for both luma and chroma blocks. When using the 4:2:2 chroma_format, this matrix is used for luma while the chroma_intra_q matrix is used for chroma blocks as long as the USE_CHROMA_QUANT_MATRIX flag is set.

inter_q

Defines a quantization table for non-intra blocks. If chroma_format is 4:2:0 and USE_LUMA_QUANT_MATRIX is set, this matrix is used for both luma and chroma blocks. When using the 4:2:2 chroma_format, this matrix is used for luma while the chroma_inter_q matrix is used for chroma blocks as long as the USE_CHROMA_QUANT_MATRIX flag is set.

chroma_intra_q

If chroma_format is 4:2:2 and the USE_CHROMA_QUANT_MATRIX flag is set, this field is used as quantization table for intra chroma blocks.

chroma_inter_q

If chroma_format is 4:2:2 and the USE_CHROMA_QUANT_MATRIX flag is set, this field is used as quantization table for non-intra chroma blocks.

motion_search_type

Specifies the motion search type used. The low bit 0 is used to enable half pel motion search, bit 1..4 are the motion search mode:
Bit Value Meaning
0 0 Do not use half pel motion searching
SEARCH_HALF_PEL Use half pel motion searching
1..4 0.. No motion search (fast)
..7.. Middle motion search method, medium quality
..15 Best motion search method, high quality
SEARCH_DIAMOND Faster than 4 and better quality than 6

frame_alignement_power_two

Specifies an alignment of the access unit (start from sequence or frame header and end on the last slice of frame) by padding with zero-bytes. The value range is 0..10 with 0=none, 1:2, 2:4, 3:8, 4:16, 5:32, 6:64 ... 10:1024 bytes (default is 0 in all presets).

embed_SVCD_user_blocks

Specifies whether user data blocks are inserted in the video stream after an I-frame picture encoding extension to be filled in by the multiplexer with SVCD scan offset data. This option should be enabled if generating a SVCD stream (MPEG-2 only).
  • 0: Do not insert user data blocks (default in all non-SVCD presets)
  • 1: Insert user data blocks (default in SVCD preset)

avg_bit_rate

Target average bitrate for variable bitrate mode.

min_bit_rate

Minimum instant bitrate for variable bitrate mode.

calc_quality

Specifies quality calculation mode.
  • 0: Encoder does not calculate PSNR values
  • 1: Encoder calculates PSNR values and print them at the end of the encoding process
  • >1: Encoder calculates PSNR values and print them for each frame

qt_noise_sensitivity

Specifies a noise sensitivity value for the quantization process. It controls the ratio between inter and intra blocks (in P and B frames). The higher the value the more inter blocks are used. The value range is 0 .. 31 (0 = auto mode).

num_threads

Specifies the number of active threads to be used during encoding. 0 means auto mode, 1 means single threaded encoding, more threads will use more CPUs/cores.

Picture display extension

write_pde

Specifies whether picture display extensions are written in the video stream (MPEG-2 only). This field must be enabled to use the frame_centre_horizontal_offset and frame_centre_vertical_offset fields. This field does not affect the encoding process.
  • 0: Do not insert picture display extensions (default in all presets)
  • 1: Insert picture display extensions

frame_centre_horizontal_offset

Can be used in conjunction with the display_horizontal_size field to define where the display rectangle is positioned over the reconstructed frame (MPEG-2 only). This field does not affect the encoding process; it is for the decoder only. The value range is -32768 .. 32767 (default is zero in all presets).

frame_centre_vertical_offset

Can be used in conjunction with the display_vertical_size field to define where the display rectangle is positioned over the reconstructed frame (MPEG-2 only). This field does not affect the encoding process; it is for the decoder only. The value range is -32768 .. 32767 (default is zero in all presets).

Suggested frame size for specific MPEG types

def_horizontal_size/def_vertical_size

These fields are set by the encoder to indicate the preferred video size based on the chosen preset. If PAL VCD is selected, these fields would be 352 (horizontal) and 288 (vertical). For all other functions, they specify the size of the incoming video frames to the encoder. Note that for MPEG-2, not all frame resolutions and frame sizes are valid for a given profile/level. See the frame_rate_code description. The minimum frame size is 16x16 and the maximum frame size for MPEG-1 is 4095x4095. The maximum frame sizes for MPEG-2 depend on the supported profile/level combination as listed below:
Profile Max frame size Level
High Profile 1920x1088 High Level
1920x1088 High Level 1440
720x576 Main Level
Main Profile 1920x1088 High Level
1440x1088 High Level 1440
720x576 Main Level
352x288 Low Level
Simple Profile 720x576 Main Level
4:2:2 Profile 1920x1088 High Level
720x608 Main Level (PAL)
720x512 Main Level (NTSC)