LEADTOOLS Filters Help > Filters, Codecs and Interfaces > Video Codecs > H264 > ILMH264Encoder Interface (4.0) |
Also known as compressor, this is a module or algorithm to compress data. Playing that data back requires a decompressor, or decoder.
Also known as compressor, this is a module or algorithm to compress data. Playing that data back requires a decompressor, or decoder.
This is the interface for the LEAD H264 Encoder.
Interface Properties:
Type |
Name |
Description |
eH264CAPABILITY |
(Read-only) Indicates whether hardware compression and High profiles are available. If Capability is:
See the How to Enable Quick Sync Hardware Compression and High Profiles in the LEAD H.264 Encoder topic for more information on installing libmfxsw32/64.dll. If you do not install libmfxsw32/64.dll, Quick Sync hardware compression will not be available. You might still be able to encode High Profiles without installing libmfxsw32/64.dll if your computer has NVIDIA CUDA capabilities. Unlike the Quick Sync video case, you do not need to install anything special to get access to CUDA hardware acceleration. Everything is installed by the NVIDIA display driver. You might need to install a newer version of the display driver if the display driver does not have support for CUDA 5.5 engine. See the GetCUDAInfo method below for more information. The H264CAPABILITY_XXX values let you easily determine whether Quick Sync hardware acceleration is available by performing a bitwise 'and' operation. Use the following 'if' statement in C to determine whether the computer has Quick Sync hardware acceleration capabilities: if((int)Capability & H264CAPABILITY_QUICKSYNC) { /* computer has Quick Sync hardware capabilities */ }
You can also check for CUDA hardware acceleration capability like this: if((int)Capability & H264CAPABILITY_CUDA) { /* computer has CUDA hardware capabilities */ }
As a recap, enabling SuperCompression will disable hardware acceleration (Quick Sync or CUDA). And you can also disable a particular hardware acceleration (Quick Sync or CUDA) by setting EnableCompressionEngine for the appropriate compression engine to VARIANT_FALSE. |
|
VARIANT_BOOL |
EnableRateControl |
Indicates whether the H264 encoder uses Rate Driven compression or Quality Driven compression. It this property is TRUE, Rate Driven compression is used and the rate is set in the BitRate property. If this is FALSE, Quality Driven compression is used and the quality factor is set in the QualityFactor property. |
long |
BitRate |
The bitrate, in bits per second, when the EnableRateControl value is TRUE. |
long |
QualityFactor |
Contains the video quality factor. A quality factor of 1 gives the highest quality and the largest video file size. A quality factor of 49 gives the lowest quality and smallest file size. This property is valid only if the EnableRateControl property is FALSE. |
IFrameIntervalUnit |
Represents the unit of IFrameInterval property or how the IFrameInterval property is interpreted by the encoder. If IFrameIntervalUnit = H264INTERVALUNIT_PFRAME, then the IFrameInterval represents the I-frame interval in term of P frames. If IFrameIntervalUnit != H264INTERVALUNIT_FRAME, then I-frame Interval is in terms of P and B frames. |
|
long |
IFrameInterval |
If IFrameIntervalUnit = H264INTERVALUNIT_PFRAME then this property specifies the number of P frames between two successive I frames plus one. A value of zero means there is only one I in the whole video and all the other frames are either P or B . If this value is one there will be NO P frame between any two I frames. If the value is 2 there will be ONE P frame between any two I frames and so on. If IFrameIntervalUnit = H264INTERVALUNIT_FRAME then this property specifies the number of frames between two successive I-frames, in other words it specifies the "Group of Pictures (GOP)" length. A value of zero means there is only one I-frame in the whole video and all the other frames are either P or B. If this value is one there will no P or B frames between any I frames. |
long |
PFrameInterval |
Specifies the number of B frames between two successive P frames. Note that all the frames between successive P frames are B frames. |
eH264SYMBOLMODE |
SymbolMode |
Flag that indicates the type of entropy coding to be used. For a list of possible values, refer to eH264SYMBOLMODE. |
VARIANT_BOOL |
Flag that indicates whether super compression is enabled. If TRUE, then LEAD's improvement to the H264 compression is enabled. If FALSE, LEAD's improvement to the H264 compression is not used. This option produces very high compression and makes the encoding and decoding processes very fast. If high quality video is desired, it is recommended to disable this option. This option is recommended for video conferencing and broadcast applications where speed and size are very important and moderate quality is ok. This property is only available if the output is H264FORMAT_AUTO, H264FORMAT_STANDARD_H264, H264FORMAT_STANDARD_AVC1, Note that if this property is TRUE, hardware acceleration will not be used for compression. In this case, the EnableSuperCompression property supercedes the EnableCompressionEngine property. |
|
VARIANT_BOOL |
EnableCompressionEngine (eH264COMPRESSIONENGINE compressionEngine, VARIANT_BOOL *pEnabled) |
Flag that indicates whether a certain compression engine should be used. The compressionEngine parameter indicates which compression engine to enable or disable. The pEnabled parameter indicates whether the compression engine should be enabled. Currently the following values can be passed for compressionEngine: H264COMPRESSIONENGINE_QUICKSYNC_HARDWARE [1]: Intel Quick Sync Video hardware acceleration. If you disable this compression engine, the encoder will not use Quick Sync Video hardware acceleration even if the computer is capable of Quick Sync hardware acceleration. This property is ignored if the computer is not capable of Quick Sync hardware acceleration (i.e. if the Capability property does not contain H264CAPABILITY_QUICKSYNC). H264COMPRESSIONENGINE_CUDA_HARDWARE [2]: NVIDIA CUDA hardware acceleration. If you disable this compression engine, the encoder will not use CUDA hardware acceleration even if the computer is capable of CUDA hardware acceleration. This property is ignored if the computer is not capable of CUDA hardware acceleration (i.e. if the Capability does not contain H264CAPABILITY_CUDA). |
float
|
FrameRate |
Sets the playback frame rate, in frames per second, of the compressed video, regardless of the rate of the input stream frames. The LEAD H264 Encoder automatically adjusts the input video to match the desired frame rate. The rate is adjusted by dropping or duplicating input frames. If the selected frame rate is lower than the original framerate, the compression will be higher. Use the value -1 if the output frame rate needs to be the same as the input frame rate. |
OutputFormat |
Value that specifies the output format. For a list of possible values, refer to eH264OUTPUTFORMAT . For Flash Encoding with H.264, use H264FORMAT_STANDARD_AVC1 or H264FORMAT_ BASELINE_AVC1. The first will give better compression results. To generate an h.264 RTP stream, select either H264FORMAT_BASELINE_RTP or H264FORMAT_MAIN_RTP. Such values should be selected only for broadcasting or streaming. The encoded stream should not go to a file or multiplexer. |
|
EncodingThreads |
The number of threads used during encoding. The maximum number of threads that can be used is 8. Using multiple (X) threads on multi-core (X number of cores) machine or X CPUs will increase the encoding speed significantly. Possible values are: Auto: Have the LEAD H264 Encoder determine the appropriate number of threads. 1: Uses 1 thread during encoding 2: Uses 2 threads during encoding X: Uses X threads during encoding and X slices per frame |
|
RestrictAvailableOutputFormats |
Restricts the available output formats that LEAD H264 encoder offers on its output pin. If it is set to H264FRESTRICTFORMATS_NONE, all the available output formats will be listed. If it is set to H264RESTRICTFORMATS_AVC1, the encoder (and property page) will list only the AVC1 Main and Baseline profiles AVC1 formats, which means the encoder offers only the FLASH formats. |
|
long
|
MaxRtpPacketLength
|
The encoder will process this property only when the selected OutputFormat is H264FORMAT_BASELINE_RTP or H264FORMAT_MAIN_RTP. This property specifies the max length of RTP packets in bytes. Each frame might consist of several RTP packets. The default length of RTP packets is 1250. The minimum value allowable is 142. Refer to RFC 3984 standard for further information. |
long |
RtpPayloadType
|
The encoder will process this property only when the selected OutputFormat is H264FORMAT_BASELINE_RTP or H264FORMAT_MAIN_RTP. This property specifies the payload type of the RTP packet. The default value is 97. Refer to RFC 3984 standard for further information. |
RtpSlicingMethod |
The encoder will process this property only when the selected OutputFormat is H264FORMAT_BASELINE_RTP or H264FORMAT_MAIN_RTP. This property specifies how the video frames are broken into slices by the h.264 encoder. Each slice will be wrapped by a Network Abstraction Layer (NAL) unit inside an RTP packet. If H264RTPSLICINGMETHOD_MAXBUFFERLENGTH is selected, the encoder will ensure that the size of each slice including the wrapper info (NAL and RTP ), is no larger than MaxRtpPacketLength. If H264RTPSLICINGMETHOD_MACROBLOCKROW is selected, the resultant output h.264 stream will be playable by TANDBERG Video Conferencing devices. Note that when you use CUDA hardware acceleration, the maximum number of slices is 4, which means a RTP packet might contain more than one macroblock row. If this causes a problem, disable CUDA hardware acceleration using the EnableCompressionEngine property. |
|
long |
RtpSynchronizationSourceIdentifier
|
The encoder will process this property only when the selected OutputFormat is H264FORMAT_BASELINE_RTP or H264FORMAT_MAIN_RTP. This property specifies the Synchronization Source Identifier for the RTP packets. If zero or no value is specified the encoder will pick a random value for this field. Refer to RFC 3984 standard for further information. |
Description
Writes the values of all of the properties listed above to the system registry, so that the encoder will remember these settings the next time it is used.
Return
S_OK if successful, S_FALSE otherwise.
Description
Force a key-frame during encoding or changing the type of the encoding frame to be Key frame / I frame. This method could be useful for streaming.
Return
S_OK
Parameters
eH264APILEVEL ApiLevel
Description
Resets resizing to default values. The ApiLevel determines which default values to use. Current applications should set ApiLevel to H264_APILEVEL_1 = 0.
The LEAD H264 Encoder might change in the future and have different properties or default behaviour. Calling this method ensures the filter will have the same default values as they were at the time you developed your application.
It is best to call ResetToDefaults(H264_APILEVEL_1) before you start setting properties and start calling other methods for this interface.
Returns
S_OK if connected, S_FALSE otherwise.
Parameters
pGPUCount |
Optional pointer to a variable that will be updated with the number of available CUDA GPU units. Can be NULL if this information is not needed. |
pszFriendlySystemDescription |
Optional pointer to a variable that will be updated with a user-friendly string containing information on the system. Can be NULL if this information is not needed. |
puInstalledDriverVersion |
Optional pointer to a variable that will be updated with version of CUDA engine installed on this system. Can be NULL if this information is not needed. |
puInstalledDriverVersion |
Optional pointer to a variable that will be updated with recommended version of CUDA engine that should be installed for optimal performance. Can be NULL if this information is not needed. |
Description
Use this method to get more information on the computer's CUDA capabilities. You can find out whether there are any GPUs, a user friendly string you can display to the user, and the recommended and installed versions of the CUDA engine present.
You can pass NULL for any parameters you don't need.
If pszFriendlySystemDescription is not NULL, the string returned is a wide char string allocated with the SysAllocString Windows API function. You are responsible for freeing it using the Windows API function SysFreeString.
The driver version is an integer having the following format: <h>0<m>0, where <h> is the major version (1..9) and <m> is the minor version (1..9). For example, version 5.5 is reported as the decimal number 5050.
The encoder might be able to use CUDA hardware encoding even if the installed version is less than the recommended version. But some features might not be available or the encoding might fail, so it is recommended that the display driver installed contains a CUDA engine with a version at least as high as the recommended version. If the installed version is less than the recommended version, you are encouraged to display a message asking the user to install the latest display driver for the graphics card from the NVIDIA web site (www.nvidia.com). Note that the display driver version does not necessarily correspond to the CUDA version.
If CUDA is not available the pGPUCount will be set to 0 and the puInstalledDriverVersion will be set to 0. Most systems will have 0 or 1 GPU units. In rare situations (systems with multiple graphics cards), pGPUCount will be set to 2 or more.
Returns
S_OK if connected
E_OUTOFMEMORY if there is not enough memory to allocate the resulting string.
typedef enum
{
H264SYMBOL_CAVLC = 0,
H264SYMBOL_CABAC = 1,
} eH264SYMBOLMODE;
Lists the possible values for the entropy coding mode, set in the SymbolMode property.
Lists the possible values for the output mode, set in the OutputFormat property.
typedef enum
{
H264FORMAT_AUTO = 0,
H264FORMAT_STANDARD_H264 = 1,// Uses h.264 Main profile
H264FORMAT_STANDARD_AVC1 = 2, // For Flash uses h.264 Main Profile
H264FORMAT_LEAD = 3, //Uses h.264 Baseline Profile
H264FORMAT_IPOD = 4,
H264FORMAT_PSP = 5,
H264FORMAT_BASELINE_H264 = 6, // Uses h.264 Baseline Profile
H264FORMAT_BASELINE_AVC1 = 7, // For Flash uses h.264 Baseline Profile
H264FORMAT_BASELINE_RTP = 8, // Uses h.264 Baseline Profile
H264FORMAT_MAIN_RTP = 9, // Uses h.264 Main Profile
H264FORMAT_IPAD = 10, // Uses h.264 Main Profile
} eH264OUTPUTFORMAT;
typedef enum
{
H264THREAD_AUTO = 0,
H264THREAD_1 = 1,
H264THREAD_2 = 2,
H264THREAD_3 = 3,
H264THREAD_4 = 4,
H264THREAD_5 = 5,
H264THREAD_6 = 6,
H264THREAD_7 = 7,
H264THREAD_8 = 8,
} eH264ENCODINGTHREADS;
Lists the possible values for the number of encoding threads, set in the EncodingThreads property.
typedef enum
{
H264FRESTRICTFORMATS_NONE = 0,
H264RESTRICTFORMATS_AVC1 = 1,
} eH264RESTRICTFORMATS;
Lists the possible values for the available output formats, set in the RestrictAvailableOutputFormats property.
typedef enum
{
H264RTPSLICINGMETHOD_MAXBUFFERLENGTH = 0,
H264RTPSLICINGMETHOD_MACROBLOCKROW = 1,
} eH264RTPSLICINGMETHOD;
Lists the possible values for the way a frame can be sliced (broken into slices), set in the RtpSlicingMethod property.
typedef enum
{
H264_APILEVEL_1 = 0,
} eH264APILEVEL;
typedef enum
{
H264INTERVALUNIT_PFRAME = 0,
H264INTERVALUNIT_FRAME = 1,
} eH264FRAMEINTERVALUNIT;
Lists the possible frame interval units to be interpreted by the encoder, set in the IFrameIntervalUnit property.
typedef enum
{
H264COMPRESSIONENGINE_QUICKSYNC_HARDWARE = 1,
H264COMPRESSIONENGINE_CUDA_HARDWARE = 2,
} eH264COMPRESSIONENGINE;
Lists the possible compressions engines that can be enabled or disabled using the EnableCompressionEngine property.
typedef enum
{
H264CAPABILITY_SOFTWARE = 0, /* Original software only, no high profiles */
H264CAPABILITY_SOFTWARE_NEW = 1, /* Quick Sync software, high profiles are available */
H264CAPABILITY_QUICKSYNC = 2, /* Quick Sync hardware, high profiles are available */
H264CAPABILITY_CUDA = 4, /* CUDA hardware, high profiles are available */
H264CAPABILITY_CUDA_SOFTWARE_NEW = 5, /* CUDA hardware, Quick Sync software, high profiles are available */
H264CAPABILITY_CUDA_QUICKSYNC = 6, /* CUDA hardware, Quick Sync hardware, high profiles are available */
} eH264COMPRESSIONENGINE;
Lists the possible capabilities that can be reported by the Capability property.