Log in

View Full Version : Advice on why encode quality seems so bad?


Hedley
27th December 2007, 19:00
Hey,

I've been attempting to encode fairly short (music) videos in XviD using VirtualDub (the version with MPEG-2 support). I've been taking VOB files from a DVD (from a DVD recorder), using DVD Decrypter to decrypt them, and then importing them into VirtualDub and following the guide at http://www.doom9.org/xvid-vdub-final.htm - However, the quality is unacceptable.

I followed the instructions, and I've used the same instructions to good effect with a VOB > XviD on a VOB that I'd downloaded, but viewing the decrypted VOB compared to the XviD, the quality is very poor - All motion is giving lines and things just seem more pixellated.

I don't know what the problem with it is, but what I'm looking to do is take content from a DVD recorder, and then encode it in as-close-as-possible quality on the PC in XviD - I've seen XviD encodes of the same channels before that are perfect, but how would I achieve it? The tutorials seem to be little help.

Any help that can be given would be great..

Dark Shikari
27th December 2007, 19:05
When you encode from a DVD source, you have to inverse telecine ;)

Sharktooth
27th December 2007, 19:14
or deinterlace... depending on the DVD source...

Hedley
27th December 2007, 19:58
How would I go about doing this? I know it's a clearly newbie question but I'm not a seasoned ripper - I guess it's a setting somewhere..

ankurs
27th December 2007, 20:17
well you have to read up a lot for that .. and as far as helping you is concerned do give us a .vob sample of the dvd which you are trying to encode and we will try to analyse the source and help you out as each source has different needs to be fixed so one same thing isn"t applicable to different sources .. a sample of around a minute would be more than enough .. and if you dont know then use MPEG2CUT to cut out a sample from the .vob and upload it somewhere so that we can download it and analyse it .. until then adios muchachos !

Hedley
27th December 2007, 22:06
Ok, here's a sample, it's only 19 seconds because a minute long sample seems to be about 100MB.

http://www.hedleyness.com/sample.VOB
Have moved file to avoid bandwidth usage, can re-locate back if needed

As I said in the original post, what I'm looking to do is ultimately have any such clips in high quality XviD format, much like you'd see from the groups and so who do it on a regular basis.

In case it helps, here's the actual process I gone through to get to that VOB:

1. Record to hard-drive of Sony RDR-HXD870
2. Dub to DVD-R
3. Use DVD Decrypter to decrypt VOB

I've noticed that the quality is absolutely perfect on the DVD recorder, I don't know if dubbing causes quality loss, nor do I know if decrypting causes significant loss (I know it causes a little?).

poisondeathray
27th December 2007, 23:11
you probably need to deinterlace if you see "horizontal lines"

in virtualdubmod (or virtualdubmpeg2):

video => filters => add => deinterlace => blend

Then encode as per normal

Another possible reason for "poor quality" is a low bitrate; you may want to increase/decrease according to whatever is acceptable for you - practice this on your little clip

Cheers

Hedley
27th December 2007, 23:36
Alright, thanks for the help so far.

I've followed the instructions above, and set the target bitrate to 1600 (G-Spot tells me it's came out at over 2500).

The end result was, after the 2nd pass, http://www.hedleyness.com/test2.avi - There's still lines and I don't know, something just seems wrong to me, like the quality is lower than it should be? It just seems that any motion seems a bit iffy, like when the song title appears for example, that box isn't appearing smoothly like it actually did in the original VOB and on the original broadcast.

Any suggestions?

poisondeathray
28th December 2007, 00:06
There are better quality deinterlacing filters, that compensate for motion like TomsMoComp, and Yadif

I don't think theses come "built in" with virtualdub, and you would have to learn how to use avisynth scripting (which is very powerful, but hard to learn at first) along with these plugins

If you don't want to learn avisynth scripting, you could use a tool called avidemux which has yadif built in, and its very easy to use.

I know this is the xvid section, but you could also encode in h.264/x.264 video codec which has better quality at the same bitrate...

Hedley
28th December 2007, 00:20
I tried a re-encode and noted that I had to fully encode, and not do a "Fast recompress", which wasn't using the filters. This has resulted in a better end result.

However, I've noted one other thing - Despite the VOB and XviD both being 720x576, the XviD seems to have more 'space' at both sides of the video - Here's what I mean (inverted to show it clearer):

http://www.hedleyness.com/t.jpg

I'm guessing this is some sort of setting, but I can't see which one?

Thanks for the help so far, by the way - I'm gonna try encoding the full thing once I can solve the extra space problem.

poisondeathray
28th December 2007, 00:33
Yes, I was just going to say that once I saw your clip - it doesn't look deinterlaced properly!

I just tried it myself, and I don't get the different edges that you do...

Your "test2clip.avi" edges (before you used full processing mode) looks identical to the original VOB to me ?

Hedley
28th December 2007, 00:41
Yes, I was just going to say that once I saw your clip - it doesn't look deinterlaced properly!

I just tried it myself, and I don't get the different edges that you do...

Your "test2clip.avi" edges (before you used full processing mode) looks identical to the original VOB to me ?

The test2.avi (one I posted) and test2b.avi (not online) both have different edges to sample.VOB - There's large space, mostly on the left side, which almost seems like the encoding has boxed the clip - I thought at first it had changed the resolution, but it hasn't. If you look carefully in full screen (I used VLC in full screen but other players show it too), there's two clear strips of black at either side in the XviD (seemingly not part of the actual video 'frames'), whereas the VOB fills all the way across the screen. I'm not sure why this is, but I guess it's some setting along the way.

poisondeathray
28th December 2007, 00:43
These are from the clips I downloaded from you:

FYI, you can crop away those "bars" and resize the video if/when you chose to use avisynth scripting

ankurs
28th December 2007, 00:52
well your source is a PAL interlaced one which is at 25.000 fps .. it only had to be bobbed and pulled down back to 25 fps .. that was the proper deinterlacing for this .. used tdeint(mode=1) to bob it (double the original frame rate ) and then used cdeblend to deblend it .. the guy drumming the drum seemed to have some blends in it havent seen the whole source so presumed there might be more of them as it is a music video .. also did proper cropping and resizing and some sharpness , colour tweeks and denoising was added .. didnt have time to play around with much of it but here"s the end result which i got .. will try to have a look at it again .. gotta run for now getting late for work :O ..

here"s the script which i used



LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\fft3dfilter.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\warpsharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\asharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\removegrain.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Vinverse.dll")
Import("C:\Program Files\AviSynth 2.5\plugins\LimitedSharpenFaster.avsi")
Import("C:\Program Files\AviSynth 2.5\plugins\RemoveNoiseMC_HQ.avs")
Import("C:\Program Files\AviSynth 2.5\plugins\ylevelsS.avs")
Import("C:\Program Files\AviSynth 2.5\plugins\soothe.avs")
Import("C:\Program Files\AviSynth 2.5\plugins/CDeblend.avs")
Import("C:\Program Files\AviSynth 2.5\plugins\mrestore.avs")

DGDecode_mpeg2source("C:\1.d2v",cpu=2)

ord = last.getparity() ? 1 : 0

Assumetff()

tdeint(mode=1).cdeblend().mrestore(numr=1,denm=2).vinverse()

crop( 2, 6, -16, -6)

dull = last.Spline36Resize(576,416)

YlevelsS(10,1.06,255,0,255).Tweak(hue=1.1,sat=1.28)

sharp = dull.LimitedSharpenFaster(ss_x=1.25, ss_y=1.25, Smode=1, strength=80,overshoot=1)

asharp(4,6,1)

removegrain(mode=3)

soothe(sharp,dull,35)



P.S : Here"s the ripped video have a look at the results for yourself got it at 1600 kbps .. http://www.sendspace.com/file/1gm8kc .. also cant be bothered to help u out with getting all the required filters as i am already late :( .. have a look here http://avisynth.org/warpenterprises/ .. hopefully u will find all of the required filters here and for the .avs"s u"ll have to search around the forum .. i am off for now .. adios muchachos !

Hedley
28th December 2007, 01:53
The attachments are pending, so I can't view them yet, but I think the bars on the sides are aspect ratio related? They're the only problem with the encodes I've got now, and I'm hoping it's something VirtualDub can solve - They aren't there before the VOB > XviD, so it has to be putting them there itself, surely? They aren't part of the video, it just means there's these big bars in full screen (as in my above images).

I've had a look into AviSynth, and it seems very complicated - For now I'm hoping the problem with bars can be solved with VirtualDub, as it's obviously easier to use a GUI like that, although I may look into AviSynth if need be.

However, anyone have any ideas about the aforementioned bars? Thanks :P

poisondeathray
28th December 2007, 02:29
Sorry, I didn't know about the attachement pending thing...

I'm not sure why you are seeing different edges

sample.VOB.jpg
http://i15.tinypic.com/6o5c41z.jpg

test2.avi.jpg
http://i11.tinypic.com/82mkolw.jpg

The edges look similar to me? The black bars in the above screencaps can be cropped. Ankurs looks like a pro at avisynth, and you can see his script crop( 2, 6, -16, -6)

If you don't want to use avisynth at this point, I might suggest avidemux. It is a great tool and completely graphical without avisynth scripting (e.g. it crops and shows you the resultant output as you crop it)

Hedley
28th December 2007, 02:38
What player are you viewing it in, and is it full screen? In VLC's full screen (and Winamp's), there's the large black section on the left side too:

http://www.hedleyness.com/screen.PNG

The black bars in the screenshots you've posted don't concern me, it's more this added - And this isn't the technical term but I think it describes it best - Letterboxing. The added bars aren't in the video itself, as they don't show in VirtualDub:

http://www.hedleyness.com/screen2.PNG

Perhaps it's a codec issue? That said, I have other XviD files that fill fully across the screen, including one I encoded myself (from an NTSC source, by the way).

If it is part of the video, I'll look at Ankurs' crop script, but the black bars don't even seem to be part of the video? :/ I'm confused, any ideas?

poisondeathray
28th December 2007, 02:53
I'm using media player classic, but I get the same results with VLC (i.e. no left black bar)

The videos were encoded at 720x576 (5/4). This is a fixed property of the encode. You will get "black bars" unless you distort the image to fit. You can adjust the way your player displays the video. For example, you can distort the video dimensions by selecting "stretch to window" in MPC. In VLC, you can right click and adjust "aspect ratio"

The other option is to change the encoding parameters using resize (avisynth). e.g. you can resize it to standard DVD 720x480, etc...or whatever resize

Didée
28th December 2007, 15:48
@ ankurs
There's so much wrong in what you posted ... have you been in a hurry? ;)

tdeint(mode=1).cdeblend().mrestore(numr=1,denm=2).vinverse()
Not good. MRestore is made for doing the complete circle of removing blends & restoring the original framerate. If CDeblend is called before MRestore, you're pulling the carpet away under MRestore's feet ...


crop( 2, 6, -16, -6)

dull = last.Spline36Resize(576,416)

YlevelsS(10,1.06,255,0,255).Tweak(hue=1.1,sat=1.28)

sharp = dull.LimitedSharpenFaster(ss_x=1.25, ss_y=1.25, Smode=1, strength=80,overshoot=1)

asharp(4,6,1)

removegrain(mode=3)

soothe(sharp,dull,35)

The code lines shown in grey do not affect the result in any way - they could be deleted as well, the result would stay the same. (You throw some filters in, but their output is not used at all.)

* * *

But most importantly, this source is > NOT < a field-blended normconversion! Judging from the sample, it's just a 24p source (23.976) that was pulled down to 25i.

Blend-Removers/Restorers are the wrong choice for this content, they shouldn't be used here at all.

The basic way to treat this source is

TFM() .TDecimate(mode=2,rate=23.976)

though that could need some twiddling with the available parameters (the default call leaves back some dupe frames that shouldn't be there).

jeffy
29th December 2007, 08:45
@ ankurs
* * *

But most importantly, this source is > NOT < a field-blended normconversion! Judging from the sample, it's just a 24p source (23.976) that was pulled down to 25i.

Blend-Removers/Restorers are the wrong choice for this content, they shouldn't be used here at all.

The basic way to treat this source is

TFM() .TDecimate(mode=2,rate=23.976)

though that could need some twiddling with the available parameters (the default call leaves back some dupe frames that shouldn't be there).

Didée, could you please tell us how did you found out it was just pulled down to 25i?

Didée
29th December 2007, 12:48
Separating fields, stepping through one by one, counting unique motion states. Per 50 fields there are two instances of "triple" fields, which indicate that 24p was pulled down to 50i.
Somewhere in the middle there is a small section with blends, however these are not part of the conversion process, but have been created prior to that. It's several consecutive fields that have blending, they can't be recovered.

jeffy
29th December 2007, 14:23
Didée: :thanks:

Hedley
29th December 2007, 16:36
The problem with the black bars, by the way, was with the "Fix aspect ratio" being set in the media players I used.

I'm currently experimenting with the whole encode, seeing if I can get viewable results for the whole video.

ankurs
30th December 2007, 11:57
@ ankurs
There's so much wrong in what you posted ... have you been in a hurry? ;)


Not good. MRestore is made for doing the complete circle of removing blends & restoring the original framerate. If CDeblend is called before MRestore, you're pulling the carpet away under MRestore's feet ...




The code lines shown in grey do not affect the result in any way - they could be deleted as well, the result would stay the same. (You throw some filters in, but their output is not used at all.)

* * *

But most importantly, this source is > NOT < a field-blended normconversion! Judging from the sample, it's just a 24p source (23.976) that was pulled down to 25i.

Blend-Removers/Restorers are the wrong choice for this content, they shouldn't be used here at all.

The basic way to treat this source is

TFM() .TDecimate(mode=2,rate=23.976)

though that could need some twiddling with the available parameters (the default call leaves back some dupe frames that shouldn't be there).

was in a hurry then was late for work hehe .. oh did I :eek: well reason why i used cdeblend before mrestore was because mrestore de-blends also itself innit ? also because cdeblend() after mrestore() gives me a much less encoding speed than using it before .. putting it first gives me a process rate and that was the only reason why i employed it before mrestore ? any suggestions what i should do from now onwards on hybrid blended sources ? ( usual frame rate using it before it = around 9 , after = 5 fps n this makes a big difference for me hehe times precious :P)

also wont decimating directly after deinterlacing it get the audio video out of sync ( as decimate would drops some frames and runtime wont get into sync (dupe frames are fine but wont it cause un necessary frame drops ? ) ) haven't checked this though on the sample and cant be bothered now as i am already late for college now too lol .. i analysed the sample then and seemed to have a PAL pattern then .. thought so hehe but your facts contradict me :devil: thanks for pointing the 25i process out also didee .. will help me out in the future too :) thanks a LOT again :p

P.S : As far as those filters were concerned i just copied another PAL source script of mine in there and forgot to remove those parts from it hehe ..