Available in LEADTOOLS Multimedia toolkits. |
ILMMPEG2Encoder Interface
This is the interface for the LEAD
MPEG-2 Encoder .
Type |
Name |
Description |
VideoType |
This option offers encoding parameters for VCD, SVCD, DVD and DICOM (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, The encoder is capable of generating MPEG-1 or MPEG-2 video.
| |
FrameRate |
This option sets the playback frame rates of the compressed video no matter what the input stream rate is. LEAD MPEG-2 Encoder 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,
| |
Profile |
Use this option to Set MPEG2 profile *. Possible values are: MPEG2Profile_Simple = 0, Default value is MPEG2Profile_Main. All MPEG2 Profiles listed above are generated using the 4:2:0 Chroma Format. The LEADTOOLS MPEG2 Encoder MPEG2Profile_High does not support the 4:2:2 Chroma format. | |
Level |
Use this option to set MPEG2 level *. Possible values are: MPEG2Level_Low
= 1, Default value is MPEG2Level_Main
| |
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.
|
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. Also see "Supplement 137: MPEG2 MP@HL Transfer Syntax" of the DICOM specification for more information on the restrictions for the HDTV video that can be stored inside DICOM files.
| |
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.
| |
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. |
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
typedef enum { MPEG2Type_MPEG1 = 0, MPEG2Type_VCD = 1, MPEG2Type_MPEG2 = 2, MPEG2Type_SVCD = 3, MPEG2Type_DVD = 4 } eMPEG2VIDEOTYPE;
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;
typedef enum { MPEG2Profile_Simple = 0, MPEG2Profile_Main = 1, MPEG2Profile_High = 2 } eMPEG2PROFILE;
typedef enum { MPEG2Level_Low = 1, MPEG2Level_Main = 2, MPEG2Level_High1440 = 3, MPEG2Level_High = 4 } eMPEG2LEVEL;
typedef enum { MPEG2MODE_GENERAL = 1, MPEG2MODE_DVD = 2, MPEG2MODE_DICOM = 3, MPEG2MODE_MPEG1 = 4, MPEG2MODE_VCD = 5, MPEG2MODE_MPEG2 = 6, MPEG2MODE_SVCD = 7 } eMPEG2DEFAULTMODE;
typedef enum { MPEG2_DS_PROGRESSIVE = 0, MPEG2_DS_INTERLACED = 1 } eMPEG2DISPLAYSCAN;
typedef enum{ MPEG2_VF_PAL = 1, MPEG2_VF_NTSC = 2, MPEG2_VF_HDTV_720 = 3, MPEG2_VF_HDTV_1080 = 4 } eMPEG2VIDEOFORMAT;
typedef enum { MPEG2_VARIABLE_BITRATE, MPEG2_CONSTANT_QUALITY, MPEG2_CONSTANT_BITRATE, } eRATECONTROL;
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;
typedef enum { MPEG2_APILEVEL_1 = 0, MPEG2_APILEVEL_2 = 1 } eMpeg2ApiLevel;