Log in

View Full Version : How to deinterlace this DVD?


Gaby83
18th May 2008, 11:24
Hi All :)

I'm quite Newbie, so I'm posting here... hehehe.

Well... I been working in compressing a video from DVD (Vob file), I'm using DGIndex to make the d2v file and I use Avisynth and VirtualDub Mod to make the encode, also I'm using XVid as a codec (I always use xvid 2 pass and the slower options for more quality).

Well... The video is 1:00 hr length and I want it to be in 700mb, I would like to keep 704x512 resolution, but well... here is the problem:

Screen caps of the VOB (no filtering) in virtualdub:
http://img219.imageshack.us/img219/3421/img03fq5.th.jpg (http://img219.imageshack.us/my.php?image=img03fq5.jpg)http://img170.imageshack.us/img170/2388/img04cd2.th.jpg (http://img170.imageshack.us/my.php?image=img04cd2.jpg)

I've tried using Tomsmocomp as a deinterlaced, but the video have "weird" lines and thats a problem when compressing to 700mb, it turns too pixelated, I guess Tomsmocomp doesn't work fine with this kind of video because I've tried too many configurations of this filter, here is a screen cap:

These are screen caps taken in virtualdub loading this script:

mpeg2source("vts_01_1.d2v")
Tomsmocomp(1,15,1)
LanczosResize(704,512)
Undot()

http://img80.imageshack.us/img80/787/img01rg3.th.jpg (http://img80.imageshack.us/my.php?image=img01rg3.jpg) http://img80.imageshack.us/img80/1374/img02xv7.th.jpg (http://img80.imageshack.us/my.php?image=img02xv7.jpg)

I dont like to use too much filters when I'm working with a DVD high quality image, but this DVD have some pixels so I thought to add some image filters like convultion3D or FluxSmooth... but It doesn't help too much and makes the image blury and too dirty.

Then I tried using TDeint, FieldDeinterlace, etc... honestly, I've tried too many and I've read about deinterlacers more than I've read in my life, but I had not good results, I think I really need help u.u
This is not the first time I encode... but these DVDs are giving me too much problems, this are devil's dvds! :devil:... I dunno what to do, can someone help me? :confused:

I've upload a cut from the VOB file... maybe someone wants to try encoding it. Original video lenght is 1:05:37, I would like the final video size in 700mb... so this cut is 1:56:34 it should be like 21 mb isn't?

Well... here is the cut of the vobfile, I've upload it to some file hostings, the file's size is 78mb. (Original VOB file is 2.7GB lol... for 1 hour isnt that a bit exagerated? XD)

http://www.mediafire.com/?wemimjtm9mn
or:
http://www.megaupload.com/es/?d=MJ7GGDWP

Thanks soooo much in advance and I hope you can help me with the filtering of this DVD. :thanks:

P.D. Sorry about my english... English is not my first language, but I've posted in the spanish forum this problem long time ago but nobody could help me :( so I hope someone here can. :)

diego gr
18th May 2008, 18:23
It seems like the original DVD video source is already pixelated!
When I compress VOB to Xvid, I do the following steps:
> Decrypt
> Open VOB with VOBEdit, demux all audio and video streams (m2v and ac3 are the outputs).
> Open m2v in VirtualDubMOD, Filters > Deinterlace (Blend), Filters > Resize Precise Bicubic 0,75 (the best).
> Compression: Xvid, 1 pass, CBR 1-1-1, target bitrate, zone weight=1, quantizers set all to 2-5, highest motion searchs, and very important: no Quarter Pixel, GMC or Adaptive Quantization (encoding speed: 6fps)

I encoded some music concerts last week (with heavy light changes and very high motion) that almost drove me insane!
But in the end I realized that the DVD source was already pixelated, so I didn't worry about that and my mental sanity was back!

dat720
19th May 2008, 10:28
So i downloaded your sample and had abit of a play with it, i have acheived some really nice results with mencoder using this command line:
mencoder.exe -vf harddup,yadif=3,mcdeint,framestep=2 -ovc xvid -xvidencopts fixed_quant=3.3:threads=2:max_bframes=0:vhq=0:me_quality=6:hq_ac:trellis -oac copy CUT.vob -o CUT.new.avi

This is the part that does the deinterlace, bar of course (for those that know) the harddup option:
-vf harddup,yadif=3,mcdeint,framestep=2

I am uploading it to megaupload rightnow, but it's 61mb and i only have a 384k uplink, so it may take a while.... done.

http://www.megaupload.com/?d=AYSG62O6

Ranguvar
19th May 2008, 13:30
It seems like the original DVD video source is already pixelated!
When I compress VOB to Xvid, I do the following steps:
> Decrypt
> Open VOB with VOBEdit, demux all audio and video streams (m2v and ac3 are the outputs).
> Open m2v in VirtualDubMOD, Filters > Deinterlace (Blend), Filters > Resize Precise Bicubic 0,75 (the best).
> Compression: Xvid, 1 pass, CBR 1-1-1, target bitrate, zone weight=1, quantizers set all to 2-5, highest motion searchs, and very important: no Quarter Pixel, GMC or Adaptive Quantization (encoding speed: 6fps)
Off-topic, but a few notes.

1.) Blend deinterlacing is definitely not the highest quality deinterlacing possible, quite the opposite generally.
2.) Precise bicubic is not "best". There is no "best". I like Spline36 myself for a nice sharp, natural resize. Sharp bicubic is a bit faster and a bit softer, and bilinear is the fastest and softest.
3.) CBR encoding is detestable... that means you are giving, for example, a completely black scene the same amount of bits as an explosion. With 2-pass, Xvid can intelligently adjust the amount of bits each scene gets, to be most efficient. Huge improvement with 2-pass.
4.) Besides setting the minimum quantizers to 2, don't limit them. It's similar to above... with the max quantizer set to 5, you're only making Xvid use more bits in scenes where it doesn't need them at all, which means there are less to use when it DOES need them.
5.) Check out the new VAQ builds of Xvid. VAQ replaces the old Adaptive Quantization, and is good enough that I enable it almost always. Very good feature.

Gaby83
20th May 2008, 00:01
Hi!

Thanks so much dat720, I've seen your sample, and I the quality really convinced me... I think is really well deinterlaced.

But I have two problems xD...

I dont know what is mencoder.exe.... I only use avisynth, virtualdub mod and codec xvid lol... I dont really understand the codes you've used for the encoding :(

I mean, I don't understand how to use this:
mencoder.exe -vf harddup,yadif=3,mcdeint,framestep=2 -ovc xvid -xvidencopts fixed_quant=3.3:threads=2:max_bframes=0:vhq=0:me_quality=6:hq_ac:trellis -oac copy CUT.vob -o CUT.new.avi

This is the part that does the deinterlace, bar of course (for those that know) the harddup option:
-vf harddup,yadif=3,mcdeint,framestep=2

And well... the file you made is a bit big, When I tried to compress it to the size I want it to be... It gets too pixelated again :(. 2 minutes file must be like 21 mb, so the final size for the episode can be 700mb (1 hour lenght)

Do u think we can get those quality results in that size? I really don't get why is this vob too dificult U.u

I just realized that I uploaded a diferent cut of the file I wanted to upload LOL, but well, thats ok too... its the same vob, its just that I was chosen a sceene with more moving in it.

I really cherish your interest in helping me :) and I apologize for my bad english :thanks:

LoRd_MuldeR
20th May 2008, 01:56
I dont know what is mencoder.exe.... I only use avisynth, virtualdub mod and codec xvid lol... I dont really understand the codes you've used for the encoding

I mean, I don't understand how to use this:

MEncoder is a command line tool. You run it from the console, if you don't use a graphical front-end.

Goto "Start" -> "Run" then type "cmd" and press enter. Now switch to the directory, where the MEncoder.exe is located by using "cd" commands.
You can type "x:" to switch to drive x (replace x with another letter). And you can type "cd.." to go one directory up.
(If you ever used DOS before, you know what I'm talking about ^^)

Finally type the command as posted above to run MEncoder, press Enter and wait until the job is done. Don't close the console while MEncoder is worrking!

You can download MEncoder here:
http://sourceforge.net/project/downloading.php?group_id=205275&filename=MPlayer-rtm-svn-26446.7z

All command-line options for MEncoder (and MPlayer) are described here:
http://www.mplayerhq.hu/DOCS/man/en/mplayer.1.html

In order to "unpack" the .7z file, you can use WinRAR or 7-Zip from here:
http://sevenzip.sourceforge.net/

Gaby83
20th May 2008, 01:59
Oh! Thanks so much LoRd_MuldeR, I'll take a look right now.

Thanks!! :thanks:

dat720
20th May 2008, 11:35
You could get the file size smaller but it is going to impact quality, the biggest factor here is the video is 4:3 resolution, there is about 20-30% more image in a 4:3 video than a 16:9 video, the encode i did uses a target quantizer of 3.3 which will give quite good quality at the same time a large file size, i will try doing a 2 pass encode at about 1350kbps

2 pass encoding is very good to acheive the smallest size you want, the 1st pass ignores the video and just inspects the image and creates a log file, it uses this log to determine where it should distribute the desired bitrate

the method i used is commonly refered to as constant quality, you set a quality value, in my case it was 3.3 and it encodes the video trying to keep that quality, which encodes with a variable bitrate

sometimes you just can't help but have a large video, you will not alway acheive the compresion you want without loosing image quality, i have learned to accept this and encode with a bitrate that suits the video quality i am after and just live with the file size, i have 2 HD tv's a 42" Plasma and a 60" Rear Pro and care more about quality than filesize, storage is so cheap these days, i just paid $135au for a 500gb hdd

Gaby83
20th May 2008, 11:53
Oh I see... well... I tried to use the program you're using, that MEncoder, and now I know how it works... but its too advanced for me, lol, my english is not too good for understand those technicisms when reading... I can only get basics... I need time to get into that program and make some test but it will take me... I dont know, years? XD hahaha, well, not years but months, thats the problem for not know english 100% lol -.- But well... with your help, Maybe I can just encode this Videos in Mencoder, just because Avisyinth didn't give me good results, and then, I can continue using avisynth while learning Mencoder just in case I need it in future :)

Well I don't know if its rude to ask you for you helping me make the right code for Mencoder to get a good quality video imagen in the smaller size, I mean, two pass with the slowest (but better) settings, I don't mind waiting, I just want it to look good. And maybe, the file will not be in 700mb, but then I will decide if it worth to sacrifice some quality for smaller size.

Lol... dunno if you can really understand what I'm writing, hope you do u.u and sorry to make you work, I'm abusing of my privilege to beeing stupid hehe.

Greetings and Thank you very very much for all your help.
Gabriela.-

dat720
20th May 2008, 12:50
This command left me with a 28.9mb file with pretty resonable quality, usign the 2 pass method you have to run the command twice, the only thing that changes is the pass=1, when doing the second pass you change the pass=1 to pass=2

pass 1
mencoder.exe -vf harddup,yadif=3,mcdeint,framestep=2 -ovc xvid -xvidencopts bitrate=1500:pass=1:threads=2:max_bframes=0:vhq=0:me_quality=6:hq_ac:trellis -oac copy CUT.vob -o CUT.new.avi

pass 2
mencoder.exe -vf harddup,yadif=3,mcdeint,framestep=2 -ovc xvid -xvidencopts bitrate=1500:pass=2:threads=2:max_bframes=0:vhq=0:me_quality=6:hq_ac:trellis -oac copy CUT.vob -o CUT.new.avi

after you have done the first pass you can do the 2nd pass multiple times, to test different bitrate's you do not need to repeat the first pass, unless you either do another 2 pass encode which will overwrite the log file, or you delete the logfile

mencoder is worth learning it gives you a really good understanding of how encoding works, and repeatable results if you use batch files

roozhou
20th May 2008, 14:02
This command left me with a 28.9mb file with pretty resonable quality, usign the 2 pass method you have to run the command twice, the only thing that changes is the pass=1, when doing the second pass you change the pass=1 to pass=2

pass 1
mencoder.exe -vf harddup,yadif=3,mcdeint,framestep=2 -ovc xvid -xvidencopts bitrate=1500:pass=1:threads=2:max_bframes=0:vhq=0:me_quality=6:hq_ac:trellis -oac copy CUT.vob -o CUT.new.avi

pass 2
mencoder.exe -vf harddup,yadif=3,mcdeint,framestep=2 -ovc xvid -xvidencopts bitrate=1500:pass=2:threads=2:max_bframes=0:vhq=0:me_quality=6:hq_ac:trellis -oac copy CUT.vob -o CUT.new.avi

after you have done the first pass you can do the 2nd pass multiple times, to test different bitrate's you do not need to repeat the first pass, unless you either do another 2 pass encode which will overwrite the log file, or you delete the logfile

mencoder is worth learning it gives you a really good understanding of how encoding works, and repeatable results if you use batch files

Do not use harddup before yadif.

dat720
20th May 2008, 14:24
any explanation as to why?

roozhou
20th May 2008, 16:05
Adding/dropping frames before ivtc or deinterlacer should be avoided. Harddup produces extra frames so it will affect yadif and mcdeint to make best decisions as well as slowing down the whole processing.

e.g. the input frame sequence is A1A2, B1B2, C1C2 ..., and after harddup it will be A1A2, A1A2, B1B2, B1B2, C1C2, C1C2 ...

My suggestion is
60fps output:
mencoder.exe -mc 0.1 -vf yadif=3,mcdeint,hqdn3d=0:0:8:8 -ovc xvid ... -oac copy -ofps 60000/1001 CUT.vob -o CUT.new.avi

30fps output(much faster):
mencoder.exe -mc 0.1 -vf yadif=2 -ovc xvid ... -oac copy -ofps 30000/1001 CUT.vob -o CUT.new.avi

dat720
20th May 2008, 21:25
nice, i understand, thanks :)

diego gr
20th May 2008, 21:47
Gaby83

I saw the video sample that you send me...
Definitively, the DVD source is already pixelated, 'cause it's insanely high-motion.
I never used AVISynth filters, I don't even know how to load a movie with that thing, but I've been reading some topics here, and I think you should try some "remove grain" or other noise reduction filters.
Later I'll upload some Xvid I made from that sample...

Gaby83
21st May 2008, 01:19
Thanks so much dat720, I'll start right now with it :)

But I have one more question... how do I do a resize in Mencoder? I've tried to do it but it gives me error every time xD. I would like to use 704x512.

And... the thing roozhou said... I don't understand it very well... do I have to change the code? I can understand he is explaining you that there is a better and faster way to make the yadif (I guess interlace) but cant understand how do I have to change the code you gave me to do the compression >.<.

Thank you guys :) , and Thanks diego gr, I'll be waiting for your results too!

Gabriela.-

roozhou
21st May 2008, 02:07
Here is how to combine deinterlacing and resizing. Suppose your DVD audio is 192kbps AC3 stereo.

1st pass:
mencoder.exe -mc 0.1 -vf yadif=0,scale=704:512,hqdn3d -sws 9 -ovc xvid -xvidencopts pass=1:turbo:bitrate=1400:threads=2:max_bframes=0:vhq=4:me_quality=6:hq_ac:trellis -nosound -ofps 30000/1001 CUT.vob -o NUL
2nd pass
mencoder.exe -mc 0.1 -vf yadif=0,scale=704:512,hqdn3d -sws 9 -ovc xvid -xvidencopts pass=2:bitrate=1400:threads=2:max_bframes=0:vhq=4:me_quality=6:hq_ac:trellis -oac copy -ofps 30000/1001 CUT.vob -o CUT.NEW.avi

Gaby83
21st May 2008, 07:21
:eek::eek::eek: Thanksss!! I'll try it right now! I really thank you very much for taking the time for helping me, :thanks::thanks:

Gabriela.- :)

EDIT: Oh... Wait a moment, roozhou... I thought you were dat720 :eek: will that code gimme the same results that dat720 gave me? =x

Thank you very much! :)

roozhou
21st May 2008, 07:35
:eek::eek::eek: Thanksss!! I'll try it right now! I really thank you very much for taking the time for helping me, :thanks::thanks:

Gabriela.- :)

EDIT: Oh... Wait a moment, roozhou... I thought you were dat720 :eek: will that code gimme the same results that dat720 gave me? =x

Thank you very much! :)

Better quality and smaller size. Make sure xvid bitrate+audio bitrate < 1500kbps or you will get file size larger than 700MB.

Gaby83
21st May 2008, 07:40
Ohh... I see D: Thanks so much roozhou! I'll try this code now! And... about the bitrate... Audio is in 192kbps AC3, but I would like to make audio in Mp3 because my DVD player has problems playing ac3 audio files.

Thanks roozhou! :):)

dat720
21st May 2008, 07:58
that's easy, put this:
-oac mp3lame -lameopts mode=1:preset=160

in place of this:
-oac copy

and change the 160 to what ever bitrate you want, 128,160,192, it's upto you

Gaby83
21st May 2008, 07:59
Ohh.. Thank you very much dat!! =)

Wii~~! Thanks so much guys! Gotta try it! :D

Gabriela.-

diego gr
25th May 2008, 15:21
So...Here are some encodings I made from that sample:
http://www.4shared.com/dir/7190414/689f85d/xvid_test.html
only using deinterlace blend and resize=0,75 filters

EDIT:
new file uploaded: "zones.avi" which has zone settings for the high-motion scenes