<!–#set var="article_header" value="MPEG-4:
Optimization of Picture Quality and Data Rate” –>
Perfect MPEG-4 Video: Resolution, Data Rate and Picture Quality
In our last article on MPEG-4, we looked in great depth at the question of how an entire film can be copied from a DVD onto a CD-ROM. We established that a 120-minute-long MPEG-4 video often did not fit entirely onto a CD-ROM on account of its data volume. This resulted in the film having to be split between two CD-ROM’s.
In this article, we want to look at the topic of video compression in order to achieve the optimum quality of an MPEG-4 video. With MPEG compression, the achievable picture quality ultimately depends on just one factor alone, namely the chosen data rate for encoding. This fact is clear to every user, namely the more data you have at your disposal when reproducing a video sequence with a certain resolution, the more precisely each picture consisting of 16 x 16 macro blocks can be encoded. Nevertheless, each resolution has a certain optimum level in terms of data volume and if this is exceeded no visible improvement in picture quality can be achieved. The most popular and, at the same time, best program for creating MPEG-4 videos is called Flask Mpeg. It permits simultaneous encoding of both the video and the audio element and joins both data streams together in real time, although Flask Mpeg only functions with video sequences in MPEG-2 format, which either originate from a DVD-ROM or have been produced from a video editing card.
Two different software encoders are currently available for MPEG-4 on Windows 95/98/NT 4.0 and Windows 2000, namely the fast motion and the slow motion codec. We copied copious amounts of video material from DVD to CD-ROM with both encoders, resulting in different videos with different resolution, quality and data rate. With this article, we will show how the best possible video quality can be achieved with a minimum data rate.
Optimization of Flask Mpeg: Intel and AMD CPUs
Before we turn to software encoders, the analysis of hardware and, especially, the processor inside the PC system is important. There are two different versions for the conversion program Flask Mpeg, one that that is optimized for AMD’s Athlon processors and one for Intel’s Pentium III and Pentium 4 processors. The difference is actually not in the encoder, but the MPEG2-decoder (namely the iDCT part), which is always required to encode an MPEG2-movie to MPEG4. You’ll find more information about FlasK at http://go.to/flaskmpeg. We would also like to mention that those two processor-optimized versions were created by Intel and AMD engineers as response to Tom’s Pentium 4 articles from November and December last year.
Choice Of The MPEG-4-Codec: Fast vs. Slow Motion
To keep the data stream as small as possible when encoding a DVD video, the choice of a suitable software codec is very important. For MPEG-4 there is DivX’s “fast motion codec” and “slow motion codec”. By using one of these two codecs, the essential choice has already been made. Therefore, at this point, the differences between the two codecs will be clearly pointed out:
Choice of suitable video codec.
Video sequence without “deinterlace” in MPEG-4 format.
The fast motion codec has been developed for video sequences, which contain a large number of fast movements (surprise surprise). These include, for example, action films where the movement direction of people and objects changes very often. At the same time, the scenes change very frequently, so that transitions are normally very sudden. This MPEG-4 codec works with dynamic compression and is, therefore, very efficient. Only the upper limit for the resulting data rate can be fixed – an exact setting is not possible. Here is an example: if a DVD video is coded with the fast motion codec and a maximum data rate of 6000 kbit/s, the average data rate in practice is between 1300 and 1400 kbit/s. The previously mentioned “6000 kbit/s” only refer to the maximum bit rate the encoder selects during the conversion process. An exact calculation of the data rate in order to, for instance, determine the data volume for writing a CD-ROM in advance is on no account possible.
Choice Of The MPEG-4-Codec: Fast vs. Slow Motion, Continued
The slow motion codec is suitable for landscape shots or sequences with a fixed camera. The codec achieves very good results with low resolutions.
The behavior of the slow motion codec is completely different. As the name suggests, it has been specially developed for slow video sequences. This codec demonstrates its superiority compared to the fast motion codec for films with little movement content and fixed camera positions. In contrast to the fast motion codec, the average data rate is set pretty precisely. This is achieved by setting the maximum data rate, which then closely corresponds to the average data rate. Thus, it is much easier to determine the file size of a film sequence to fit it on a single CD-ROM.
As the codec cannot be swapped or changed during the MPEG-4 encoding process, the content of the DVD film has to be roughly estimated right from the start. The fast motion codec is clearly to be recommended for action films. On the other hand, the slow motion codec is, at any rate, the better choice for landscape shots or fixed camera settings.
The audio data stream is rather small compared to the video content. A very good stereo sound quality can be achieved with a data stream of 128 kbit/s and a frequency response of 44 KHz.
Choosing the right audio codec is less complicated. The Fraunhofer MP3-codec is best suited, which can be adjusted both in terms of bit and sampling rate. A very good stereo sound quality is achieved with the 128 kbit/s (15 KB/s) and 44 KHz setting.
Focus On The MPEG-4 Fast Motion Codec
This sequence (720 x 416 pixels) was created with the fast motion codec with an average data rate of 1500 kbit/s (maximum 6000 kbit/s). Still the overall average data rate is extremely low at 145 KB/s.
Here the same sequence (720 x 416 pixels) can be seen with a very low (average) data rate of 250 kbit/s. You can still make out a lot of details.
Focus On The MPEG-4 Fast Motion Codec, Continued
The two examples above show the same sequence coded with the fast motion codec, but at different data rates. While the first video, with an average data rate of 1500 kbit/s, shows very sharp detail quality, compression artifacts become visible in the case of the second video with 250 kbit/s. As we are dealing with a very dynamic sequence, the use of the slow motion codec would generate a clear deterioration in picture quality.
The magnification clearly shows the compression artefacts with lower data rates.
The fast motion codec proves its strengths in the case of picture contents with many movement vectors. An example of this is a test sequence from the film “The Jackal”.
In spite of a lot of movement in this sequence, all the details can be clearly made out – thanks to the fast motion codec.
Low Resolutions: Better With Slow Motion Codec!
The same sequence prepared with the slow motion codec. Artefacts occur especially in the transitions of individual people.
Our test clearly establishes that if video sequences are prepared up to a resolution of 352 x 288 pixels (half PAL resolution), then the slow motion codec is definitely better suited! In this range, the video quality of the slow motion codec is better in spite of a lower data rate than with the fast motion codec with a higher data rate. The situation is completely different if the resolution exceeds 352 x 288 pixels. In this case, the fast motion codec should be used, irrespective of the film content (fast or slow movement). By way of a test sequence, we used the DVD video “The Jackal”, which was coded up to 720 x 576 pixels with different resolutions. Especially with a full PAL resolution it was shown that the fast motion codec produces very good video pictures with a relatively low average data rate.
Video Resolution | MPEG-4-Codec, Data Rate | Overall Data Rate | Quality | Length of Film on CD-R |
720 x 416 Pixels | Fast-Motion, max. 6000 KBit/s | 145 KB/s | very good | 83 min |
720 x 416 Pixels | Fast-Motion, max. 900 KBit/s | 128 KB/s | good | 94 min |
720 x 416 Pixels | Slow-Motion, max. 6000 KBit/s | 216 KB/s | very good | 55 min |
720 x 416 Pixels | Slow-Motion, max. 900 KBit/s | 128 KB/s | satisfactory | 94 min |
This table compares the two MPEG-4 codecs with a full PAL resolution. The slow motion codec produces a higher data rate with high resolutions than the fast motion codec.
Compromise: Quality vs. Resolution
Resolution | Bitrate Video MPEG-4 | Data Rate Audio | Overall | Quality | Length of Film CD-R 74 | Length of Film CD-R 80 | Length of Film CD-R 99 |
Video | Fast-Motion-Codec | Fraunhofer Codec | Data Rate | Burn to CD-R | Burn to CD-R | Burn to CD-R | |
176 x 112 Pixels | adaptive, max. 6000 KBit/s | 128 KBit/s, 44 KHz, Stereo | 37 KB/s | very good | 300 min | 323 min | 370 min |
240 x 192 Pixels | adaptive, max. 6000 KBit/s | 128 KBit/s, 44 KHz, Stereo | 45 KB/s | very good | 247 min | 266 min | 303 min |
352 x 224 Pixels | adaptive, max. 6000 KBit/s | 128 KBit/s, 44 KHz, Stereo | 70 KB/s | very good | 159 min | 171 min | 195 min |
480 x 288 Pixels | adaptive, max. 6000 KBit/s | 128 KBit/s, 44 KHz, Stereo | 94 KB/s | very good | 118 min | 127 min | 145 min |
576 x 336 Pixels | adaptive, max. 6000 KBit/s | 128 KBit/s, 44 KHz, Stereo | 109 KB/s | very good | 102 min | 110 min | 125 min |
640 x 480 Pixels | adaptive, max. 6000 KBit/s | 128 KBit/s, 44 KHz, Stereo | 129 KB/s | very good | 86 min | 93 min | 106 min |
720 x 416 Pixels | adaptive, max. 6000 KBit/s | 128 KBit/s, 44 KHz, Stereo | 145 KB/s | very good | 77 min | 83 min | 94 min |
This table shows the increase in the data rate depending on the chosen codec and the respective resolution. Furthermore, instructions are given for writing a DVD video onto a CD-ROM depending on the respective CD-R.
Especially in the case of DVD videos that have a playing time of more than 90 minutes, it is often the case that the storage capacity of a CD-ROM with just under 700 MB (CD-R80) is not sufficient. In order to avoid having to split the DVD video onto two CD-ROMs the average data rate should be reduced when carrying out the MPEG-4 encoding. In principle, there are two different ways of doing this. On the one hand, the resolution can be slightly reduced or, on the other hand, you have to marginally sacrifice picture quality, so that the data rate is lowered with a consistent resolution.
The following screenshots taken from our test sequences show the extent to which the different resolutions affect the average data rates.
All three video sequences were prepared with the slow motion codec and different bit rates. While the lowest resolution only requires 250 kbit/s, the resolution with 352 x 224 pixels needs as much as 700 kbit/s.
Compromise: Quality vs. Resolution, Continued
With higher resolutions, the fast motion codec presents clear advantages. In spite of the chosen maximum data rate of 6000 kbit/s the average data rate turns out to be considerably lower.
These two sequences were prepared with the fast motion codec. Thanks to the maximum data rate of 6000 kbit/s the optimum picture quality is achieved, whereby the average data rate still turns out to be very low.
This video was also produced with the fast motion codec.
Trimming: Without Edges a Lower Data Rate!
The highest resolution is 720 x 576 pixels and, thus, corresponds to a full PAL resolution. The resolution of the represented sequence is,actually lower, as the letterbox edges (16:9 format) have been removed.
A further measure for minimizing the data rate consists in removing the letterbox edges that often exist on a DVD video. The edges are attributable to the 16:9 picture format (cinema format).
Flask Mpeg allows any format and additionally allows lines and columns to be removed. With most DVD videos that have been shot in 16:9 format, the letterbox-bars are removed both in the upper and lower area by trimming.
This procedure increases the time required by the computer for the encoding, but the data volume is optimized as a result of the reduced data rate. In our test sequences, we were able to establish a reduction in the data rate of around 5 percent solely through trimming.
15 Percent Less Data Stream: Enable Deinterlace!
By enabling the “deinterlace” function with the Flask Mpeg encoder the data volume can be lowered by up to 15 percent without reducing the picture quality, although the encoding takes longer.
De-interlacing represents a further step in optimizing the data rate. Flask Mpeg offers this option via one of its video menus. When the “deinterlace” function is enabled, two neighboring pixels within a picture are approximated, i.e. a mathematical approximation or calculation ensues. The result is a picture, which is characterized by marginally less sharpness but a less coarse presentation. This function can virtually be compared with the soft focusing facility in image processing programs. De-interlacing increases the encoding time by at least 50%. The following two video sequences are coded with and without “deinterlace”.
15 Percent Less Data Stream: Enable Deinterlace!, Continued
Video sequence with “deinterlace” in MPEG-4 format.
Video sequence without “deinterlace” in MPEG-4 format.
This video sequence was prepared with the fast motion codec and 900 kbit/s maximal bit rate. As a very fast movement is involved, the screening can be seen. This effect disappears at 6000 kbit/s.
900 MB Video on One CD-ROM
Type | Memory Capacity | Memory Capacity | CD-R/W Burning Drive |
CD-R 74 | 650 MB | 665.600 KB | all modells |
CD-R 80 | 700 MB | 716.800 KB | all modells |
CD-R 90 | 800 MB | 819.200 KB | only special drives |
CD-R 99 | 900 MB | 921.600 KB | only special drives |
Depending on the type of CD-R used, a certain amount of data can be written. Most CD writers, however, only process media up to 700 MB. Selected writers can write up to 900 MB.
The number of minutes that fit on a single CD-ROM does not just depend on the data rate of the MPEG-4 video. The CD-Rs available on the market vary as regards storage capacity. Standard CD-Rs include the so-called CD-R74 media, which provide a data volume of around 650 MB. The CD-R80 CD-Rs with 700 MB are better suited to MPEG-4 due to their higher capacity. Anyone who has a special CD drive can even process CD-R90 or CD-R99 CD-Rs. These CDs can be read in very few drives and mostly have to be read by the CD writer that was used to create them.
Conclusion: Fast Motion is Very Efficient, But Not a Universal Solution
Our comparisons between the two DivX-codecs based on the important criteria of resolution and data rate show that there are no universal settings for all application areas of DVD videos. Action films with a high movement content and fast scene transitions achieve good picture quality with the fast motion codec at a comparatively low data rate. The fast motion codec displays weaknesses in the case of still frames or sequences with low movement content. Here the codec works at a very low data rate, which has a rather bad impact on video quality.
For landscape shots with a fixed camera position and low movement content, the slow motion codec is clearly the one to be recommended. With fast scene changes, the slow motion codec works less efficiently and the picture quality is significantly worse than when using the fast motion codec with the same data rate. The slow motion codec is ideally suited to low resolutions up to a resolution of 352 x 288 pixels. At low resolutions this codec achieves better results in terms of picture quality than the fast motion codec at the same data rate.
To copy entire films from DVD to CD-ROM, it is recommended to use the fast motion codec with a maximum data rate of 6000 kbit/s. This poses no problem as the average data rate in the case of a full PAL resolution with 720 x 576 pixels is normally no more than 1200 to 1300 kbit/s. In this setting, 90 minutes of video do in fact fit on a CD-R80 CD-R. With longer DVD videos there are, in principle, three possibilities: either to split the film between two CD-ROMS or marginally reduce the resolution. Otherwise the maximum data rate can be restricted, with the downside that losses in picture quality have to be accepted.
Conclusion: Fast Motion is Very Efficient, But Not a Universal Solution, Continued
In summary, it can be said that MPEG-4 is currently one of the most efficient compression procedures, as illustrated in the table below.
Compression | Resolution | Average Data Rate | Quality |
MPEG-1 | 352 x 288 Pixels | 172 KB/s | satisfactory |
MPEG-2 | 352 x 288 Pixels | 250 KB/s | very good |
MPEG-4 | 352 x 288 Pixels | 80 KB/s | very good |
MPEG procedures in comparison: with reference to attainable quality with a low data rate, the MPEG-4 is the best compression procedure.
All the MPEG-4 videos incorporate these properties. The picture shows the features of a test sequence with a 500 kbit/s data rate.