Available in LEADTOOLS Multimedia toolkits. |
LEAD H263 Encoder Also known as compressor, this is a module or algorithm to compress data. Playing that data back requires a decompressor, or decoder. User Interface (2.0)
The compression options for the LEAD H.263 Encoder can be set manually through the encoder property page. They can also be set programmatically through the ILMH263Encoder interface (see ILMH263Codec Interface).The following figure shows the encoder property page:
Changes will be applied directly to the streaming media with the ability to set them permanently by clicking Apply or OK, or to abandon changes by clicking Cancel. Positioning the mouse pointer over a control displays general information for that control.
If you are using the encoder with a third-party software package, refer to your software’s documentation for information on how to access the encoder’s property page(s).
The following table shows the controls and their descriptions:
Control |
Description |
|
Bitrate Control group |
Use the controls in this group to control the bitrate. |
|
Variable Bitrate (VBR) radio button |
Select the Variable Bitrate radio button when you want the file to be a certain quality. |
|
Predefined Quality Factors radio button |
Select the Predefined Quality Factors radio button when you want to use one of the predefined quality factors. |
|
Predefined Quality Factors drop-down list box |
A list of predefined quality factors. The default value is "Quality is more important than size". Possible values are: |
|
|
Value |
Meaning |
|
Perfect quality |
Quality Factor 4 |
|
Quality is more important than size |
Quality Factor 5 |
|
Quality and size are equally important |
Quality Factor 6 |
|
Size is more important than compression |
Quality Factor 9 |
|
Highest compression |
Quality Factor 31 |
Custom Quality Factor radio button |
Select the Custom Quality Factor radio button to use a custom rate. |
|
Custom Quality Factor drop-down list box |
Possible values range from 1 through 31. Low values generate good quality and lower compression, while high values generate low quality and high compression. The default value is 6. |
|
Constant Bitrate (CBR) radio button |
Select the Constant Bitrate radio button when the generated file should use a specific bitrate. |
|
Predefined Bitrate List radio button |
Select the Predefined Bitrate List radio button when you want to use one of the predefined bitrates. |
|
Predefined Bitrate drop-down list box |
A list of predefined bitrates. Possible values are: |
|
|
Value |
Meaning |
|
Modem |
(56Kbps) |
|
ISDN |
(128Kbps) |
|
ISDN |
(256Kbps) |
|
DSL |
(384Kbps) |
|
Cable |
(768Kbps) |
|
T1 |
(1500Kbps) |
|
Wireless 802.11b |
(11Mbps) |
|
T3 |
(45Mbps) |
|
Wireless 802.11g |
(54Mbps) |
|
LAN |
(100Mbps) |
|
LAN |
(1Gbps) |
Custom Bitrate (bits/sec) radio button |
Select this radio button in order to enter a custom setting. |
|
Custom Bitrate edit box |
Enter the desired bitrate (in bits/second). Note that this is 8 times larger than a bitrate specified in bytes per second. For example, for a bitrate comparable with a 33kbps modem, you would enter 33000 as the bitrate. |
|
Advanced/Speed settings group |
Use the controls in this group to adjust options that affect compression. |
|
Predefined Speed radio button |
Select the Predefined Speed radio button when you want to use one of the predefined speeds. |
|
Predefined Speed drop-down list box |
A list of predefined speeds specifying the 5 most common combinations. The default value is "High quality". Possible values are: |
|
|
Value |
|
|
High quality |
|
|
Quality is more important than speed |
|
|
Quality and speed are equally important |
|
|
Speed is more important than quality |
|
|
High speed |
|
Custom Speed radio button |
Select this radio button to turn each option on or off. |
|
Unrestricted MV check box |
Select this check box to allow motion vectors (MV) to point outside the picture. The edge pixels are used as prediction for the "not existing" pixels. With this mode, a significant gain is achieved if there is movement across the edges of the picture, especially for the smaller movies. The default value is selected. |
|
Deblocking Filter check box |
Select this check box to reduce the blocky artifacts generated at higher compression by using an adaptive filter across block boundaries. Use this option to improve the video quality at low bit rate (high compression). The default value is selected. |
|
Advanced Intra Coding check box |
Select this check box to improve the compression efficiency for INTRA macroblock encoding by using spatial prediction for DCT (Discrete Cosine Transform) coefficient values. The default value is selected. |
|
Advanced Prediction Mode check box |
Select this check box to use Overlapped Block Motion Compensation (OBMC) for the luminance part of P-pictures. Four 8x8 vectors instead of one 16x16 vector are used for some of the macroblocks in the picture. The encoder has to decide which type of vectors to use. Four vectors use more bits, but give better prediction. The default value is selected. |
|
Frame Rate Settings group |
Use the controls in this group to adjust frame rate settings. |
|
Input Frame Rate (fps) edit box |
The Input Frame Rate (fps) edit box displays the frame rate of the input video. This is for informational purposes only. |
|
Output Frame Rate (fps) drop-down list box |
Use the Output Frame Rate drop-down list box to specify one of the predefined output frame rates. The default value is "Input Frame Rate". Possible Values are |
|
|
Value |
Meaning |
|
Input Frame Rate |
Select this item to keep the frame rate unchanged. |
|
3.000 |
|
|
4.000 |
|
|
5.000 |
|
|
7.000 |
|
|
10.000 |
|
|
12.000 |
|
|
15.000 |
|
|
18.000 |
|
|
20.000 |
|
|
22.000 |
|
|
23.976 |
|
|
24.000 |
|
|
25.000 |
|
|
29.970 |
|
|
30.000 |
|
|
60.000 |
|
Other Options group |
Use the controls in this group to adjust other options. |
|
RTP check box |
Select this check box to packet an H.263 video stream with Real-Time Transport Protocol (RTP) headers. This should be done when transmitting H.263 video streams over the Internet. If you are not using the codec inside a videoconferencing application, we do not recommend using this option. The default value is unselected. |
|
Enable High Compression check box |
Select this check box to enable the high compression mode, which is an non-standard extension introduced by LEAD Technologies, Inc. to the H.263 compression algorithm. This will generate smaller video, but only the LEAD H.263 Decoder can decode this video. The default value is unselected. |
|
Output Sorenson Video (Flash) check box |
Select this check box to generate Sorenson video, which is a modified version of H.263 compression used in Flash (FLV) files. Clear this check box to generate regular H.263 video. The default value is unselected. |
|
GOP settings group |
Use the controls in this group to adjust the Group Of Pictures (GOP) settings. |
|
Key Frame Interval Unit Seconds radio button |
Select this radio button to specify the distance between key frames in seconds. The default value is Frames. |
|
Key Frame Interval Unit Frames radio button |
Select this radio button to specify the distance between key frames in frames. |
|
Key Frame Interval edit box |
Specifies the maximum distance between key frames. Note that the codec might still insert additional key frames if it detects that a new key frame is necessary. A new key frame is generated sooner if the background changes too much and the current key frame is not suitable anymore for the frames being compressed. The default value is 30 frames. |
|
No. of Bs between 2 Ps drop-down list box |
Specifies how many B frames should be encoded between two Ps. Possible values range from 0 through 10. The default value is 10. |
Compression Group
Use the Compression group controls to manage compression. The LEAD H.263 Encoder has two compression modes: Quality driven, using Variable Bitrate (VBR); and Rate driven, using Constant Bitrate (CBR).
Quality-Driven
Use a variable bitrate to create a file with a specific quality. In such cases, it is not possible to accurately predict the generated file size. However, the movie will have the same quality throughout its length. Also, videos of various sizes (width, height, frame rate) will have a consistent quality when they are compressed using the same quality factor. Of the predefined options, "Perfect quality" results in the best quality while "Highest compression" results in the worst quality. If none of these are suitable, select one of the custom quality factors. When using quality driven compression:
Low quality factor values will generate better quality videos and lower compression (larger file size)
High quality factor values will generate lower quality videos and higher compression (smaller file size)
Variable bitrate (VBR) compression can be controlled in two ways: by selecting one of the predefined compressions, or by selecting a custom quality factor.
Rate-Driven
Use a constant bitrate when the generated file should have a specific bitrate. Typically this is used when a file is put on a web site and the file is to be played by computers whose Internet connection matches a specific speed. Or, when a codec in a videoconferencing application uses a specific connection speed.
Remember that the bitrate is measured in bits per second (bps) not bytes per second! To convert bits/second to bytes/second, divide by 8. Files compressed with variable bitrates should have the same size, regardless of the video width and height. This means that when two videos of different width and height are converted to the same bitrate, the video with the larger size will have a poorer quality than the video with smaller size.
Constant Bitrate (CBR) compression can be controlled in two ways: by selecting one of the predefined bitrates, or by selecting a custom bitrate.
Advanced/Speed Settings group
Use the controls in the Advanced/Speed Settings group to manage four encoder options that affect the compression. The Predefined Speed options lists the 5 most common combinations. Use the Custom Speed options to turn specific options on or off. When using any of these options, be aware that the compression / decompression algorithm becomes more complex, hence the compression / decompression process becomes slower. However, each option improves the performance of the encoder (resulting in better compression and quality).
Frame Rate Settings
Use the controls in the Frame Rate group to modify the frame rate of the file being compressed. Usually, videos are 30fps (30 frames per second). At this frame rate, the human eye perceives moving objects as smooth. Reducing the frame rate greatly increases the compression. But, as the frame rate is reduced, the video becomes jerkier. At 15fps video will still look acceptably smooth. Below this, the jerkiness becomes noticeable.
Generally, decrease the video frame rate in order to achieve higher compression. You can also increase the frame rate, but that is not recommended, since the output file will be bigger and the quality will not be any better. For example, if the original video is 15fps and you compress it as 30fps, the compressed video will NOT be smoother than the original.
The Input Frame Rate box displays the frame rate of the input video. This is for informational purposes only.
Use the Output Frame Rate drop-down list box to select one of the predefined output frame rates. When the output frame rate to Input frame rate, then the H.263 Encoder will not change the video frame rate. Select one of the other options (3.000, 4.000, etc ) to use the specified frame rate for the output file. For example, selecting 15.000 will make the output video 15fps.
It is recommended to reduce the frame rate if you increase the quality factor to the point you start seeing compression artifacts and the compression is still not good enough. In that case, reduce the frame rate and reduce the quality factor and you might get better visual results.
Note: The Video For Windows (VFW) version of the codec cannot change the frame rate for the file. If you look at the properties for a file generated with the LEAD H.263 Codec (VFW), the frame rate will appear to be the same as the input file. But, if you play the file, you will notice that the frame rate is changed. Also, the VFW codec can only REDUCE the frame rate. If you convert a file that is 15fps and try to convert the file to 30fps, the generated file will still be 15fps.
Other Options group
Select the RTP check box to packet an H.263 video stream with Real-Time Transport Protocol (RTP) headers. This should be done when transmitting H.263 video streams over the Internet. If the codec is not being used inside a videoconferencing application, we do not recommend using this option.
Select the Enable High Compression check box to enable the high compression mode, which is a non-standard extension introduced by LEAD Technologies, Inc. to the H.263 compression algorithm. The result of such compression is a smaller video, but only the LEAD H.263 Decoder can decode this video.
Select the Output Sorenson Video (Flash) check box to enable Sorenson video, which is a non-standard extension introduced by Sorenson Media, Inc. to the H.263 compression algorithm. This format is used in Flash (FLV) files. Leave this check box unselected to generate regular H.263 video (including video for 3GPP format).
GOP settings (Group Of Pictures settings)
Use the controls in the GOP Settings group to specify the distance between key frames and the number of B frames encoded between two P frames. Key frames are frames compressed independently and they have the best quality in the video. In highly compressed video, you will notice that at regular intervals, the video starts looking good, then it degrades, then it fixes itself, it degrades again, etc. The encoding of a key frame causes the fix. So the more key frames you have, the better the video will look. There is a price for that: key frames are a lot larger then the non-key frames, so the more key frames you have the lower the compression will be.
Also, the more key frames are used the faster the seek operations. Seeks occur when you play a video file and you try to skip ahead in the movie. You will notice that the playback does not start immediately. Reduce the delay between the seek and when the playback starts by reducing the distance between key frames.
The distance between key frames to be can be specified either in Seconds or Frames. For example, to have a key frame to come every 3 seconds, set the unit to Seconds and the distance to 3. To have the key frame to come every 90 frames, set the unit to Frames and the distance to 90. Note that, for a 30fps video, 90 frames is equivalent to 3 seconds. For a 10fps video, 90 frames is equivalent to 9 seconds.
Use the Key Frame Interval Unit radio buttons to specify whether the distance between key frames is in Seconds or Frames. Use the Key frame interval to specify the maximum distance between key frames. Note that the codec might still insert additional key frames if it detects that a new key frame is necessary. A new key frame is generated sooner if the background changes too much and the current key frame is not suitable anymore for the frames being compressed.
I Frames and P Frames
A video stream is comprised of I Frames, B Frames and P Frames:
I: (Intraframe, or key frame) frames are the largest frames, with the best quality and can be used for seeking and resynchronization. They are compressed independently and do not depend on other frames.
P: (Predictive) frames are encoded using the previous I (or P) frame as reference. P frames are compressed more than I frames. P frames are smaller than I frames, with less quality but higher compression. They depend on the previous I or P frame.
B: (Bi-directional) frames are encoded using both previous and next I (or P) frames as reference and they are compressed more than both I, and P frames. B frames are smaller than I frames, with less quality but higher compression. They depend on the previous I or P and on the next I or P frames. They are usually smaller than P frames, but that is not guaranteed. They also take longer to compress than P frames.
Use more B and P frames (using the selections in the No. of Bs between 2 Ps drop-down list) to increase compression. The No. of Bs between 2 Ps: represents the number of B frames between 2 successive P frames. All the frames between successive P frames are B frames.
General notes
1) When the encoder is in Constant Bitrate mode (CBR), the generated bitrate will be close to, but not exactly the rate requested. If the rate is too low for the video dimensions (width x height) and the frame rate, the achieved bitrate might not be even close to what you requested. Also, if you generate AVI files, keep in mind that, by default, the generated AVI files will have padding with JUNK chunks. The padding is intended to speed up the playback by aligning the compressed chunks in the file to multiples of 512. This can distort the real achieved video bitrate and will make it seem like the compressor did not compress too much. To avoid this, you need to set the multiplexing mode in the AVI muxer properties to Full. Here is a screen shot of this setting as obtained with the M2Convert Pro application (see http://www.m2convert.com):
If you save AVI files using a different application, please consult the applications documentation to find out how you turn on the full multiplexing when creating AVI files. Or you can avoid all these problems by using Ogg files, which have a much lower overhead than AVI files.
Also, if you save video and audio, it will be harder to tell what the video bitrate is. The custom bitrate from the video compressor is the target bitrate for the video stream. The generated files bitrate will be higher, because it will contain video, audio and the overhead of the file format.
The generated bitrate (in bits/second) for a particular file is
Bitrate_bps = file_size_bytes * 8 / file_duration_seconds.
Generating a 3GPP H.263 Stream
It is possible to create a 3GPP H.263 stream that will play on mobile phones by using the LEAD H263 Encoder, the LEAD AMR Audio Encoder, and the LEAD ISO Mixer, along with the Resize Filter and Frame Rate Controller.
The following H.263 settings are suggested:
ILMH263Codec:: put_UseQuality(VARIANT_FALSE);
ILMH263Codec::put_UsePredefinedBitrate(VARIANT_FALSE);
ILMH263Codec::put_CustomBitrate(64000);
ILMH263Codec::put_UsePredefinedSpeed(VARIANT_FALSE);
ILMH263Codec::put_UseUnrestrictedMotionVector(VARIANT_FALSE);
ILMH263Codec::put_UsePBFrame(VARIANT_FALSE);
ILMH263Codec::put_UseDeblockingFilter(VARIANT_FALSE);
ILMH263Codec::put_UseAdvancedIntraCoding(VARIANT_FALSE);
ILMH263Codec::put_UseAdvancedPredictionMode(VARIANT_FALSE);
ILMH263Codec::put_OutputFrameRate(-1.0);
ILMH263Codec::put_UseRTP(VARIANT_FALSE);
ILMH263Codec::put_UseSuperCompression(VARIANT_FALSE);
ILMH263Codec::put_IDistanceUnit(UNIT_SECONDS);
ILMH263Codec::put_IDistance(60);
ILMH263Codec::put_PDistance(0);
ILMH263Codec::put_SorensonOutput(VARIANT_FALSE);
Please note the following about these settings:
The average video bitrate must not exceed 64000
Various I frame distances can be used, but keeping the P frame distance at 0 is recommended
The frame rate cannot exceed 14.985 fps.
The video dimensions have to be 128x96 or 176x144