ILMMP42Encoder

This is the interface for the LEAD MPEG-4 Encoder.

Data Types:

eEncodingThreads

typedef enum  
{ 
   LMP4_THREAD_AUTO, 
   LMP4_THREAD_1, 
   LMP4_THREAD_2, 
   LMP4_THREAD_3, 
   LMP4_THREAD_4, 
   LMP4_THREAD_5, 
   LMP4_THREAD_6, 
   LMP4_THREAD_7, 
   LMP4_THREAD_8, 
} eEncodingThreads; 

Lists the possible encoding threads number that can be set on the property EncodingThreads.

LMP4_THREAD_AUTO Have the LEAD MPEG4 Encoder determine the appropriate number of threads.
LMP4_THREAD_1 Use 1 thread during encoding.
LMP4_THREAD_2 Use 2 threads during encoding.
LMP4_THREAD_3 Use 3 threads during encoding.
LMP4_THREAD_4 Use 4 threads during encoding.
LMP4_THREAD_5 Use 5 threads during encoding.
LMP4_THREAD_6 Use 6 threads during encoding.
LMP4_THREAD_7 Use 7 threads during encoding.
LMP4_THREAD_8 Use 8 threads during encoding.

eEncodingPassesCount

typedef enum  
{ 
   LMP4_ENCODINGPASSESCOUNT_ONE, 
   LMP4_ENCODINGPASSESCOUNT_TWO, 
} eEncodingPassesCount; 

Lists the possible encoding passses counts.

LMP4_ENCODINGPASSESCOUNT_ONE Use 1 pass mode in encoding.
LMP4_ENCODINGPASSESCOUNT_TWO Use 2 passes mode in encoding.

eCompressionMode

typedef enum  
{ 
   LMP4_COMPRESSIONMODE_ConstantQuality, 
   LMP4_COMPRESSIONMODE_VariableBitrate, 
   LMP4_COMPRESSIONMODE_ConstantBitrate, 
} eCompressionMode; 

Lists the possible values for the compression mode.

LMP4_COMPRESSIONMODE_ConstantQuality Uses the QFactor property value to regulate the image quality.
LMP4_COMPRESSIONMODE_VariableBitrate Varies the quality over short durations. However, it will achieve an average rate matching the BitRate property value.
LMP4_COMPRESSIONMODE_ConstantBitrate Strictly adheres to the rate specified in the BitRate property.

eOutputFormat

typedef enum  
{ 
   LMP4_OUTPUTFORMAT_mp4v, 
   LMP4_OUTPUTFORMAT_LMP4, 
   LMP4_OUTPUTFORMAT_XVID, 
   LMP4_OUTPUTFORMAT_iPod, 
} eOutputFormat; 

Lists the possible values for the output format.

LMP4_OUTPUTFORMAT_mp4v Make the encoder output type the Standard MPEG4 video media subtype.
LMP4_OUTPUTFORMAT_LMP4 Make the encoder output type the LEAD proprietary MPEG4 video subtype. This allows super compression to be used.
LMP4_OUTPUTFORMAT_XVID Make the encoder output type the XVID video subtype.
LMP4_OUTPUTFORMAT_iPod Make the encoder output compatible with iPod devices.

eQuantType

typedef enum  
{ 
   LMP4_QUANTTYPE_Linear, 
   LMP4_QUANTTYPE_NonLinear, 
} eQuantType; 

Lists the possible values for the quantization method to be used by the encoder.

LMP4_QUANTTYPE_Linear Use H.263 quantization.
LMP4_QUANTTYPE_NonLinear Use MPEG quantization.

eMotionAccuracy

typedef enum  
{ 
   LMP4_MOTIONACCURACY_FullPixel, 
   LMP4_MOTIONACCURACY_HalfPixel, 
} eMotionAccuracy; 

Lists the possible values for the Motion estimation accuracy.

LMP4_MOTIONACCURACY_FullPixel One pixel accuracy.
LMP4_MOTIONACCURACY_HalfPixel Half pixel accuracy (faster).

eMotionAlgorithm

typedef enum  
{ 
   LMP4_MOTIONALGORITHM_FullSearch, 
   LMP4_MOTIONALGORITHM_FastSearch, 
} eMotionAlgorithm; 

List the possible values for the motion algorithm. (the algorithm to be used when determining if motion is occurring).

LMP4_MOTIONALGORITHM_FullSearch Use the full motion search algorithm (testing all possibilities). This option slows down the encoding process considerably.
LMP4_MOTIONALGORITHM_FastSearch Use fast motion search.

eMotionVectorPerMacroblock

typedef enum  
{ 
   LMP4_MOTIONVECTOR_OnePerMacroblock, 
   LMP4_MOTIONVECTOR_FourPerMacroblock, 
} eMotionVectorPerMacroblock; 

List the possible values for the motion vectors (vectors to be used in the motion estimation algorithm).

LMP4_MOTIONVECTOR_OnePerMacroblock Use one motion vector (fast).
LMP4_MOTIONVECTOR_FourPerMacroblock Use four motion vectors (better quality, slower encoding).

Interface Properties:

Type

Name

Description

long

QFactor

The quality factor used in compressing the video stream ; the lower the quality factor, the better the quality. Possible values range from 1 (best) to 31 (worst).

eQuantType

QuantType

The quantization method applied. Possible values are (members of the eQuantType enumeration):

LMP4_QUANTTYPE_Linear:        Use H.263 quantization.
LMP4_QUANTTYPE_NonLinear:  Use MPEG quantization.

double

OutputFrameRate

The desired output frame rate, in frames per second. Possible values range from 1.0 to 30.0. Pass -1 to make the output frame rate the same as the input frame rate.

eOutputFormat

OutputFormat

The encoder output type. Possible values are (members of the eOutputFormat enumeration):

LMP4_OUTPUTFORMAT_mp4v:   Make the encoder output type the Standard MPEG4 video media subtype.

 

LMP4_OUTPUTFORMAT_LMP4:  Make the encoder output type the LEAD proprietary MPEG4 video subtype. This allows super compression to be used.

 

LMP4_OUTPUTFORMAT_XVID:   Make the encoder output type the XVID video subtype.

VARIANT_BOOL

SuperCompression

Enables/disables super compression, LEADs improvement to the MPEG4 video compression. When super compression is used, compressed video size is reduced noticeably with almost the same quality, and the encoding and decoding speed is enhanced.

Files generated using this option, will not be MPEG4 compliant: they can be decoded only by the LEAD MPEG4 Video Decoder .

Possible values are:

VARIANT_TRUE:    Enable super compression. This is allowed only if the output format is set to LMP4_OutputFormat_LMP4.

VARIANT_FALSE:  Disable super compression.

long

PFrames

Specifies the number of P frames between two successive I frames.

long

BFrames

Specifies the number of B frames between two successive P frames.

long

SearchWidth

The search block width used when determining if motion is occurring. The larger the block, the slower the encoding process. It is not recommended to use large values. The range is from 2 to the video stream width, in pixels.

long

SearchHeight

The search block height used when determining if motion is occurring. The larger the block, the slower the encoding process. It is not recommended to use large values. The range is from 2 to the video stream height, in pixels.

eMotionAlgorithm

MotionAlgorithm

The algorithm to be used when determining if motion is occurring. Possible values are (members of the eMotionAlgorithm enumeration):

LMP4_MOTIONALGORITHM_FullSearch:  Use the full motion search algorithm (testing all possibilities). This option slows down the encoding process considerably.

LMP4_MOTIONALGORITHM_FastSearch:  Use fast motion search.

eMotionAccuracy

MotionAccuracy

Motion estimation accuracy. Possible values are (members of the eMotionAccuracy enumeration):

LMP4_MOTIONACCURACY_FullPixel:  One pixel accuracy.

LMP4_MOTIONACCURACY_HalfPixel:  Half pixel accuracy (faster).

eMotionVectorPerMacroblock

MotionVectorPerMacroblock

Specifies how many motion vectors are used in the motion estimation algorithm. Possible values are (members of the eMotionVectorPerMacroblock enumeration):

LMP4_MOTIONVECTOR_OnePerMacroblock:  Use one motion vector (fast).

LMP4_MOTIONVECTOR_FourPerMacroblock:  Use four motion vectors (better quality, slower encoding).

eEncodingThreads

EncodingThreads

The number of threads used during encoding. The maximum number of threads that can be used is 8. Using multi threads with a multi core machine or multi CPUs will increase the encoding speed significantly. Possible values are:

LMP4_THREAD_AUTO: Have the LEAD MPEG4 Encoder determine the appropriate number of threads.

LMP4_THREAD_1: Use 1 thread during encoding

LMP4_THREAD_2: Use 2 threads during encoding

LMP4_THREAD_3: Use 3 threads during encoding

LMP4_THREAD_4: Use 4 threads during encoding

LMP4_THREAD_5: Use 5 threads during encoding

LMP4_THREAD_6: Use 6 threads during encoding

LMP4_THREAD_7: Use 7 threads during encoding

LMP4_THREAD_8: Use 8 threads during encoding

VARIANT_BOOL

InsertVOL

Set to VARIANT_TRUE to insert a mpeg4 header before each I-frame. This is useful in a video broadcasting where the mpeg4 decoder might start decoding from the middle of the stream.

VARIANT_BOOL

InsertGOV

Set to VARIANT_TRUE to insert an optional header before I frames that indicates to the decoder the timestamp of the I frame and whether it is open/closed GOV. This helps the stream to be randomly seeked in some decoders. However, the LEAD MPEG4 decoder does not require it.

eCompressionMode

CompressionMode

Sets the compression mode. Possible values are:

LMP4_COMPRESSIONMODE_ConstantQuality: Uses the QFactor property value to regulate the image quality.

LMP4_COMPRESSIONMODE_VariableBitrate: Varies the quality over short durations. However, it will achieve an average rate matching the BitRate property value.

LMP4_COMPRESSIONMODE_ConstantBitrate: Strictly adheres to the rate specified in the BitRate property.

long

BitRate

This is the average or constant bitrate used when the CompressionMode is set to LMP4_COMPRESSIONMODE_VariableBitrate or LMP4_COMPRESSIONMODE_ConstantBitrate. The value is in bits per second.

eMotionAccuracy MotionAccurancy

Motion estimation accuracy. Possible values are (members of the eMotionAccuracy enumeration):

LMP4_MOTIONACCURACY_FullPixel:  One pixel accuracy.

LMP4_MOTIONACCURACY_HalfPixel:  Half pixel accuracy (faster).

VARIANT_BOOL Interlacing Set to VARIANT_TRUE to encode the video as interlaced fields. Otherwise, the video is encoded as frames. The default is VARIANT_FALSE.
long SceneChangeThreshold The threshold that determines a scene change point in a video clip. The encoder calculates this value for every inter-frame being encoded. If the calculated value is greater than threshold then it is a scene-change point and the frame will be encoded as an I-frame. this value should be between 1 and 100 and default is 50, (values between 30-50 gives the best compression result). To turn off this feature Scene Change Detection, should be set to 100.
eEncodingPassesCount EncodingPasses

Specifies the number of encoding passes. Possible values are (members of the eEncodingPassesCount enumeration):

LMP4_ENCODINGPASSESCOUNT_ONE:  Use 1 pass mode in encoding.

LMP4_ENCODINGPASSESCOUNT_TWO:  Use 2 passes mode in encoding.

Interface Methods:

HRESULT ResetToDefaults();

Description

Resets the filter properties to their default values. Calling this method can cause the filter to reconnect its output pin.

The default values are:
OutputFrameRate = -1.0
PFrames = 9
BFrames = 0
OutputFormat = LMP4_OUTPUTFORMAT_mp4v
BitRate = 300000
interlaced = VARIANT_FALSE
InsertVOL = VARIANT_TRUE
insertGOV = VARIANT_FALSE
SceneChangeThreshold = 50
EncodingPassesCount = LMP4_ENCODINGPASSESCOUNT_ONE
EncodingThreads = LMP4_THREAD_1
CompressionMode = LMP4_COMPRESSIONMODE_ConstantQuality;
MotionVectorPerMacroblock = LMP4_MOTIONVECTOR_OnePerMacroblock;
MotionAccuracy = LMP4_MOTIONACCURACY_FullPixel;
MotionAlgorithm = LMP4_MOTIONALGORITHM_FastSearch;
QuantType = LMP4_QUANTTYPE_Linear;
QFactor = 4;
SuperCompression = 0;
SearchHeight = 16;
SearchWidth = 16;

Returns

S_OK if successful, < 0 if an error occurred.

Common error codes:

VFW_E_WRONG_STATE

The filter is in the wrong state.

HRESULT WriteToRegistry();

Description

Writes the values of all of the properties listed above to the system registry, so that the decoder will remember these settings the next time it is used. This method is automatically called by the property page when you apply modified settings by clicking on the Apply or OK button.

Returns

S_OK if successful, < 0 if an error occurred.

* To increase compression performance, MPEG4 uses Temporal Compression. Temporal compression is achieved by only encoding the difference between successive frames instead of the frames themselves. This means that frames cannot be considered in isolation. A given picture is constructed from the prediction from a previous picture, and may be used to predict the next picture. An MPEG-4 video stream is comprised of I Frames, B Frames and P Frames:

So to increase the compression of MPEG-4 more B and P frames should be used by adjusting PFrames and BFrames properties.

Help Version 20.0.2020.6.12
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Filters C API Help