View Full Version : Encoding to xvid make my original video blurry
neutrogenik
26th March 2006, 02:00
I'm trying to modify and encode my TV source videos to get the less quality loss on it .
The original capture source is MPEG2 Transport Stream (TS) that i demux with the software "Project X" to obtain an .m2v video file that i can open with virtualdubmod.
The .m2v video has no visible quality loss regarding the capture file.
The problem is : when i save the video using xvid codec without using any filters (so without any modifications on the source vid) there is a visible quality loss on the output.
Screenshots (first is original / second is with xvid 1 pass @ 3500) :
http://kev060386.free.fr/original.bmp
http://kev060386.free.fr/xvid
The result of all this quality loss is that the xvid video is clearly different from the original one, it's more blurry :/
I tried with 2 pass but i get the same results so either i'm doing something wrong either i have to use another codec :confused:
Little graphic to explain what i'm trying to do :
original vid -----> cropping + resize + desinterleave + brightness correction + logo removal -----> final vid
or
original vid -----> cropping + resize + brightness correction + logo removal -----> final vid
Any help will be appreciated :thanks:
edit : changed the screenshot to the same frame with bmp quality for scharfis_brain :)
ChronoCross
26th March 2006, 02:20
that's because xvid is a "lossy" codec. you can never get the same output with xvid as the input. except at very high bitrates.
setarip_old
26th March 2006, 02:28
Hi!
I'd suggest you try several different deinterlace filters...
foxyshadis
26th March 2006, 06:16
What matrix? There are certain matrices (6of9, eqm uhr, eqm ehr, and some others) that are designed for those kind of bitrates; if you're using MPEG or (worse) h.263, you're just wasting space at those bitrates.
Teegedeck
26th March 2006, 08:56
First of all, congratulations on realizing that the result you're getting is not transparent (i.e. undistinguishable from the original). Many people don't notice. Or don't mind because they find the smoothness pleasant. XviD's defaults use H.263 quantization and this already prevents transparency.
So I agree with foxyshadis, probably a different matrix would do the trick. Filesize doesn't seem an issue for you, so you could as well use 1-pass at constant quantizer. Try the EQM v3UHR matrix at quantizer=4. You can even reduce the max. consec. b-frame number to 1 and use only an offset of 1; it still should produce lower bitrates than what you're aiming for now. (BTW, probably your second pass is performed at quant=1 because otherwise you'd get undersizing with H.263... That is a complete waste.) But you can probably reach transparency at much lower filesizes: Try the SixOfNine matrix at constant quantizer=3. That should deliver transparency at around 40% of the source's filesize, provided it is clean. If you want it still smaller try EQM v3HR at quantizer=3 or 4; not transparent but it should get reasonably close subjectively. And perhaps these settings (http://forum.doom9.org/showthread.php?p=796900#post796900) could be a good starting point for further improvements on two-pass encoding.
scharfis_brain
26th March 2006, 10:14
At first: only compare IDENTICAL images!
Your images above are NOT taken from the same timestamp!
Teegedeck
26th March 2006, 10:28
The deinterlacer really doesn't seem to work well, either.
neutrogenik
26th March 2006, 10:38
First thanks a lot for all your answers i'm glad to see that i'm not the only one to care about quality :)
At first: only compare IDENTICAL images!
I mistaked with that, i added 2 others screenshots that are from exact same timestamp sorry
I'd suggest you try several different deinterlace filters
The deinterlacer really doesn't seem to work well, either.
I didn't use any filters in these screenshot so we can see the difference between original vid and xvid one, that's why the deinterlacer is not working and the size is weird ^^
Otherwise i searched for the matrix thing that you talked about but as you can see my post number i'm such a noob and i can't find it, here is what i have in virtualdubmod :
http://img128.imageshack.us/img128/6045/clipboard021xd.jpg
http://img128.imageshack.us/img128/5157/clipboard015bx.jpg
Ps : Teegedeck the end of your sig made me laugh :D
scharfis_brain
26th March 2006, 10:55
Which bitrates are you aiming for?
Coz maybe it is better to stick with MPEG2 recompression.
ANother hint may be to disable the deblocker (decoder side..).
neutrogenik
26th March 2006, 11:01
I'd like that the quality of the modified vid is the nearest as possible as the original vid, and if it's possible a filesize which is under or the same as the original.
So i guess it's a high bitrate.
ANother hint may be to disable the deblocker (decoder side..)
You are speaking chinese for me lol
foxyshadis
26th March 2006, 11:43
http://img128.imageshack.us/img128/5157/clipboard015bx.jpg
Set this to MPEG-Custom. Then open matrix editor under it and load matrix. You can get the matrices you need from:
http://forum.doom9.org/showthread.php?t=83125
http://forum.doom9.org/showpost.php?p=751182&postcount=5
EHR is basically "lossless" (for further processing) at q2, UHR is transparent (visually lossless) at q2-3, HR is mostly transparent unless you have eagle eyes. sixofnine is between HR and UHR.
Teegedeck, maybe it would be a good idea to host the matrices in your preset thread, as I have a hard time finding some (like sixofnine and soulhunter's) and I know exactly what I'm looking for. ^^;
neutrogenik
26th March 2006, 12:37
I guess you mean that EHR = EQM V3HR ; UHR = EQM V3UHR and q = quantizer right ? :)
I tried it with UHR @ q2 and the result is truely amazing !!!
1st : original / 2nd : xvid UHR @q2 / 3rd : xvid H263 @3500
http://kev060386.free.fr/original.bmp
http://kev060386.free.fr/xvidEUHR@2q.bmp
http://kev060386.free.fr/xvid
That's exactly what i was looking for thank you a millon ! :thanks: :thanks: :thanks:
Anyway i'm still curious that in the second post (for 6of9) the author is giving more further details :
Bframes either none, or max.1 @ 1.00/1.00. VHQ=2, B-VHQ yes, Trellis yes, Qpel yes, Chroma motion yes. If grain is strong: ME=4 (yes indeed, "four"!)
I don't know what he means at all but as there are a lot of others options to tweak in the xvid control panel so i was wondering if there is something else that i should change and even if i don't i'll still be interested to understand what everything means :D
For exemple i thought that 2 pass was better than one because i read it somewhere but in fact i don't know at all what does that mean ^^
Or i'm getting confused with interlaced/ deinterlaced stuff : there is the deinterlace filter, the interlace option in rezise filter and the interlaced encoding in the codec : what do i have to do for deinterlacing at best my vid ?
http://img95.imageshack.us/img95/520/clipboard011ft.jpg
http://img95.imageshack.us/img95/1654/clipboard029hk.jpg
http://img128.imageshack.us/img128/5157/clipboard015bx.jpg
I know it's not the same topic so maybe i'd better create a new one ?
Thanks to all of you again for the help :)
foxyshadis
26th March 2006, 13:16
http://forum.doom9.org/showthread.php?p=552539#post552539 This is EHR. It's ~6000 kbps for my latest dvd backup. Really not a viewing format at all, just an intermediate or permanent archive one, so UHR is a good choice for you.
One-pass q2 is there to give you the best quality with no regard to size, and two-pass give you the optimal quality at any given size. If size is an issue you can do two pass encoding with full first passes ('full quality' and uncheck 'descard' in first pass options), and if it comes out too large for you then do a second pass at a bitrate. (But not too much lower, or UHR will lose its effectiveness.)
For deinterlacing/bobbing, go with avisynth. There's lots of good information available on it, and its filters are far better than vdub's.
Teegedeck
26th March 2006, 13:18
For exemple i thought that 2 pass was better than one because i read it somewhere but in fact i don't know at all what does that mean ^^
The stronger you want to compress (so-called "low bitrates") the more you get out of 2-pass. For encodings where only good quality matters, 1-pass at constant quantizer is the best way to ensure that you get exactly that: constant, good quality. See also this post by sysKin (http://forum.doom9.org/showthread.php?p=802661#post802661).
Or i'm getting confused with interlaced/ deinterlaced stuff : there is the deinterlace filter, the interlace option in rezise filter and the interlaced encoding in the codec : what do i have to do for deinterlacing at best my vid ?XviD's interlacing option is just that - it makes sure your interlaced content gets encoded correctly interlaced. Useful if you want to watch the result on a TV-set.
I'd say, get the TDeint filter for AviSynth and put a line in your .avs (directly below 'mpeg2source' or 'colorfilter', if you use that one) like this:
TDeint()
neutrogenik
26th March 2006, 14:15
K i understood the 2 pass thing thanks ;)
XviD's interlacing option is just that - it makes sure your interlaced content gets encoded correctly interlaced. Useful if you want to watch the result on a TV-set.
But knowing that i want to deinterlace my vid i should uncheck it right ?
Teegedeck
26th March 2006, 14:30
Yes, exactly.
neutrogenik
26th March 2006, 14:53
Roger, i have some trouble to understand how to use avisynth but i'll try to read some stuff in the forum and if i still don't get it i'll post in the right section :)
Thanks again to all of you for all the help, i'll go to bed less stupid today :D
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.