Infognition forum
February 08, 2012, 08:58:41 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Last GraphEditPlus version: 1.4.0   Last Video Enhancer version: 1.9.7
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Choice of video codecs  (Read 3273 times)
Dee Mon
Administrator
Hero Member
*****

Karma: +8/-0
Posts: 512



View Profile WWW
« on: June 30, 2008, 12:48:05 PM »

I'm often asked what codec is the best and how to choose a proper codec.

1. What is a codec
First of all, you need to understand what a codec is. I advise at least reading this Wikipedia article:
http://en.wikipedia.org/wiki/Codec

Here I'll be talking about video codecs.
So, a codec is a piece of software that can encode and decode video. When it encodes video, it gets uncompressed video (sequence of images) on its input and outputs some data, usually much smaller in size. That's the main purpose of the codecs - make video size in bytes smaller. When it decodes video, it takes that compressed data and outputs sequence of uncompressed images.

Some video editing/playing software contains some codecs built-in, but most software doesn't - it uses codecs made by third-party developers and separately installed in your system. The system usually provides some means to find installed codec and use it for compressing and decompressing data. Each codec knows how to compress data, how to decompress data created by itself (but not by other codecs), but codecs do not know how to store this data on disk.

When you write compressed video to disk, it's written in one of container formats such as AVI, MOV, MP4 or something else. Each container format describes how to save chunks of compressed data and information about it, for example a little code (i.e. FourCC) that signals about compression method. When this file is then read, that metainformation about compression method is used to find a codec that will decompress the data. So, knowing how to read AVI files is not enough to decode the video - a proper codec is essential.

Some compression methods are described in some standards (like MPEG4, for example). So many different codecs may implement such compression algorithms and they are often interchangeable. For example, DivX and XviD are both implementations of MPEG4 compression method, so video compressed by one of them can be decompressed by another one or even a third codec that knows how to decompress MPEG4. But some codecs have their own unique compression methods and video compressed by such codec can be decompressed only by the same codec.

2. Lossy and lossless compression
The task of a video codec is to compress video so it takes less space on disk or downloads faster. This can be done in two ways: it can try to compress the video without losing any information at all - like zip compresses your files without changing them. Such compression is possible but it's quite limited - most lossless codecs provide small compression ratio, like 1:3. And you cannot control how big the result will be - it totally depends on the algorithm and the source video. But they guarantee that decompressed video is exactly the same as the source.

Another way is to allow losing some information. Most video codecs go this way, they throw out much of original information but in a way not very noticeable by the eye. In this case decompressed video is not the same as original - it's always of lower quality. But now you can control how much information will be throwed away and so control how large the result will be measured in bytes. Amount of bytes (or bits) per second of video is called bitrate. The more the bitrate is, the less information is lost, the better is quality. The lower bitrate, the lower quality. And remember that each time you compress video by a lossy codec, the quality gets worse.

3. What kind of codec to use.
So when selecting a codec you need to decide first which kind to use - lossless or lossy. If you need just to temporary store video for further editing and you need to keep maximum quality, then a lossless codec is what you need.
If, otherwise, you need to create a file which will only be played but not edited, and you want it to fit in limited size (like CD or DVD), then you need a lossy codec.

4. Choosing a lossless codec.
Lossless codecs differ by availability (some are Windows-only, some are free, some are commercial), by speed and by average compression ratio. Some codecs are very powerful in compressing the data, but unusably slow. Some are very quick but comress poorly. You can find a big and detailed comparison here:
http://compression.ru/video/codec_comparison/lossless_codecs_2007_en.html
My personal choice is Lagarith, it's quite fast and provides reasonable compression.

5. Choosing a lossy codec.
Lossy codecs also differ by availability (some are Windows-only, some are free, some are commercial) and speed, but they also differ by quality/compression ratio. This means that every lossy codec can compress video to almost any given size, so the compression rate is the same. But video compressed to the same size by different codecs has different quality. And again, usually the better this quality/compression ratio is, the slower is the codec. Nowadays best quality/compression ratio is in H.264 implementations, but the speed is usually bad: they need a very powerful CPU to decompress (play) the video and huge amounts of time to compress it.
You can find big detailed comparison here:
http://compression.ru/video/codec_comparison/mpeg-4_avc_h264_2007_en.html

The next level is MPEG4 implementations, they provide a lower quality/compression ratio, but fast enough for modern PCs.
http://compression.ru/video/codec_comparison/mpeg-4_en.html
DivX and XviD are most commonly used (the first is commercial and the second is free) and they are my codecs of choice for lossy compression.

Logged
akshay
Newbie
*

Karma: +0/-0
Posts: 12


View Profile
« Reply #1 on: October 01, 2008, 08:02:52 PM »

well, u have mentioned ur choice about the video codec,what about audio codec and particularly the lossless and which lossless audio codecs ve can use.
Logged
Dee Mon
Administrator
Hero Member
*****

Karma: +8/-0
Posts: 512



View Profile WWW
« Reply #2 on: October 03, 2008, 04:48:27 PM »

My choice for audio is AC-3 and sometimes MP3. When the audio is already compressed with a nice codec, then I just choose "copy stream" and thus avoid recompression.

I don't know much about lossless audio codecs, unfortunately. One time I dealt with FLAC but don't know if it works fine in VE.

Logged
Manoman455
Jr. Member
**

Karma: +4/-0
Posts: 98


View Profile
« Reply #3 on: June 03, 2011, 11:24:09 PM »

I like FLAC too but like Dee Mon says I'd rather avoid re-compression all together by copying the stream. My choice for lossy recompression would be MP3 and AAC. In my opinion video enhancer does't support alot of audio codecs as I've tried to you alot of third party audio codecs that I installed and does not show up in the audio codec selection window in video enhancer, but then again video enhancer is a program for video so I can't really complain.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!