Log in

View Full Version : H.264 vs. Xvid at high bitrates please advise


Pages : [1] 2 3

markrb
22nd April 2006, 20:16
I am about to start converting many of my DVD's into mkv's and I am still debating over which I should use.

I am not asking what is best here, but more to the point is there enough of a quality difference at higher bitrates for me to use H.264 and the extra encoding time?

I am looking to create files around the 2gb range for a typical movie.

Since these will remain on the HD hitting a filesize is not important as long as it isn't 400mbs too big. I am currently leaning towards a one pass XVid encode for the time savings. Several hours at least for me over H.264.

Is there a compelling reason I should change to H.264 instead?

I have done a couple of personal tests, but the time involved is too much to do a true comparison.
From the few I have done I really can't see much of a difference, but maybe I am missing something or maybe there is a movie type that I haven't tried that will prove to be worth the extra time.

I am looking at close to 100 conversions so time is a factor.

Thanks,
Mark

Adub
22nd April 2006, 20:22
For High bitrates, no there really is no reason to use x264. Xvid is faster, and with the increased bitrate there will not be a huge difference in quality, almost none infact. I would go with Xvid on this one, although 2 passes, not 1. 2 passes is still fast, but also greatly increases quality.

Sagittaire
22nd April 2006, 20:32
Xvid is faster

it's not true. With same bitrate and and same speed x264 done always very better quality XviD VHQ1 (default setting) for example ...

it's not a obligation to use 16 ref, RDO, high profil ... etc etc etc with H264. H264 can be very fast codec too ... ;-)

siddharthagandhi
22nd April 2006, 20:33
Merlin is entirely right. At bitrates of over 1500 kbps, you will get a very minimal, if at all, an advantage for H.264. Stick with the ASP codecs, like Xvid, as Merlin said.

And you're a retired Doom9 person how come you're asking questions arent you supposed to know everything? :P

markrb
22nd April 2006, 21:50
Ahhh, but now you know our secret. We pretend to know everything, but really we are all just noobs playing with ya.

I was a Mod in the DVD2SVCD forum. Ask me about CCE, DVD2SVCD, some avisynth and maybe I can help, but this stuff is new to me.

Mark

Adub
22nd April 2006, 22:17
@Sagittaire,
What options are you using? I never get the same speed with x264 as I do with xvid. and if I do reduce some of the standard options I get a noticeable quality drop.

Sagittaire
22nd April 2006, 23:31
@Sagittaire,
What options are you using? I never get the same speed with x264 as I do with xvid. and if I do reduce some of the standard options I get a noticeable quality drop.

http://forum.doom9.org/showthread.php?t=105763

certainely but even with quality drop x264 is always by far better than XviD

siddharthagandhi
22nd April 2006, 23:45
Yes I also have a colossal speed increase with xvid.

foxyshadis
22nd April 2006, 23:56
The only way I've ever been able to get x264 up to xvid's speed (more than 100 fps with VHQ1) is to use turbo options - me dia, subme 1, analyse none. At low bitrates x264 is only slightly worse, but at high bitrates it looks much worse. I know some people've said x264's fastest is better than xvid's slowest, but I've never seen anything remotely like that, even though it contradicts sagittaire's results. Maybe it's different on other processors, or different movies, or whatever.

I'd say once you get a standalone that supports AVC, if ever, that would be a compelling reason to switch. The one thing I feel xvid really lacks is an equivalent to --crf, for constant quality (not constant quant), since you can get increased quality across most of the movie for the same size.

DeathTheSheep
22nd April 2006, 23:58
I've found x264 to be to superior to XviD in quality even at high bitrates, and the speed, if not exactly equal, was comparable. At such high bitrates, one may not notice the quality difference as easily, however.

What's "best" depends on the viewer, unfortunately.... ;)

*.mp4 guy
23rd April 2006, 01:46
http://forum.doom9.org/showthread.php?t=105763

certainely but even with quality drop x264 is always by far better than XviD
You should learn to avoid making overly broad sweeping statements based on metric tests. For one your test was at 1400kbps a bitrate which X264 usually still has an advantage at, your test also relied on metrics which tend to favor Mpeg4-avc more then people do. Furthermore you tested on a clip from king kong which was very bitrate hungry (Xvid only hit an OPSNR of 43, which is much lower then it should be for a typical movie encode at 1400 kbps) which means the effective compressability of that clip was most likely in the 1cd-sub 1cd range, an area where it is widely recognized that Mpeg4-AVC has a clear advantage. Your results are not at all aplicable to this situation.

for a 1hour 30minute movie the effective bitrate for a 2GB encode would be 2911Kbps (with one 192Kbps audio track) which is a bitrate Way out of Mpeg4-AVC's usefull range. There is absolutely no reason to use X264 for encoding under these conditions, you could even end up with an encode with noticibly worse grain retention if you used X264. Ignoring the longer encoding time and the more demanding playback requirements there is still no reason to use X264 in this instance.

IgorC
23rd April 2006, 02:18
Unfortunetly not each day and not many people provide some results. But Sagittarie is doing it well. People have no enough time or no skils ..... . In fact it was only one pretty usefull comparison for last 2-3 months.

*.mp4 guy
23rd April 2006, 02:24
Unfortunetly not each day and not many people provide some results. But Sagittarie is doing it well. People have no enough time or no skils ..... . In fact it was only one pretty usefull comparison for last 2-3 months.
I'm not saying his tests can't be usefull, I was just pointing out that that test was completely out of context and wasn't valid in this context.

IgorC
23rd April 2006, 02:27
I'm not saying that you're saying it. ;)

Audionut
23rd April 2006, 03:37
All my tests show that x264 is better than xvid reguardless of bitrate.

it's not a obligation to use 16 ref, RDO, high profil ... etc etc etc with H264. H264 can be very fast codec too ... ;-)

markrb
23rd April 2006, 03:40
It seems then as long as I keep the bitrate above 1500 then any added benifit would be minimal if I used h.264?

I am doing a test now where the bitrate is above 1700. I like to keep the original audio AC3 since I can send it digitally to my reciever and have it decode it internally. This adds a little size, but I can live with that.

The current test movie is a little over 2hrs with AC3 audio and I set the target size to 2gb.

Has anyone done any tests with the higher bitrates I am looking at?

Igorc/*.mp4 guy I think there is an understanding error. Seems like a language issue.


If I want to test x264 with high quality and good speed can you recomend some settings to try then?
I am using Megui as the interface.
I just can't deal with 7hr long encodes for each video I have to do.

Thanks,
Mark

siddharthagandhi
23rd April 2006, 03:43
Yes I have. Funny thing is, despite the technical fact that there should be no difference at the high bitrates, I do get a difference. But maybe its just codec discrepancies.

Audionut
23rd April 2006, 03:58
If I want to test x264 with high quality and good speed can you recomend some settings to try then?
I am using Megui as the interface.
I just can't deal with 7hr long encodes for each video I have to do.

Thanks,
Mark


--pass 2 --bitrate 1700 --stats ".stats" --ref 5 --mixed-refs --bframes 3 --b-pyramid --bime --weightb --filter -1,-1 --analyse all --8x8dct --direct auto --progress --no-psnr --output "C:\test.mkv" "C:\test.avs"

With a fast first pass.
Speed should be comparable to xvid with all options enabled.

Things you can try.
--filter 0,0 <-- deblocking in megui
--subme 6 or 7 <-- subpixel refinement in megui, with --b-rdo <-- RDO for b-frames.
--trellis 2 (always)

Of course your best bet is to make your own little test to verify.
Encode a sample of a movie with xvid, and the same sample with x264(with the settings posted above).
Judge both encodes with your eyes.
For my eyes, I very much prefer the look of x264 encodes.

Then run this scipt.
loadplugin(c:\x\ssim.dll")

# --> Load source with same options as avs file <--

source=Mpeg2Source("C:\test.d2v")
source=Crop(source,6,68,-14,-74)
source=LanczosResize(source,704,304)
source=selectrangeevery(source,10000,100)


# --> Load the video <---


video=directshowsource("C:\test.mkv")


# --> SSIM analysis <--

SSIM(source,video,"results.csv","c:\x264.log",lumimask=2)


P.s. Give xvid a little help with extra bitrate. It will need it.:D

markrb
23rd April 2006, 04:18
The only thing I can see different from my current setup is the trellis setting is at 1.

I am assuming with this code I only see what is on. What do you have shut off in Megui?

I am using the CE Highprofile setting.

I am also using Bicubic nuetral, but that is from my SVCD days of testing as I didn't like the others.
I will do a test with Lanczos(sharp).

Mark

Audionut
23rd April 2006, 04:38
The differences between my settings and CE Highprofile are,

subpixel refinement 5 instead of 6.
Trellis none instead of 1
reference frames 5 instead of 3.
b-frame mode auto instead of spatial.

or download the config file here.
http://rapidshare.de/files/18705185/Balanced.rar.html

kotrtim
23rd April 2006, 05:19
I would recommend to have no fast pskip always on, change trellis to 1 for faster speed, reduce the reference frame to 2 + mixreference or even 1 for even more speed, normally according to the statistics after encoding, x264 rarely use the 3rd and above frames for reference, only around 1% or less.

Sagittaire
23rd April 2006, 12:31
You should learn to avoid making overly broad sweeping statements based on metric tests. For one your test was at 1400kbps a bitrate which X264 usually still has an advantage at, your test also relied on metrics which tend to favor Mpeg4-avc more then people do. Furthermore you tested on a clip from king kong which was very bitrate hungry (Xvid only hit an OPSNR of 43, which is much lower then it should be for a typical movie encode at 1400 kbps) which means the effective compressability of that clip was most likely in the 1cd-sub 1cd range, an area where it is widely recognized that Mpeg4-AVC has a clear advantage. Your results are not at all aplicable to this situation.

for a 1hour 30minute movie the effective bitrate for a 2GB encode would be 2911Kbps (with one 192Kbps audio track) which is a bitrate Way out of Mpeg4-AVC's usefull range. There is absolutely no reason to use X264 for encoding under these conditions, you could even end up with an encode with noticibly worse grain retention if you used X264. Ignoring the longer encoding time and the more demanding playback requirements there is still no reason to use X264 in this instance.

Bitrate doesn't mean anything ... lol

As always bitrate in my test doesn't mean anything. I use XviD q4 for reference in this test. With this source q4 XviD produce 1400 Kbps and ~q4 for XviD is typicaly the quant used for 100-120 min 720*400 movie for 1CDR. This test is really representative for real test conditions and AVC is simply always better than ASP.

@ Merlin7777

1) use anamorphic encoding 720*576 without crop and resize for your source (perhaps mod16 resize and recrop could be good for perfect borders quality)

2) Use LC-AAC 5.1 encoding to replace AC3 with mp4 container : hardware compatibility will be very better

*.mp4 guy
23rd April 2006, 14:13
Bitrate doesn't mean anything ... lol

As always bitrate in my test doesn't mean anything. I use XviD q4 for reference in this test. With this source q4 XviD produce 1400 Kbps and ~q4 for XviD is typicaly the quant used for 100-120 min 720*400 movie for 1CDR.
Your right bitrate doesn't mean anything, what is important is compressability and Xvid H.263@Q4 is a compressabilty range that AVC excels at (I've done tests).

This test is really representative for real test conditions. Yes, this test is representative of real conditions when using Xvid at fixed Q4 with H.263, but it is not representative of anything else.


AVC is simply always better than ASP AVC is always better then ASP for metrics, that is true, but at high bitrates things like RDO optimisation deblocking and motion estimation all become less usefull. You can see the effect by comparing the difference by computing the SSIM difference between fast settings and slow settings at a low compressability, then doing the same at a high compressability, the differences will be much smaller at a high compressability (you can do the same thing with OPSNR, but its not a very good metric to test how people will percieve things). AVC also becomes less usefull due to the same restrictions.

This is an overall trend in lossy data compression, high complexity compression algorithms work best at high compression ratios. For instance take a look at Mpeg2 audio, mp3, and LC AAC/HE AAC, Mp2 audio compression works just as well as mp3 at low compression ratios (Musepack which is based off of Mp2 is actually significantly better, while still being less complex then mp3), but quicky becomes less efficient as compression ratios increas. Mp3 works just as well as LC AAC at 160kbps, LC AAC only starts to have a definate edge around ~100 kbps. HE AAC (the highest complexity audio compressor) only becomes useful at about ~64 kbps and actually hurts quality above this point, it is most usefull for the ~32kbps range. High gains at high compression ratios says nothing of what will happen at low compression ratios, if it did then we would all be using HE AAC all the time...

siddharthagandhi
23rd April 2006, 14:33
MP4 Guy you're kind of outnumbered on this one.

I agree with Saggitaire

"AVC is simply always better than ASP"

Regardless of technical details such as metrics and all that, the overall visual quality is better, and surpisingly, I see a difference at all bitrates, though AVC is designed to be a low bitrate format. By overall visual quality I mean when you're looking at the video what it looks like, disregarding these metric details and deblocking etc. etc.

And this occurs in all AVC codecs I have used, including Nero Digital, x264, and VSU H.264 codec. And I have encoded a lot of different samples and have observed this pattern.

TonyMo
23rd April 2006, 14:43
Just to add my rarely heard voice to the x264 chorus.

I've done extensive personal testing of both xvid and x264 all with the goal of providing transparent backups for DVD. On my rig (and I'm including my eyes here), x264 is vastly superior to XVID at higher bitrates (or any comparable bitrate)... This is using the latest Chronos/Sharkhunter builds and matrix...

The only problem is the dark scene/bluesky issues, and I still need to do some more experimenting with the new AQ options to try and get past those, I'm keeping my fingers crossed. Given that neither codec really provides absolute transparency while maintaining some form of compression, x264 looks the best overall to my eyes and there are many a time I forget I am not looking at the original DVD master.

To reap the maximum benefits though it does help to use some of the slower encoding settings.

XVID is great though at crunching though encoding time and is not to be sniffed at at any means.

siddharthagandhi
23rd April 2006, 15:21
"Sharkhunter"-- do you mean sharktooth?

Sagittaire
23rd April 2006, 15:41
AVC is always better then ASP for metrics, that is true, but at high bitrates things like RDO optimisation deblocking and motion estimation all become less usefull. You can see the effect by comparing the difference by computing the SSIM difference between fast settings and slow settings at a low compressability, then doing the same at a high compressability, the differences will be much smaller at a high compressability (you can do the same thing with OPSNR, but its not a very good metric to test how people will percieve things). AVC also becomes less usefull due to the same restrictions.

Well be carefull PSNR and SSIM are logaritmic function. For high quality little metric improuvement is high size gain.

Here quality metric equivalence for King Kong Trailer 720*400

SSIM size equivalence
~q2 ASP encoding at 2800 kbps done same quality than 2100 Kbps for AVC -> 25% for size gain
~q4 ASP encoding at 1400 kbps done same quality than 1020 Kbps for AVC -> 28% for size gain
700 Kbps encoding for AVC done same quality than 1050 Kbps for ASP -> 33% for size gain

In fact you can't compare AVC and ASP like you can't compare MPEG2 and MPEG4 ASP ... XviD can't fight with x264 in all situation

Sharktooth
23rd April 2006, 15:41
AVC is clearly better than ASP at low medium and mid-high bitrates.
on higher bitrates though there's actually no differece coz both codecs can reach transparency.
also AVC may have problems keeping ultra fine details (such as noise and smaller grain) even at higher bitrates. That's the only case where ASP can be slightly superior than AVC.

Revgen
23rd April 2006, 16:26
X264 is also more flexible than Xvid. You can choose between Main Profile, High Profile, Deblocking, b-frame options, SubMe, and others to find a good balance between speed and quality.

Awhile back I decided to try and adjust my X264 settings to match the speed of Xvid at the same bitrate, and X264 still came out looking better. I would advise you to play around with the settings a little and see what you can find.

IMHO using Xvid for speed purposes is an excuse for not trying out a new codec that you may not understand so well. Granted Xvid is a lot easier to use and understand then X264.;)

*.mp4 guy
23rd April 2006, 16:27
Well be carefull PSNR and SSIM are logaritmic function. For high quality little metric improuvement is high size gain.

Here quality metric equivalence for King Kong Trailer 720*400

SSIM size equivalence
~q2 ASP encoding at 2800 kbps done same quality than 2100 Kbps for AVC -> 25% for size gain
~q4 ASP encoding at 1400 kbps done same quality than 1020 Kbps for AVC -> 28% for size gain
700 Kbps encoding for AVC done same quality than 1050 Kbps for ASP -> 33% for size gain

In fact you can't compare AVC and ASP like you can't compare MPEG2 and MPEG4 ASP ... XviD can't fight with x264 in all situation
You completely missunderstood what I was saying.

[edit]actually I missunderstood you, you are right about the logarithmic nature of SSIM and PSNR, but the effect I described is still easily noticible.

Lil' Jer
23rd April 2006, 17:04
IMHO using Xvid for speed purposes is an excuse for not trying out a new codec that you may not understand so well. Granted Xvid is a lot easier to use and understand then X264.;)

Well, to be frank, your opinion is quite wrong.

Sagittaire
23rd April 2006, 23:00
You completely missunderstood what I was saying.

[edit]actually I missunderstood you, you are right about the logarithmic nature of SSIM and PSNR, but the effect I described is still easily noticible.

well in fact it's more like a(1-e^(-ax)) for SSIM ... ;-)

Kopernikus
23rd April 2006, 23:51
well in fact it's more like a(1-e^(-ax)) for SSIM ... ;-)

Huh, is this the SSIM I think it is? Can you explain how you get this formula?

markrb
24th April 2006, 16:16
I may end up being forced to use x264 anyway.
For some reason Megui and Mkvmagic both are crashing during the encode with Xvid. While x264 makes it through without issue.
I don't have the time to do much debugging. The AVS plays fine in media player and it encodes for a good time, but dies everytime at different points.
I even have Megui create and check everything.

BTW what would you consder to actually be low, mid and high bitrates anyway?
I hear the words, but no numbers.

Thanks,
Mark

siddharthagandhi
24th April 2006, 21:17
Low= 500 kbps to 1 mbps
Medium- 2 mbps
High- 5-8 mbps
Ultra High HD Bitrate- 16-20 mbps
Insane High- 50 mbps
WTF is this?- 200 mbps and above

*.mp4 guy
24th April 2006, 22:02
BTW what would you consder to actually be low, mid and high bitrates anyway?
I hear the words, but no numbers.

Thanks,
Mark
Low= 1cd (650-950 kbps)
Medium= 2cd (1000-1650 kbps)
High= 1/2 DVD (1700-3200 kbps)
Transparent= ~3-9mbps for standard definition ~6-18mbps for 720P ~12-24mbps for 1080P
(all assuming a framerate of 23.976 or 25, and that all footage is progressive or telecined)

GodofaGap
24th April 2006, 22:59
I'm not sure if it makes sense to talk about bitrates as high or low without knowing anything about the source. Perhaps defining it as a quant(-range) would be more useful?

So for XviD: high ~q2, medium ~q4 and low ~q8? Which makes x264: high ~q18, medium ~q24 and low ~q30.

siddharthagandhi
24th April 2006, 23:48
I did some testing, and I figured out that AVC vs. ASP depends on resolution as much as bitrate. With a 400 by 300 file at 2 mbps, AVC is better than ASP. With a 512 by 384 file at 2 mbps, asp beats AVC, not by a lot, but still beats AVC. The two codecs I tested were Nero Digital AVC and Xvid ASP.

nm
25th April 2006, 00:13
I very much doubt you would arrive to the same conclusion if you tested 10 different sources at both resolutions. Your observation is most likely just a fluctuation caused by the sources you tested.

Audionut
25th April 2006, 01:08
And the fact your using nero based avc.

siddharthagandhi
25th April 2006, 02:07
What's wrong with Nero based AVC? I get much better results with Nero AVC than x264.

And it is a fluctuation. Now that I look at it closer, its probably AVC thats better. Its just that there are certain scenes that look horribly worse.

But btw for some reason I get better quality using Xvid than x264 what could be responsible for this? I use default settings, is there anything I should change?

Blue_MiSfit
25th April 2006, 02:27
I think Sharktooth has a very good point about ASP preserving minute details like film grain better at high bitrates.

I have found that if you do an unfiltered encode (only crop and resize, or just mpeg2source) with a movie with lots of film grain (I recently did Three Kings), XviD tends to preserve the grain better. x264 seemed to turn the nice grainy blue sky into a soup of blue and red chroma soup - this was at full NTSC with 1/2 DVD target filesize with the original 448kbps 5.1 AC3.

Of course, some gentle denoising (tweaked fft3dgpu IIRC) really improved this, while preserving most of the grain. However, I still found XviD with the EQM V3HR matrix to be superior to AVC. That same chroma noise soup was much less apparent with this when compared to x264.

In conclusion, with cleaner sources, and/or tighter compression (TV shows etc) I always use x264. But with very film-like movies (lots of grain, high contrast), XviD just seems to preserve minute details and sharpness a tiny bit better, but only when I provide sufficient bitrate, and take the time to make a good script.

However, nobody but a video encoder with trained eyes can tell the difference, honestly. Most of my friends still think my fuzzy old half resolution divx rips from 4 years ago look good :)

~MiSfit

siddharthagandhi
25th April 2006, 03:03
Yea I agree on the last part. I sent my friend a video 92 kbps Windows Media 9 and he said it looked excellent. LMFAO!

Audionut
25th April 2006, 05:46
What's wrong with Nero based AVC? I get much better results with Nero AVC than x264.


But btw for some reason I get better quality using Xvid than x264 what could be responsible for this? I use default settings, is there anything I should change?


http://forum.doom9.org/showthread.php?t=110427

Momotte
2nd May 2006, 20:02
If I had to encode 720p or 1080i HD, would you recommend I use AVC or ASP ? If I understood well, high bitrates should not mather that much so since HD is high bitrate... I am confused...

ChronoCross
2nd May 2006, 20:09
If I had to encode 720p or 1080i HD, would you recommend I use AVC or ASP ? If I understood well, high bitrates should not mather that much so since HD is high bitrate... I am confused...

use AVC.

Blue_MiSfit
3rd May 2006, 23:40
aggreed. At larger frame sizes especially AVC exhibits a strong advantage IMHO

KafesneBikaina
4th May 2006, 11:45
aggreed. At larger frame sizes especially AVC exhibits a strong advantage IMHO
Could you explain the reason for that?
I'm testing Nero-AVC vs XviD with HD source now at high bitrates.

akupenguin
4th May 2006, 11:58
well in fact it's more like a(1-e^(-ax)) for SSIMHuh, is this the SSIM I think it is? Can you explain how you get this formula?
The "internal" representation of SSIM, as presented by the original paper (http://www.cns.nyu.edu/~zwang/files/research/ssim/), produced scores in the range [0,1] with 0 being highest quality. Whoever it was that wrote the avisynth filter implementing SSIM decided to remap the scores to a different range, [0,100] with 100 being highest quality. The remapping formula was arbitrarily picked as: 100*(1-internalssim)^8.
I don't know offhand whether the convergence is e^(-ax) or some polynomial, but this is where the form of the formula comes from.

The same way the internal representation of PSNR is SSD, and psnr=-10*log10(ssd/max_ssd).

Momotte
4th May 2006, 19:02
aggreed. At larger frame sizes especially AVC exhibits a strong advantage IMHO


Strong ? How strong... is it worth the huge time difference to encode in AVC ?
With Cyberlink power encoder, the process is relatively fast but I cannot manage to get AAC / AC3 audio with the tool.

I tried to encode using x264 + MeGUI, but it is so slow, it is not viable (< 1fps most of the time)

My system: Athlon X2 3800+ OC
Original content: .ts file / 1920x1080i / AC3 5.1
Destination content: .mp4 / 1920x1080 / x264 2 pass / AAC 5.1

I am willing to try AVC as long as the encoding does not take forever, maybe its me who does not understand how to speed up the process...

thanks for your time,