2-pass encoding tutorial

ceixava

Fledgling Freddie
Joined
Dec 22, 2003
Messages
330
As theres more and more people asking how to do encoding to get good results I decided to write this.

1-pass encoding seems to be the preferred method for most people encoding their ingame videos. However 1-pass encoding is whats called CBR or constant bitrate encoding. Every frame in the video is granted the same amount of video data in the resulting file.

Hows this bad then? Well consider a part of your rvr video where you just stand still and nothing moves. The constant bitrate gets wasted, frames are granted more data than they actually need.

This is where 2-pass encoding comes in. 2-pass encoding is VBR (variable bitrate). First the program of your choice does a testrun of the video to see how the bitrate should vary to get the best possible result considering data per frame. The second pass then actually encodes the video using this information. This way the black screen or no movement part of the video doesnt use so much data.

And now for the tutorial. For this example ill use a short video i made as an example.

What youll need:
1: virtualdub
2: xvid
3: your sourcevideo

I wont go into details but ill just say, try to avoid repacking your video, always keep your video in a lossless format so that you dont loose videodata.
A good method is using HUFFYUV
Always avoid repacking your video, and even try to capture to a lossless format (fraps does this for example). Data is lost at every single re-encode stage, so once again, avoid it.

1: open your video in virtualdub
2: set audio compression to "full processing mode" and "source audio", unless you already packed it to mp3
3: set video compression to full processing mode and open the compression menu
4: set compression settings
1.gif

FIRST select xvid as codec
SECOND press configure
THIRD set encoding type to twopass - 1st pass
FOURTH select your video profile, my example video is 1280x720 so ill use HDTV profile, for normal resolution videos you should use "advanced simple @ L5"
FIFTH press the "more..." button of the encoding type and set a filename where the first pass statistics should be saved

5: add the job to the compression queue by selecting file -> save as avi
2.gif

select a filename and tick the checkbox to not start the job now but to add it to the queue

6: set compression settings again
3.gif

FIRST set encoding type to twopass - 2nd pass
SECOND press the encoding type "more..." button to open the filesize info
THIRD fill out the information about the audio in the video, either set it to vbr/cbr accordingly, or give the exact size of the audio mp3 that will be included
FOURTH set your videos runtime and FPS
FIFTH set the size you want for your video, i personally like to use "warez" releases as reference. A ~40min Lost episode 1280x720 takes about 1.2GB
so my 1min 32second video at the same resolution would be 1.2*1024/40*1.5 = 46.08. So 46MB, so i set the size to 50000Kb (~50MB). For smaller resolution files a good reference would be around 200MB per 15min of video, or more as the resolution increases.

7: same as step 5

8: start the queue, press F4 to open the job control menu
4.gif

FIRST press start to start the encoding process, get some cookies and enjoy
 

ceixava

Fledgling Freddie
Joined
Dec 22, 2003
Messages
330
doh cant edit anymore, how stupid is that

anyhow, more on the proper target size:

As daoc videos have alot of movement compared to movies and tvseries, its good to aim high, f*ck the dialup people so to speak, quality has to be good :p

A 30min daocvideo at 640x480 could be 500-700MB

you can play around with the xvid "target quantizer" setting to find the quality you like and do a test encode to see the size you get with the quality you like, and then run a 2pass encode
 

illu

Part of the furniture
Joined
Mar 18, 2004
Messages
1,867
Thanks for the info. I will have to have a play with all these settings over the next week :>

Have a rep! :>

Oli - Illu
 

Eredrin

Fledgling Freddie
Joined
Feb 19, 2004
Messages
458
looks nice, think even I might manage to follow this :) bookmarked!
 

Escape

Can't get enough of FH
Joined
Dec 26, 2003
Messages
1,643
It's a nice guide to get people familiar with the process of encoding! ;)
It gets a little more involved when editing videos, with Sony Vegas you can encode directly to xvid.

I've found 10MB for 1 minute to be average for gaming movies. Not many movies can justify going higher, unless they're funky like this. Typical filesizes for TV shows are 350MB (40 - 45mins) for low resolution encodes, same as game movies.

Experiment lots before capturing real fights. Capture in different resolutions and fps combinations for 30seconds(run around a keep or something). Encode these clips with varying settings until you've found the balance between performance, quality and filesize.

If you're using fraps, monitor your ingame fps during the capture. It should hold at 25fps(if set to 25fps!), but if it drops considerably lower, make some changes to improve performance!
 

Ging

Part of the furniture
Joined
Jan 23, 2004
Messages
2,801
cheers in 10 min i made my 1st video :)

crap fight but im on the way now!

so be prepared!
 

Users who are viewing this thread

Top Bottom