Log in

View Full Version : diy 720P upscaling (inXvid)


Jay-G
28th July 2009, 06:13
I've been doing ‘home-made’ (man-made? lol) 720P upscales of my DVDs (done in Xvid).

I decrypt the DVD to get the .vobs, then use avisynth with a script similar to this:

LanczosResize(1280,684)
converttoyv12()
# Detect field order
function FOrder(clip c) {
fo= GetParity(c)? 1:0
return fo
}

I use PowerDVD to play the .vobs & find a scene in the movie that is bright to highlight the video borders, then do a screen cap that I paste into a graphics editor (gimp is ok). I use the graphics editor to clip the borders to the minimum so that just the video is being resized, then do the 'keep proportions' resizing & set the horizontal size to 1280 to find the widest vertical resolution that then has the correct video aspect ratio.

So in the sample script for avisynth:

LanczosResize(1280,684)

That’s the 720P upscale size for the video of hellboy 2, which is the latest video I resized this way.

I then run the video through the latest Xvid compressor on a 2-pass, using six-of-nines-HVS-1Kbps-up matrix:

08 11 12 12 13 15 16 17
11 11 12 12 14 15 16 17
12 12 13 14 15 16 17 18
12 12 14 16 17 18 19 19
13 14 15 17 19 20 20 20
15 15 16 18 20 21 22 22
16 16 17 19 21 22 23 24
17 17 18 19 20 22 24 24

12 11 12 12 13 14 15 16
11 11 12 12 13 14 14 16
12 12 12 13 14 15 16 17
12 12 13 15 16 17 18 18
13 13 14 16 18 19 19 20
14 14 15 17 19 20 22 22
15 14 16 18 19 22 23 24
16 16 17 18 20 22 24 24

I have Xvid set to use the HiDef profile, V-BOP's enabled (2 Max consecutive, 1.50 quantizer ratio, 1.00 quantizer offset)

Chroma optimizer enabled, BVOP sensitivity 5, Ultra-High motion search precision, VHQ mode 4 (wide search)

VHQ mode use VHQ for bframes too & use chroma motion both enabled (frame drop ratio 0, max I-frame interval 300)

Quantizer restrictions for first pass:
1
31
1
31
1
31

FourCC used for the encoder is Xvid, film effect enabled for decoder, Display Encoding Status is enabled for encoder.

That's for pass one, for pass 2:

Intra-frames tuning:
10
1
20

Overflow treatment:
5
5
5

Curve compression:
0
0

Second pass data rate is dependent on the results of the first pass encoding.

To figure the second pass data rate I usually take the first pass data rate result & divide by 4, and that seems to give pretty good results in the final Xvid.

I use the AVI-OpenDML container & usually convert the AC3 to a 2 channel .mp3 (I do this so I can clean up the audio track with goldwave, save as a .wav, then convert manually to .mp3 using MP3 Producer).

So getting the .mp3 file size into the Xvid bitrate calculator makes the final Xvid a little cleaner, but I use the Xvid bitrate calculator to determine the final bitrate based on the video running time, and adjust the file size until I get the data rate that is about 1/4th the first pass data rate

A hypothetical example, if hellboy 2 encoded on the first pass at 1280x684 resolution at 7986 kbps, then the second pass data rate is 7986/4 = 1996.5 (so around 1997 kbps)

So input the running time values, I use forced film in avisynth on NTSC rips (I use 'honor pulldown flags' for PAL vids), so the frame rate is 23.976 (25 if for PAL vids)

At this point the video is ready to complete the second pass

Personal preference thing with me, but I don't use audio interleaving, and I use file extension .wav for the .mp3 & point VirtualDub at that .wav file & have it do a direct stream copy to get it threaded into the final Xvid

I'm running AMD X4 chips, so these things go pretty fast, but they still take a while (hours) to encode this way. So it takes about the same amount of time as the running time for the movie to do one (some are longer, some go faster, depends on the final upscaled aspect ratio & second pass data rate), and once it is done you just play the Xvid off the hard drive whenever you want to watch that video.

I'm kind of amazed at how well Xvid handles the upscales on these things. If the DVD being upscaled is a good transfer, the quality of the final upscale can come out as good as an HDTV 720P broadcast.

I've been watching these things on HD monitors using Media Player Classic with the pixel shaders enabled & honestly, if watching the original DVD on an upscaler player, I find the quality of the Xvids to be far superior to the original DVDs played on the upscaler (there also is no comparison imo to DVDs played with PowerDVD or even MPC to these upscaled Xvids)

Btw, here are some screen shots; this is the Xvid second pass encoder data rate for hellboy 2: http://www.pict.com/view/1354056/0/sincitybitrate (so the divide-by-4 rule for this movie came out to 2178 kbps for the second pass, from 8713/4)

These screencaps are done from Media Player Classic in Windows, by doing the old ‘ALT-Print Screen’ trick, then pasting the clipboard capture into gimp, saved as .jpegs:

http://www.pict.com/view/1354064/800/thatyellowbastard

http://www.pict.com/view/1354068/800/marv

http://www.pict.com/view/1354071/800/goldie

http://www.pict.com/view/1354072/800/gailgoingballistic

http://www.pict.com/view/1354150/800/wotw

http://www.pict.com/view/1354151/800/winkthinking

http://www.pict.com/view/1354204/800/beast

http://www.pict.com/view/1354207/800/phoenix

http://www.pict.com/view/1354209/800/ravendarkholme

http://www.pict.com/view/1354211/800/jeangrey

http://www.pict.com/view/1354214/800/rebeccaromijn

Media Player Classic was set to use pixel shaders for these caps (ctrl-p)

Check these out at full image resolution to get an idea of how the Xvid looks in MPC

I’ve processed 1080I HDTV caps into Xvids at the full 1080I resolution using the same matrix (6-of-9’s HVS 1K up) & Xvid seems to handle the high bitrates fine. I haven’t tried x.264 or h.264 yet, but doing these Xvid upscales is good so far, the colors & resolution seem to come out fantastic.

I made the mistake of thinking about this one day many months ago & decided to try it & was dazzled by the Xvid I got from it, have done most of my DVD collection this way in the last few months. You might give it a try, Xvid handles it without any problems that I can see.

Of course, 720P or 1080P Blu-Ray discs are good too, but if you have a large DVD collection already & your choice is an upscaler player or custom processed 720P Xvid, try the 720P Xvid side by side next to the upscaler player playing the original DVD. I think you’ll be surprised by which you think is the better quality video :-)

j-g

Dark Shikari
28th July 2009, 06:30
Xvid has nothing to do with the higher quality.

LanczosResize(1280,684), however, does. Try NNEDI2 for even better quality.

Blue_MiSfit
28th July 2009, 10:38
Indeed.

I think your efforts may be in vain, except in certain circumstances.

I'd just encode your video with any necessary filters (deinterlace / IVTC and any denoising you want) into H.264 using x264 and CRF mode.

2Bdecided
28th July 2009, 13:01
Surely that's 684p, not 720p? ;)

Jay-G
28th July 2009, 21:14
Letterboxing has to be taken into account. The purest 720P upscale will have a full vertical height of 720 pixels, but few videos I have manually upscaled have fallen into this size when processed.

So far of my collection the 'Godfather' DVDs have come in closest to the true 720P spec by manually upscaling them. They upscale from the maximum 720x480 DVD spec to 1280x716 in my diy 720P upscaling technique.

I left a step out in my diy post yesterday, in avisynth I make sure to crop the borders to eliminate the letterboxing the original .vobs have in them. Oops, that's actually an important step in getting the cleanest 720P upscale out of the original 720x480 .vobs. My bad.

Some of the largest upscales that come closest to the full 720P spec are:

MIB (1280x702 res upscaled at 720P)
The Godfather trilogy (the 'Kings' at 1280x716, 4 pixels shy of the full 720P spec)

And believe it or not, the recent movie 'War of the Worlds' upscales to 1280x700. Pretty impressive for a heavily special effects laden movie these days.

I dropped some snaps of these on pict.com, check them out:

http://img2.pict.com/8f/9f/93/1359093/0/godfather21280x716.jpg

http://img2.pict.com/9d/64/06/1359234/0/mibbiggunsfiring.jpg

http://img2.pict.com/15/d2/89/1359222/0/jeebs1280x702.jpg

http://img2.pict.com/fb/20/81/1359226/0/jeebsgoessplat1.jpg

http://img2.pict.com/32/10/ba/1359238/0/wotwabout2fire1280x700.jpg

-j