Streaming Video: An Overview
Codecs continued...
These codecs are also quite robust in how they handle color. The movie is always played back at the color depth at which it was recorded. There is a natural caveat here, though. If you do drop the color depth you will get a reduction in file size but, be prepared for a significant reduction in quality.
There are other tradeoffs to consider. Instead of trying to attain a normal video speed of 30 FPS in Flash , slow it down to 15 , 20 or 24 FPS. Instead of recording the video at 640 x 480 and attempting to manage the inevitable huge file and massive hit on the processor, the maximum sizes to record to are 320 X 240, 240 x180 or 160 X 120. The common factor here is the traditional video aspect ratio of 4:3. Do this and you leave some processing power for the audio track.
Of course, if the audio is 16 bit, 44 kHz stereo, you are setting yourself up for problems. Instead, consider dropping it to 16 bit, 22 kHz, mono. Do this and the sound will fall into the "processor envelope".
Remember, the data for the sound will have to eventually be read into the RAM, shot over to the Sound manager and then over to the speakers. One second of uncompressed 16 bit, 44 kHz, stereo sound is about 176K in size. That will have to be deducted from, for example, the 300K data rate of the video. This leaves about 124k for your images. Unfortunately these codecs will compress a 320x240 track to play back at a reasonable quality data stream of 180 to 200k/ second. This leaves 120 to 100k available for the audio track. Now do the math.
The result is lousy playback. The reason? The codec's loyalty is to the image, not the sound. If you drop the audio from stereo to mono the sound track requirement drops from 176K to 88K and you are within the "120 to 100K envelope". Drop it to 22kHZ and it only needs 44K, which leaves room for contingencies.
The lossless codecs are ideal for work destined for the FLV format. The best way of wrapping your mind around this concept is to think of jpg compression on an image. If you recompress an already-compressed jpg image you are essential degrading the image quality. The same thing happens with video. Compress an already-compressed video and quality goes out the window.
The Sorenson Squeeze on ON Technologies’ ON2VP6 codecs are lossy. If you are going to be creating an FLV for video playback it only makes sense, therefore, to get a file that hasn't been compressed or uses spatial compression such as the Video or Animation codecs.
Both the ON2VP6 and Squeeze codecs used by the Flash 8 Video Encoder use 2-Pass Variable Bit Rate (VBR) Encoding on the video track. This encoding method is rapidly becoming a standard in the Flash Video industry. Compression is achieved by running the compressor through the video… twice. The first pass through the video allows the compressor to analyze the video track and store data about before it does the actual encoding in the second pass.
If you use Squeeze 4.3 or ON2’s Flix Pro to encode the FLV, you can also use Constant Bit Rate (CBR) encoding. If you do use CBR encoding what happens is the specified data rate is enforced throughout the whole video. It is best to use this method if there isn’t much motion- a tree in a field- in the video.
Image 9: CBR in Squeeze 4.3
Image 10. CBR in Flix Pro 8
Playback
The playback of digital video is, to say the least, an inexact science. If your video is set to play back at 15 frames per second, the computer will do everything in its power to play the video and the sound. Sometimes the computer isn't powerful enough to handle the information all at once or the bandwidth is a problem. In this case the computer handles this problem for you and starts dropping frames.
As I pointed out at the start of this article, the computer's loyalty is not to you. The loyalty is directed to the timeline. If it is supposed to be showing you second 15 of the video, your computer will do that... and damn the consequences. The second priority is to keep the audio roaring along and the third priority is smooth video playback.
Notice how the computer's last priority is your first priority? Hey, it's a machine. If it needs to be at second 15 it will start dropping frames or even skip a few to get to that point in the video.


This work is licensed under a Creative Commons License.
