Log in

View Full Version : 2-pass and convolution3D


mezzanine
8th March 2003, 16:55
I've created a simple GUI for personal use that uses DVD Decrypter, DVD2AVI, BeSweet, VobSub, AVISynth2.5, avs2avi and AviMux to create XViD/DivX backups with a single click (kinda like autoDUB but more simple).
I mostly do my backups using low resolutions (560, 512) to fit in 1 CD, using convolution3D set to MovieHQ and bicubic resize functions. If i don't apply convolution3d filter on the first pass but only on the second what do you reckon will be the result ?? I'm trying to gain some speed without any quality loss.

:confused:

Sigmatador
8th March 2003, 17:15
with different filter between the both pass, the stats file is "invalid". A undersized video file is the risk...

FreQi
8th March 2003, 19:56
I've been able to save a decent chunk of encode time on my p3 600 by using a "transitional" encode. It requires more drive space, temporarily, but in the end, it's usually worth it. What I am basically doing is a 3 pass encode, but since the first pass does all the work, and the second and third passes only encode the XviD, it's a lot faster than you'd think.

First, make your avs like normal, with the Trim()s, *Resize()s, IVTC'ing, filters and whatnot. I'll call this "trans.avs". Open the avs in VirtualDub, set audio to "No Audio", but then instead of setting up your video compression to XviD, use Huffyuv (http://math.berkeley.edu/~benrg/huffyuv.html) (it's a lossless codec usually used for tv captures). Then "Save Segmented AVI" as something like "transitional.avi". These segmented avi's are what I call the transitional encode, because it's only purpose is to make the transition from your capture/rip sources to your XviD.

Note: If you're not familiar with huffuyv, you might be surprised at the size of the files it makes. A video that's 512x384, 23,976fps with no audio will fit somewhere between 5 and 10minuets into 2 gig.

Now, you'll want to do your bitrate calculating while you have this avs open (you should have your audio all ready to go). Once you know your target file size, you'll want to create another .avs (I'll call it compress.avs). For now it doesn't matter what video it loads, it just has to see something so we can set up the job. (I actually make the avs with just Version() in it). Then you set up the XviD compression settings for the first and second passes like you normally do, and save them to the joblist.

Important: Once you have the xvid jobs in queue, you must change this compress.avs script to load your anticipated segmented avi's from the transitional encode. It's just a single line like SegmentedAVISource("transitional.avi").

When you go to your VirtualDub joblist, you should have three jobs. The first is the trans.avs which is where all your filtering and such happens, and it'll create your transitional.00.avi, transitional.01.avi, etc. The second job will be your xvid first pass on compress.avs, which actually just loads your transitional.##.avi's. And the third job is your second pass.

You should be able to hit start and be all set. The first pass (transitional encode) will take about as long normal, but the second and third will be significantly faster. For example, my p3 600 does the first pass at about 3 or 4fps. But the 2nd and 3rd hits as high as 15fps. A 22min show that used to take 5 hours (2.5h/pass) is done in about 3.5 hours using this method. The only step that remains is to mux the audio.

It's a little extra setup, but an hour and a half saved is an hour and a half put into the next show... Let me know if you have questions or if I didn't explain clearly.

Didée
8th March 2003, 21:02
Originally posted by FreQi
Let me know if you have questions
Yeah...
I'm going to encode a 3 1/2 hours movie @ 704*400 - could you lend me your HD, please? I'm a little short with free space ...

:)

[couldn't resist]

Mel Maconoo
8th March 2003, 21:05
you beat me to it.. i was gonna ask to borrow his HD.. Half Past Dead seems like it wants 13 gigs so i abort'd let me start burning to see how this comes out..

But i do have one question.. Why would you want to make it bigger when your really tryin' to compress it.? What i mean is the dvd is maybe 4 gigs and your makin' it at least 3x's bigger.. how is this suppose to help.? just curious..

SirElvis
8th March 2003, 23:33
Originally posted by Mel Maconoo
But i do have one question.. Why would you want to make it bigger when your really tryin' to compress it.? What i mean is the dvd is maybe 4 gigs and your makin' it at least 3x's bigger.. how is this suppose to help.? just curious..If I understood FreQi correctly... he is not making the file bigger...

He's just using an intermediate file. If you are using filters in your avs (like Telecide/Decimate or Convolution3d) these filters need time to work on every frame of the video... and since you're compressing every frame twice (once for pass 1, once for pass 2)... the filters do the same work twice... for every frame.

If you use a intermediate file and apply the filters only for the step mpeg -> intermediate you are doing the filter work only once, because, for the 2 XviD passes you are using the already filtered file as source.

If you are using AviSynth 2.5 and are working in YV12 it would probably be better to use Marc FD's VBLE (http://forum.doom9.org/showthread.php?s=&postid=263985#post263985), which works in YV12.

Mel Maconoo
9th March 2003, 01:42
thx now i understand..

FreQi
9th March 2003, 10:47
Yeah, what SirElvis said ;] The whole point is to eliminate the need for running the video through filters more than once. I use Huffyuv because it is lossless, so in theory, there is no degradation of image quality. For example, if you were to use MJPEG to make the transitional (or intermediate) encode, the very nature of mjpeg would alter the image. Huffyuv doesn't, but as a trade off it requires bunches of drive space, until you do the xvid and you can delete it all.

And for those wanting my drive, I've got 2 80gigers in there, and I am constantly fighting the good fight to free the "space" from the evil tyranny of the Bits. I'll need to trade up to some of those 250gig maxtors one day.

Selur
9th March 2003, 16:02
Since Huffyuv doesn't use Yv12 it might be a good idea to test Marc FDs vble video codec (lossless and Yv12), see:
http://forum.doom9.org/showthread.php?s=&threadid=38389&perpage=20&pagenumber=5

Combined with avisynth 2.5 this should also be a bit faster.

Cu Selur

geoffwa
10th March 2003, 13:56
Exactly how much space do the HuffYUV encodes typically take up? :confused:

SirElvis
10th March 2003, 14:08
PAL Version of 'Austin Powers - Goldmember' with 135974 frames takes up 13,7 GB with Marc FD's VBLE codec.

bilu
10th March 2003, 16:34
Try previewing an AVS script in a player like Zoom Player.
Then check Video Renderer on DShow filters.

On fast machines / scripts that can render at full-speed, I don't think there would be a performance gain by adding an intermediate pass.

But on slow machines / scripts that render at 8fps and less, it may be a must. :rolleyes:

But maybe slow machines don't have that much disk space at all. :p


Best regards,
Bilu

unmei
11th March 2003, 02:28
how big huffYUV is ?
well only do anime/cg encoding, mostly 512xHHH, sometimes 640xHHH and i typically get 3000kbyte/s (being around 24mbit/s) with 2Dcleaner/convolution3D vdub filters, thus larrgely around 10GB per hour.
edit : its 25fps, 90000 frames/hour