ILMMPEG2Encoder Interface  
This is the interface for the LEAD MPEG-2 Encoder .

Interface Properties:

Type

Property Name

Description

 eMPEG2VIDEOTYPE

VideoType

This option offers encoding parameters for VCD, SVCD and DVD (if you select these, you cannot change most other options). If you choose MPEG1 or MPEG2, you can create a custom video stream by changing other options described below. Possible values are:

MPEG2Type_MPEG1 = 0,
MPEG2Type_VCD      = 1,
MPEG2Type_MPEG2 = 2,
MPEG2Type_SVCD    = 3,
MPEG2Type_DVD      = 4,
MPEG2Type_DICOM  = 5,

The encoder is capable of generating MPEG-1 or MPEG-2 video.

  • When the MPEG-1 radio button is checked, MPEG-1 compression is used. In this case, only Custom MPEG-1 or VCD MPEG-1 options are available.

    • Custom MPEG-1 lets you control all the MPEG-1 compression options. A custom MPEG-1 file may or may not be compatible with VCD.

    • VCD (Video on CD) lets you create VCD-compatible files. VCD-compatible files use MPEG-1 compression, but have certain restrictions on compression options, the video size (must be 352x240 for NTSC or 352x288 for PAL) and frame rate. The encoder will automatically resize the video if VCD output type is selected and the size of the video being compressed is not correct.

  • When the MPEG-2 radio button is checked, MPEG-2 compression is used. In this case, only Custom MPEG-2, SVCD, DVD 1 and DVD 2 are available.

    • Custom MPEG-2 lets you control all the MPEG-2 compression options. A custom MPEG-2 file may or may not be compatible with SVCD or DVD.

    • SVCD (Super Video CD) lets you create SVCD-compatible files. SVCD files use MPEG-2 compression, but have certain restrictions on compression options, video size (must be 480x480 for NTSC or 480x576 for PAL), aspect ratio (4:3 or 16:9) and frame rate (29.97fps for NTSC, 25fps for PAL). The encoder will automatically resize the video if SVCD output type is selected and the size of the video being compressed is not correct.

    • DVD lets you create DVD-compatible files that can be put on a 1-hour DVD. DVD files use MPEG-2 compression, but have certain restrictions on compression options, video size (must be 720x480 for NTSC or 720x576 for PAL), aspect ratio (16:9 or 4:3) and frame rate. The encoder will automatically resize the video if DVD output type is selected and the size of the video being compressed is not correct.

    • DICOM lets you create Digital Imaging and Communications in Medicine (DICOM), compatible mpeg2 file. The mpeg2 encoder setting is based on DICOM Part 5: Data Structures and Encoding (PS 3.5-2004). The video size must be less than 720x480 (NTSC) or 720x576 (PAL). The encoder will automatically resize the video if DICOM output type is selected and the size of the video being compress is not correct.

 

 eMPEG2FRAMERATE

FrameRate

This option sets the playback frame rates of the compressed video no matter what the input stream rate is. LEAD MPEG-2 Encoder will automatically adjust the input video to match the desired frame rate. The adjustment is done through dropping or duplicating input frames. Possible values are:

FRAMERATE_23_98 = 0,
FRAMERATE_24_00 = 0,
FRAMERATE_25_00 = 0,
FRAMERATE_29_97 = 0,
FRAMERATE_30_00 = 0,
FRAMERATE_50_00 = 0,
FRAMERATE_59_94 = 0,
FRAMERATE_60_00 = 0,

 

 eMPEG2PROFILE

Profile

Use this option to Set MPEG2 profile *.

Possible values are:

MPEG2Profile_Simple = 0,
MPEG2Profile_Main    = 1,
MPEG2Profile_High    = 2,

Default value is MPEG2Profile_Main

 eMPEG2LEVEL

Level

Use this option to set MPEG2 level *.

Possible values are:

MPEG2Level_Low         = 1,
MPEG2Level_Main        = 2,
MPEG2Level_High1440 = 3,
MPEG2Level_High        = 4,

Default value is MPEG2Level_Main

 

 eRATECONTROL

RateControlMethod

Three control methods can be selected with this property:

MPEG2_CONSTANT_BITRATE (Fixed output rate): If this is selected, the compression level is constant and the storage requirements are easily predicted. This may affect the video quality of more dynamic scenes and pictures with lots of detail. The bit rate describes the amount of data used or transferred per second. It is directly related to the compression level. For example, a DV video (approximately 1:5 compression) would need 25 Mbit (3.12MB) per second. Using MPEG-2 compression at bit rate = 6 Mbit/sec, the compression level will be 1:27. Therefore, the higher the bit rate, the lower the compression and the better the quality. The bit rate can be adjusted using the Bitrate edit box. For both Variable Bitrate and Fixed Bitrate, the video quality also depends on the MPEG-2 profile used (4:2:2 or 4:2:0) and the distance between I frames and P frames.

MPEG2_CONSTANT_QUALITY (Variable bit rate and Fixed video quality). If this selected the compression rate varies with scene content. For more dynamic scenes a high bit rate (low compression) is used to maintain consistent video quality. Setting a quality value in the Quality drop down box can further control the quality.

MPEG2_VARIABLE_BITRATE If this is selected, the compression rate varies with scene content. The MinQuantizerValue, MaxQuantizerValue, Bitrate will control the video quality. The video quality will vary between the Minimum and Maximum quality factors, and the rate will not exceed the Maximum Bitrate. This option should be used when good video quality is required at a certain bit rate. (A common use for this is DVD creation). You achieve the best compression-quality performance when you use this option.

For this option, the compressor increases or decreases the quality factor automatically to maintain the highest quality at the desired bit rate, specified in the Average Bitrate and the Maximum Bitrate edit boxes. However, the quality factor will not go below the Minimum Quality factor or exceed the Maximum Quality factor.

 

long

QuantizerValue

This option is active only when RateControlMethod equal to MPEG2_CONSTANT_QUALITY

Use this option to set the video quality. A QuantizerValue of 1 gives the best quality and the biggest video size, while a QuantizerValue of 31 gives the smallest file size with low video quality. A QuantizerValue of 4 has been chosen as the default value.

long

MinQuantizerValue

 

This option is active only when RateControlMethod equal to MPEG2_VARIABLE_BITRATE.

For variable bitrates, the encoder will not use a quantizer below this value. This value range is 1 - 31.

long

MaxQuantizerValue

This option is active only when RateControlMethod equal to MPEG2_VARIABLE_BITRATE.

For variable bitrates, the encoder will not use a quantizer above this value. This value range is 1 - 31.

long

Bitrate

Set the bitrate for mpeg2 encoder in bits per second units. use this when RateControlMethod is set to MPEG2_CONSTANT_BITRATE or MPEG2_VARIABLE_BITRATE. For MPEG2_VARIABLE_BITRATE this value will represent the average bitrate.

long

I_FrameDistance

This option set the distance between I frames or how many frames between each I frames. Note that all frames between I frames are P or B frames ***. It is preferable to update P_FrameDistance before I_FrameDistance since updating one might change the other. Also notice that I_FrameDistance always should be multiple of P_FrameDistance .

 

long

P_FrameDistance

This option set the distance between P frames or how many frames between each P frames. Note that all frames between P frames are B frames ***. It is preferable to update P_FrameDistance before I_FrameDistance since updating one might change the other. Also notice that I_FrameDistance always should be multiple of P_FrameDistance .

 

VARIANT_BOOL

ShowWarningMessage

This property is now obsolete. It is now ignored by the encoder and will be removed in future versions of the encoder.

 

eMPEG2VIDEOFORMAT

VideoFormat

Specifies the TV system on which the MPEG file will be played (NTCS, PAL). Use this property when producing a file to be played on TV, such as a DVD or VCD. For information about HDTV resolution, please see http://en.wikipedia.org/wiki/High-definition_television.

 

eMPEGASPECTRATIO

AspectRatio

Sets the desired aspect ratio during playback. The video will be adjusted if it does not match this desired aspect ratio, unless the IgnoreInputAspectRatio property is set to VARIANT_TRUE.

 

 eMPEG2DISPLAYSCAN

DisplayScan

This option should be set to -Interlaced- if the mpeg2 file needs to be played on an interlaced device, like a TV set. Otherwise set this option to "Progressive" if the mpeg2 file needs to be played on a progressive display device like a Computer Monitor.

 

VARIANT_BOOL

IgnoreInputAspectRatio

If VARIANT_TRUE: the input aspect ratio is assumed to be the same as the output aspect ratio. In this case, the encoder will not add black bars and the output video might be distorted.

If VARIANT_FALSE: the input aspect ratio is assumed to be correct and the encoder will preserve the input aspect ratio when resizing or adjusting the video. Black horizontal or vertical bars might be added if the input aspect ratio does not match the output aspect ratio.

HRESULT  ResetToDefaultsEx ( eMpeg2ApiLevel ApiLevel)

Parameters

ApiLevel

Description

Resets encoder to default values. The ApiLevel determines which default values to use. Current applications should set ApiLevel to MPEG2_APILEVEL_2 = 1.

The encoder might change in the future and have different properties or default behaviour. Calling this method ensure the filter will have the same default values as they were at the time you developed your application.

It is recommended you call ResetToDefaultsEx(MPEG2_APILEVEL_2) before you start setting properties for this interface.

Returns

S_OK

 

eMPEG2VIDEOTYPE


typedef enum 
{ 
MPEG2Type_MPEG1 = 0,
MPEG2Type_VCD = 1,
MPEG2Type_MPEG2 = 2,
MPEG2Type_SVCD = 3,
MPEG2Type_DVD = 4
} eMPEG2VIDEOTYPE; 

eMPEG2FRAMERATE


typedef enum
{ 
FRAMERATE_23_98 = 0,
FRAMERATE_24_00 = 1,
FRAMERATE_25_00 = 2,
FRAMERATE_29_97 = 3,
FRAMERATE_30_00 = 4,
FRAMERATE_50_00 = 5,
FRAMERATE_59_94 = 6,
FRAMERATE_60_00 = 7
} eMPEG2FRAMERATE;

eMPEG2PROFILE


typedef enum
{
MPEG2Profile_Simple = 0,
MPEG2Profile_Main = 1,
MPEG2Profile_High = 2
} eMPEG2PROFILE;

eMPEG2LEVEL


typedef enum
{
MPEG2Level_Low = 1, 
MPEG2Level_Main = 2, 
MPEG2Level_High1440 = 3, 
MPEG2Level_High = 4 
} eMPEG2LEVEL;

eMPEG2DEFAULTMODE


typedef enum
{
MPEG2MODE_GENERAL = 1, 
MPEG2MODE_DVD = 2, 
MPEG2MODE_DICOM = 3, 
MPEG2MODE_MPEG1 = 4, 
MPEG2MODE_VCD = 5, 
MPEG2MODE_MPEG2 = 6, 
MPEG2MODE_SVCD = 7
} eMPEG2DEFAULTMODE;

eMPEG2DISPLAYSCAN


typedef enum
{
MPEG2_DS_PROGRESSIVE = 0,
MPEG2_DS_INTERLACED = 1
} eMPEG2DISPLAYSCAN; 
 

eMPEG2VIDEOFORMAT


typedef enum
{
MPEG2_VF_PAL = 1,
MPEG2_VF_NTSC = 2,


MPEG2_VF_HDTV_720 = 3,
MPEG2_VF_HDTV_1080 = 4 } eMPEG2VIDEOFORMAT;

eRATECONTROL


typedef enum
{
MPEG2_VARIABLE_BITRATE, 
MPEG2_CONSTANT_QUALITY, 
MPEG2_CONSTANT_BITRATE,
} eRATECONTROL;

eMPEGASPECTRATIO


typedef enum
{
MPEG1_AR_1_0000, 
MPEG1_AR_0_6735, 
MPEG1_AR_0_7031, 
MPEG1_AR_0_7615, 
MPEG1_AR_0_8055, 
MPEG1_AR_0_8437, 
MPEG1_AR_0_8935, 
MPEG1_AR_0_9375, 
MPEG1_AR_0_9815, 
MPEG1_AR_1_0255, 
MPEG1_AR_1_0695, 
MPEG1_AR_1_1250, 
MPEG1_AR_1_1575, 
MPEG1_AR_1_2015, 
MPEG2_AR_1_0000, 
MPEG2_AR_4_3, 
MPEG2_AR_16_9, 
MPEG2_AR_2_21_1
} eMPEGASPECTRATIO;

eMpeg2ApiLevel


typedef enum
{
MPEG2_APILEVEL_1 = 0,
MPEG2_APILEVEL_2 = 1
} eMpeg2ApiLevel;