PDA

View Full Version : The Big AVI-Codec Mystery Topic


Lonely Pixel
12-03-2004, 07:38 PM
Hi there.

I've been struggling with this problem for months now. I've asked more people than I can remember and none of them really seemed to have a good answer to my question. My problem is compressing an AVI file, and of course I have to find the perfect balance between Quality and Size. Now I've been told 'everyone' is struggling with this problem, and it all depends on what you want to use the file for.

For web usage QT with Sorensen codec is advised, and XviD or DivX seem to have the best compression/quality ratio for avi files (that's what I've been told). I have also been told that, whatever program I use, I should always just render my movie to an uncompressed .avi file and later on compress it. So I tried, I rendered a 5 minute movie to an uncompressed .avi file. It turned out to be 8.2 GB (!!). After having rendered it, I just loaded Dr. DivX, loaded the file, followed the wizard (which was easy) and then coded the movie. I've done this like fifty times now all with different settings. With lowest quality, best compression and more settings set so that the filesize would be minimal, I still couldn't get file size under 1.2 GB, and that's for a 5 minute movie in 720*576 pixels. I've been calculating and I just can't figure out how it's possible that, when you for instance download a movie (oh that's not allowed - i know) it's compressed to 700MB (in .avi, DivX, and the quality is superb), for about 90 minutes, that's 7.8 MB per minute. So 5 minutes of movie should only be 40MB! Not freaking 1200MB!

I've tried DivX codec with all settings possible, I've tried Cinepack by Radius (something like that), i've tried XviD, MPEG4 V1, V2, V3, I've tried QuickTime... I'm desperate. File size just won't get below 900MB, and the 900MB movies are terrible quality.

Also I've downloaded and installed the LAME MP3 codec several times, exactly the way the readme.txt told me to, to be able to compress uncompressed audio (.wav) to mp3. Still I can't select MP3 codec in Premiere.

Please, Please help me.
Questions in short:
- should I compress files afterwards or whilst rendering in Adobe Premiere
- what codec should I use and with which settings. (The file is not for online streaming usage, but I do want to upload it to my webspace so friends can download it).

I know my story might be a little bit confusing, but that's just all frustration coming out, hehe. I've got so much to ask I don't know where to start, so experts, I know you're out there, please help this sad sad man ;)


Many thanks in advance.

Vertizor
12-03-2004, 07:59 PM
~5 minutes of uncompressed audio should be 50-70 MB-ish. Just look at the wav file after you extracted the track from an audio CD for example. Is audio in 48 kHz or 44 kHz? About MP3 encoding in Premiere, if it can't select the MP3 codec in Premiere then just encode the video stream, no audio, in Premiere and encode the audio into MP3 externally. Then get a multiplexer program to join the 2. It may fix your problem, plus it will speed up encoding times since you'll only be doing one stream at a time.

I've used VirtualDub and it has options to convert the frames into different color depths, such as 16, 24, or 32-bit depths. However, the avi codec might not like anything lower than 24 or 32. I don't know of Premiere's capabilities so you may have to look into that yourself. Obviously with a lower color depth each frame will require less memory, it's a matter of whether your software tools can encode it with lower color depths, and whether your movie can get away with that lower color depth.

Multi-pass encoding is a new feature many codecs support now-a-days. It effectively doubles your encoding time because the second pass goes through the whole stream again, but the second pass is a little more intelligent and may yeild smaller final file size.

720*576 is DVD resolutions, you shouldn't be surprised that the output file is so large. I have downloaded trailers and clips and rarely do I ever see a movie clip go over 500-pixel widths. Movie players can stretch the picture to fit a certain window size when people playback these movies, and the loss of quality from this stretching is NOT so bad. With smaller frame dimensions you can bump up the bitrate for better picture quality which will help the end result picture much more than having hi-res frames.

Also, when you're encoding the video are you using a variable bit-rate or constant bit-rate? Some codecs support both, you have to dig into the options and make sure variable is used. When it is used, the bit-rate you set is the max bit rate per frame. It would allow the codec to encode a frame below that bit rate if the frame does not require that much memory (for example is has large continuous areas of similar colors). Constant bit rate makes every frame use the same amount of memory, often that is a waste and bloats the file.

Vertizor
12-03-2004, 08:09 PM
I might be a little inaccurate in regards to my description of variable vs. constant bit rate methods of encoding. At least with Divx, it chops each frame into little squares and encodes that region with a certain memory alllowance. I'm forgetting if constant bitrate means each tile gets the same amount of memory allowance or its allowed to vary - as in variable bit rate. So my confusion is between individual tiles or individual frames that are variable. The fact still remains that variable bit rate may be better in your case if you aren't already using it.

Furthermore, if the bit rate controls how much memory each frame gets, that bitrate is distributed over the whole frame. So take 2 frames of different dimensions (one smaller one larger) if they both were encoded with the same bit rate, the smaller one would end up being higher quality. Even though later on during playback, the smaller one will suffer more from "stretching." You just need to find a nice balance between all these parameters. I don't have specific settings to offer, just these basic ideas to help you decide.

brzilian
12-03-2004, 08:15 PM
720x576 is definetly way too big for publishing to the web. I would probably go with half of that. Check your bitrate for audio - I wouldn't go above 128kbps and make sure you're working with 44.1kHz and not the DV standard of 48kHz. I don't have much experience with DivX or Xvid, but when I work with MPEG1 or Windows Media, I try to keep the video bitrate around 1000kbps. You may want to even bring that down to the 500-700kbps range.

Audio DOES significantly increase filesize. I was working on a 20 second animation today and the MPEG1 file size jumped from 2Mb to 8Mb once I added some background music.

Lonely Pixel
12-03-2004, 08:24 PM
Aha, thanks so much for this help.

Vertizor; the DivX 5.1.2. codec I use only gives the option to choose an average bitrate, so I assume it's set to variable bitrate by default. I've first compressed it in the DVD res, which gave me an 18mb movie in average quality for exactly 60 seconds. I used 2000kbps bitrate.

I've just resampled the movie to a lower resolution, about 5..*450, but I pumped up the bitrate to 5500kbps, just to see what it'd do. For some reason it gave me a green screen for the entire length of the movie, although it was coded with the same DivX 5.1.2 codec as the first try. Anyway, I think I'm already heading the right direction, and finetweaking the balance between my needs and what the software has to offer should give me the exact settings that fit my needs.

Thanks very very much. If you or anyone else has any other tips, please feel free to stick em in here! It might also be usefull for other people who have an equal problem as me.

Thanks!

glassefx
12-03-2004, 08:27 PM
Also remember that the content will to some extent dictate your codec choice.

Codecs and how they should be used (to the max) is a whole seperate volume of knowledge, and it's quite vast I might add.

You'll get into color depths, dithering methods, frame-rates, etc.

Good luck, I think trial and error while learning from others is the best method...Throw in a book or so every once in a while.

peace

CGTalk Moderation
01-20-2006, 02:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.