This is the interface for the LEAD H264 Encoder.
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
H264FORMAT_HIGH_H264 = 11, // Uses h.264 High Profile
H264FORMAT_HIGH_AVC1 = 12, // Uses AVC1 High 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_INTELQUICKSYNC = H264COMPRESSIONENGINE_QUICKSYNC_HARDWARE,
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_HARDWARE = H264CAPABILITY_QUICKSYNC,
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 */
} eH264CAPABILITY;
Lists the possible capabilities that can be reported by the Capability property.
typedef enum
{
H264SPEED_1 = 1,
H264SPEED_2 = 2,
H264SPEED_3 = 3,
H264SPEED_4 = 4
} eH264ENCODINGSPEED;
Lists the possible encoding speed, set in the EncodingSpeed property.
Type | Name | Description |
---|---|---|
eH264CAPABILITY |
(Read-only) Indicates whether hardware compression and High profiles are available. If Capability is:
See the LEAD H264 Encoder 4.0 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 the 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:
You can determine CUDA hardware acceleration capability by using the following code:
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 H26 encoder uses Rate Driven compression or Quality Driven compression. If 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. The maximum bitrate is limited to 10Mbps (10,000,000) for the Quicksync (QSV) hardware encoder. To use higher bitrates, you should use the CUDA or software encoder. |
long |
MaxBitRate |
The maximum bitrate, in bits per second, when the EnableRateControl value is TRUE. Not available when using Quick Sync Hardware acceleration. See Configuring the H.264 Encoder for Streaming for more information. If 0, the bit rate is not limited. (default). If -1, the maximum bit rate is set to be 20% higher than the Bit Rate. (In other words, 1.2 * Bit Rate.) |
long |
MaxFrameDuration |
The maximum duration (in milliseconds) of the biggest single frame (usually the I frame). Available when the EnableRateControl value is TRUE. The duration is calculated at the specified Bit Rate. Not available when using Quick Sync or CUDA Hardware acceleration is selected. See Configuring the H.264 Encoder for Streaming for more information. If 0, the frame duration is not limited. In extreme cases (like still image video), one frame (the I frame) can be as big as the whole GOP. |
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 |
EnableSuperCompression |
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 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. |
long | PreferredCUDADevice | A read-write property indicating which CUDA device to use (0-based). This property is useful only when the encoder is using the NVIDIA encoder and when the system has more than one NVIDIA graphics card with CUDA capabilities. The property can be set to the following values:
In general, it is better for the compressions to be balanced among the existing CUDA devices. Conversions will be faster and you will also avoid burnout situations, (in which the card can be destroyed by over-use if the fan does not cool the card properly). GPUCount indicates the number of CUDA-capable devices and can be obtained with the GetCUDAInfo method. You can set this property to indicate which device to use. You can also get it to find out which device will be used. If AutoSelect mode is used (if this property is -1), then you can find out which device will actually be used by getting the SelectedCUDADevice property. This property is useful only if you have more than one CUDA device on your computer. |
long | SelectedCUDADevice | A 0-based read-only property that can be used to find out which CUDA device will be used for conversion. If you wish to change the selection, set the PreferredCUDADevice property to the device you wish to use (value between 0 and GPU_Count - 1). |
VARIANT_BOOL | EnableDriftCorrector | Property indicating whether the encoder should automatically correct timestamp drifting. If VARIANT_FALSE, timestamps are not corrected. If VARIANT_TRUE, the encoder will automatically correct timestamps that drift over time. If this property is enabled (set to VARIANT_TRUE), the encoder will work together with any other encoders in the current graph to correct drifts and synchronize audio and video. Currently, only the LEAD H264, H265 and AAC Encoders support this feature. The default value for this property is VARIANT_FALSE (timestamp drifting is not corrected). This is an advanced low-level setting that should be set to a VARIANT_TRUE value only if:
If you are unsure whether to use it or not, leave this property set to VARIANT_FALSE, because setting it incorrectly can cause big problems. See the Timestamp drifting in live capture situations topic for more details.
|
BSTR | TimeQualityFactorFileName | Gets or sets the Time/Quality factor file name. when this option used, the encoder will set the quality according to Time/Quality records provided in the file. |
VARIANT_BOOL | EnablePrecisionTimeStamp | Specifies whether precision time stamps should be added to the compressed stream. If TRUE, precision time stamps are added to each compressed frame. If FALSE, precision time stamps are not added. The default value is FALSE (the presentation timestamps are not added to the stream). See the Precision Time Stamps topic for more information on precision time stamps. |
double | PrecisionTimeStampStartValue | This property is used only if the EnablePrecisionTimeStamp property is set to TRUE. Represents the start value for the precision time stamp. This value is in microseconds since Jan 1, 1970 and is relative to Coordinates Universal Time (UTC). Use the ConvertDateToPrecisionTimeStamp method to convert a date string to this value. If this property is set to -1, the start value will be the current time when the compression starts. The default value for this property is -1 (the start time is the compression start time). |
eH264ENCODINGSPEED | EncodingSpeed | Gets or sets the Encoding speed. |
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.
S_OK if successful, S_FALSE otherwise.
Force a key-frame during encoding or changing the type of the encoding frame to be Key frame / I frame. This method can be useful for streaming.
S_OK
eH264APILEVEL ApiLevel
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.
S_OK if connected, S_FALSE otherwise.
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. |
puRequiredDriverVersion |
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. |
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. This string is the string displayed by the "CUDA Info" button in the H264 Encoder Property page.
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 (https://www.nvidia.com/en-us/). 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.
You can get more information on each GPU device by calling the GetCUDADeviceSettings method.
S_OK if connected
E_OUTOFMEMORY if there is not enough memory to allocate the resulting string.
device | 0-based index of the CUDA device (between 0 and GPUCount - 1). |
pszDeviceName | Optional pointer to a variable that will be updated with the CUDA device name. Can be NULL if this information is not needed. |
pszFriendlyDeviceDescription | Optional pointer to a variable that will be updated with a user-friendly string containing information on the specified CUDA device. Can be NULL if this information is not needed. |
pUsagePercentage | Optional pointer to a variable that will be updated percentage of time the device was in use in the last second. Value will be between 0 (device was idle the whole time) and 100 (the device was in use the whole time). Can be NULL if this information is not needed. |
pCurTemp | Optional pointer to a variable that will be updated with current temperature in degrees Celsius. Can be NULL if this information is not needed. |
pMinTemp | Optional pointer to a variable that will be updated with minimum temperature in degrees Celsius. Can be NULL if this information is not needed. |
pMaxTemp | Optional pointer to a variable that will be updated with maximum temperature in degrees Celsius. Can be NULL if this information is not needed. |
Use this method to get more information on a CUDA device's current settings. Use this method to monitor the usage and temperature for a particular GPU device. For example, you might use this to make sure the temperature does not get too hot, (since some graphics card can be destroyed if they are used too much for long periods of time). If you burn out the card, it is destroyed permanently. The problem will NOT go away by restarting the computer or by turning the computer off so the card cools down. The card is damaged for good and has to be replaced.
S_OK if successful
LTMM_E_CUDA_DEVICE_NOT_AVAILABLE [0x80050020] if device is not between 0 and GPUCount - 1
E_OUTOFMEMORY if there is not enough memory to allocate the resulting string.
E_FAIL if an unexpected error occurred getting the device's settings
pszDateString |
The string containing the date and time |
pszFormatString |
Optional string describing the format in pszDateString. Can be NULL or empty string (""), in which case the date string should be in one of the standard formats. See Custom Formats for more details on the custom format string. |
pPrecisionTimeStampValue |
Pointer to a value that will receive the time in microseconds since 1970. |
Use this method to convert a string containing the date and time to a number representing microseconds since Jan 1, 1970. This value can be then used to set the PrecisionTimeStampStartValue property.
See the Precision Time Stamps topic for more information on precision time stamps and the format of the strings that can be converted.
S_OK if successful, < 0 if an error occurred.