ZenFire's Blog
I heart CvS2 and 3S
Video Technology part 4b: x264
photo

I realize now that I try to cover too much in a single blog entry. That just ends up making it too general and less useful I'm afraid. So, I'll take it easy this time. After all: what's the rush?

H264 is also called MPEG-4 AVC and all it is, is a video encoding format. It's the latest in the line of MP Experts Group formats and boy is it a wonderful thing. MPEG released a sample implementation I believe, but the only freely available encoder for this format is x264. It's distributed under the GNU GPL, which means there will always be a way to get this without paying. It also means (not always) that it's being worked on by hobbyists and is constantly improving in speed and quality.

Why is H264 so special? Well you can read all about it on Wikipedia here. If you're like me you'll only be marginally interested in the specific technical details. It all boils down to the quality/file-size ratio. Don't take it too literally, though I'm sure such a metric exists. H264 looks good: better than MPEG 4 ASP at equal bit-rates (personal opinion based on xvid vs. x264). For most people that's enough information. The thing H264 is 'built around' is a thing called a de-blocker. This 'thing' is responsible for removing the bulk of the artifacts you get from compression. Wikipedia will take you into the finer details of artifacts caused by Discrete Cosine Transforms if you're mathmatically inclined. I love how edges look in my King tutorial video compared to an ASP encoded version I did before. The difference is CLEARLY visible.

x264 has a multipass mode. It's literally what the name implies: multiple passes of encoding. This improves the quality by allowing the encoder to better predict motion. If you bothered to look you'd find changes in the pattern of I, B and P frames. It takes longer to do multipass encoding, obviously, but the benefit is great. Most (all?) MPEG 4 ASP encoders already allowed you to do two pass encoding, but x264 lets you do as many as you want. It writes its statistics/metrics about your frames in a log file in the same directory as your target file. It adds one for each pass.

The first time you encode your file, use the "Multipass: first pass" mode. After that, use "Multipass: nth pass" for every subsequent pass. There are a ton of more options for you to play with, and it really helps to see its effects by typing in silly numbers for each. This tutorial will give you an idea of what they all mean. On the main page of that site there's a link to an installer for the x264 VFW encoder.

A final tip for those using Premiere or any other editor with transitions and effects. To make use of the multipass features I highly recommend you export your movie into some high quality file using minimal compression and then using VirtualDub or something else to do the first and later passes. The reason for this is that editors need to do calculations everytime you export your movie because of all the special effects, transitions and transformations etc. This slows down the exporting process. So it makes sense to avoid doing all this calculation more than once. Once you have your high quality export you can experiment with settings as much as you want and you won't have to use your editor's exporting functionality every time. Happy encoding.

2007-04-16 12:25:51 GMT
Comments (0 total)
Add to My Yahoo! RSS
1