Wednesday, January 7, 2009

Generation Loss. Avoid it!

Happy new year to all. I hope that everybody had a nice time over the holydays.
Generation loss is a term used to describe the degradation of video or audio quality when making copies. It is usually the primary cause for bad quality video. In this article I will give some tips to avoid it and encoding tips when it is unavoidable.

Let’s look at how generation loss happens. For example, you shoot a video with your firewire camcorder and produce a camera original that it is stored on a tape. You then transfer that video to your windows computer using movie maker. The result is a windows media file that is the second generation from the camera original. Depending on the settings that you choose, there will be varying degrees of quality degradation. Now suppose that you would like to send the video to YouTube, but the file is too big for YouTube to accept it. You are now forced to convert the video into a smaller file, so you open the second generation windows media file with movie maker one more time. Now, you play with the parameters to compress the video further and manage to produce a file that is now small enough to be accepted by YouTube. This file is now the third generation from the camera original with more quality degradation. So you upload it to YouTube and a few days later it shows up on the website, but it has now been converted to Flash format and it doesn’t look very good. This is now the fourth generation from the camera original.

The obvious first tip to avoid generation loss is not to cause it in the first place. In the above example, when you get ready to transfer the video from the camera to the computer, you could choose video encoding parameters that will produce a file that is smaller than the maximum required by YouTube. You would go straight to second generation before uploading to YouTube and thus saving one generation loss. If that sounds too complicated you can go to a free site www.compressmyvideos.com where you can transfer the videos from your DV camcorder, phone, webcam or even use a file and make the output file less than 100MB.

But you could also transfer the video from the camcorder to a lossless format or in the case of digital cameras, to a format that is an exact copy of what is on the tape without any loss. Some software packages allow you to do that, including movie maker. Now, the size of the file will be pretty big. For a DV AVI the file size is roughly 215MB per minute. For uncompressed YUV video files (4:2:0) it is roughly 1.25GB per minute. For full RGB uncompressed video you need about 1.87GB per minute in NTSC (29.97 frames per second.) Always try to make a lossless copy of the original video. If it came from a DV camcorder, use a DV AVI or “bump it up” to YUV or RGB.

With tapeless cameras it is easier to obtain a lossless copy of the camera original as you can just copy the file to your computer via USB. Just make sure that you have the appropriate codec to “decode” this file installed in the computer other wise you might be forced to use some kind of software utility to convert it to another format that your computer knows how to “decode.” This can potentially induce a generation loss.

The next tip is not so obvious, but it has a great impact in image quality when making several copies or transcodes. Try not to resize your video. Always try to keep the size of your video picture the same through the conversion process. If you really have to change the size, it is always better to go from big to small.

My last tip is to recommend that if you need to make the video file size small, you need to convert your video using a high quality codec. Some codecs are much better than others. MPEG2 is better than MPEG1 and MPEG4 is better than MPEG2, but VC-1 (windows media) or H.264 or VP6 are better than all the MPEG’s. Always keep looking for new and improved video codecs as technology in this field changes rapidly.
Tomorrow I'll be traveling to Vegas to check out CES. I'll be back with a report of the newest, coolest gadgets for video transcoding presented at the show.

7 comments:

Anonymous said...

Hi Jaime,
I have a quality degradation problem even before I transcode my video.
I work with GraphEdit and when I connect a DV camera to my computer the "DV video decoder" filter gives horrible quality when I configure it to decode to CIF resolution.
do you know of any good filter that can decode DV straight to CIF or D1 without losing much quality?

Thanks,
Roy

Jaime said...

There shouldn't be any loss when up converting to D1 or "CIF". I assume that when you write "CIF" you mean "Common Image Format" and not "Common Intermediate Format".
When you connect to the camera, make sure that you are capturing the original resolution. Some filters allow you to request half or a quarter frame from the DV device.
If you still have problems, try to capture to DV format in an AVI container, which should have no generation loss, and then up convert to D1. It involves an extra step, but it might be a good sanity check.

Anonymous said...

Hi,
Thanks for the replay.
I am configuring the DV decoder filter to capture at half the resolution (360X240) and then render the picture to the screen in order to view it.
When I do this, the picture losses a lot of its quality.

can you help me understand this?
Thanks

Jaime said...

The first degradation takes place when you get half the resolution. The algorithm used to do that in real time is not very good and will induce artifacts. Then if you go back to D1 resolution, resizing takes place again in the other direction to get back to 720x480. Now enlarging the picture produces even more degradation as pixels need to be re-created.
I'll do a couple of posts on this subject to explain in more detail.

Anonymous said...

Thanks,
Do you know of any good DV decoder filter that gives the best picture output?
Both microsoft's and MainCocept's DV decoders give terrible quality.

Thanks.

Jaime said...

Sorry, I have used the MC and Microsoft filters only. Try the medialooks or Canopus filters. I have used other products from these companies with success.

Anonymous said...

Thanks,
MediaLooks looks great.

Roy