PDA

View Full Version : x264 Encoding: DXVA vs Unrestricted


FraGTaLiTy
18th December 2009, 19:40
When encoding 1080p, is using DXVA a necessity? Or can people generally play back 1080p x264 encodes using their CPU these days?

I'm thinking about using x264 Unrestricted insane, then changing the config to "constant quality" and encoding at value "20". This for a 1080p video I made.

Should I use x264 DXVA Insane instead?

Thanks guys.

Cyber-Mav
18th December 2009, 19:48
it depends on your targetted playback device.

main playback devices i have are westerndigital WDTV and computers equipped with nvidia purevideo 2 or higher. so i used to use the dxva profiles. but i see these days if i keep reference frames at 15 or less then all videos playback fine on the hardware i use. only 1 machine with a 4 series ati card has playback issues but i going to replace that with cuda capable card now.

nurbs
18th December 2009, 19:48
People can play it if they have a fast CPU. Most multicore CPUs should be able to play it, even the slower ones if you use a multithreaded decoder. With single core CPUs I'm not sure. The main advantage unrestricted has is more reference frames (up to 16). For maximum hardware compatibility you shouldn't exceed 4 at 1080p although I believe nvidias decoder can handle more (maybe only if you use CUDA). Personally I don't think the quality gain is worth losing hardware compatibility.

FraGTaLiTy
18th December 2009, 19:54
People can play it if they have a fast CPU. Most multicore CPUs should be able to play it, even the slower ones if you use a multithreaded decoder. With single core CPUs I'm not sure. The main advantage unrestricted has is more reference frames (up to 16). For maximum hardware compatibility you shouldn't exceed 4 at 1080p although I believe nvidias decoder can handle more (maybe only if you use CUDA). Personally I don't think the quality gain is worth losing hardware compatibility.

"Constant Quality" revolves around a set quality of compression. The variable is the size. If I were to use "20" for both DVXA and Unrestricted, will the only difference be the file size since Unrestricted is more efficient in terms of quality per MB? Or will the Unrestricted still look better, even with the same CQ value?

Cyber-Mav
18th December 2009, 20:01
here is a list of levels and how many reference frames you can use to have compatability: http://en.wikipedia.org/wiki/H264#Levels

i thin knvidia cards are level 5.1 compliant. although im going to test this out by doing a quick 4 min video encode at 1080p res using 16 reference frames and see if it plays back using coreavc cooda.

nurbs
18th December 2009, 20:06
Constant quality mode gives you constant quality for a certain set of options. Slower options give you better quality per bitrate, but you can't tell if the file will come out larger or smaller. You could even get a little less quality with slower options if the filesize decreases to much.

FraGTaLiTy
18th December 2009, 20:25
Constant quality mode gives you constant quality for a certain set of options. Slower options give you better quality per bitrate, but you can't tell if the file will come out larger or smaller. You could even get a little less quality with slower options if the filesize decreases to much.

Would it be plausible to assume that DXVA Insane profile with Constant Quality "20" would be the same quality as Unrestricted Insane with Constant Quality "20", except that the DXVA will be bigger in size?

nurbs
18th December 2009, 20:27
No. The insane profile could be bigger and better quality, same size and better quality, smaller and better quality, smaller and same quality or smaller and worse quality (hope I didn't leave anything out).

FraGTaLiTy
18th December 2009, 20:30
No. The insane profile could be bigger and better quality, same size and better quality, smaller and better quality, smaller and same quality or smaller and worse quality (hope I didn't leave anything out).

Thanks, but Insane is available for both DXVA and Unrestricted, so the question is between DXVA and Unrestricted.

While we are on the topic, would it be better to stick with something other than Insane regardless of what profile I choose?

Thanks, you guys are helping me a ton.

Xavius
18th December 2009, 20:36
Thanks, but Insane is available for both DXVA and Unrestricted, so the question is between DXVA and Unrestricted.

While we are on the topic, would it be better to stick with something other than Insane regardless of what profile I choose?

Thanks, you guys are helping me a ton.

Talking about quality, is "placebo" better than "Insane"?

nurbs
18th December 2009, 20:40
@FraGTaLiTy
Sorry, but the same goes for DXVA vs. unrestricted. The quality difference probably won't be much anyway assuming it only uses more reference frames, but I can't tell for sure since I don't know what options those profiles use.
You should probably take a look at x264s built in presets (i.e. fast, medium, slow, placebo) and tunings (i.e. film, animation). You can view them by typing "x264 --fullhelp" (without the quotes) in a command line window when you are in the same directory as x264.exe. There are some GUIs that can use them if you are uncomfortable with command line. Basically if you only use a profile, a tuning and set the level to 4.1 you will have hardware compatibility.

I personally wouldn't use the slowest options since you sacrifice much speed for small quality gains. For instance going from --me umh to --me tesa can cost you 30% speed (maybe 20%; I tested it some time ago, but I forgot; don't quote me on that number) but gives you only a couple of percents quality gain if even that.

Anyway the presets I mentioned give you speed/quality tradeoffs and they were made by the x264 developers themselves so it's safe to assume the options that give you most quality gain compared to speed loss are picked first. So placebo probably gives better quality/bitrate, but again if you do a CRF encode it's hard to tell.

@Xavius: I don't know what insane uses, but I think this is one of Sharktooths profiles and they are pretty outdated. For instance placebo uses --subme 10, but --subme 9 was the highest when those profiles were last updated IIRC.

FraGTaLiTy
18th December 2009, 20:58
@FraGTaLiTy
Sorry, but the same goes for DXVA vs. unrestricted. The quality difference probably won't be much anyway assuming it only uses more reference frames, but I can't tell for sure since I don't know what options those profiles use.
You should probably take a look at x264s built in presets (i.e. fast, medium, slow, placebo) and tunings (i.e. film, animation). You can view them by typing "x264 --fullhelp" (without the quotes) in a command line window when you are in the same directory as x264.exe. There are some GUIs that can use them if you are uncomfortable with command line. Basically if you only use a profile, a tuning and set the level to 4.1 you will have hardware compatibility.

I personally wouldn't use the slowest options since you sacrifice much speed for small quality gains. For instance going from --me umh to --me tesa can cost you 30% speed (maybe 20%; I tested it some time ago, but I forgot; don't quote me on that number) but gives you only a couple of percents quality gain if even that.

Anyway the presets I mentioned give you speed/quality tradeoffs and they were made by the x264 developers themselves so it's safe to assume the options that give you most quality gain compared to speed loss are picked first. So placebo probably gives better quality/bitrate, but again if you do a CRF encode it's hard to tell.

@Xavius: I don't know what insane uses, but I think this is one of Sharktooths profiles and they are pretty outdated. For instance placebo uses --subme 10, but --subme 9 was the highest when those profiles were last updated IIRC.
Just realized the new MEGUI is different. I just updated; is it better than the old? I was working with 0.3.1.1051

edit. It keeps crashing during the encode :/ that's odd. What is this about command lines you say? Is this something you do without MeGUI? Are there better alternative GUI's for doing this?

nurbs
18th December 2009, 21:11
The newest megui builds can be found here (http://forum.doom9.org/showthread.php?t=151159). The guy developing them currently tries to get rid of all the bugs that are left.
Command line (http://en.wikipedia.org/wiki/Command-line_interface) is doing stuff by hand or with batch files, like in the good old days :rolleyes:. Takes time getting used to, but it has its benefits. I hardly ever use GUIs for video encoding, but I sometimes use megui for audio encoding and deinterlacing.

Blue_MiSfit
18th December 2009, 21:20
MeGUI is hopelessly broken with new builds of x264 (after 1100 something). We're currently on rev 1376. The quality and usability improvements between that and rev 1051 is absolutely HUGE :D Also, the old MeGUI profiles are quite useless with the new x264 presets, profiles, and tuning system

I'd suggest a new GUI - like Lord Mulder's simple GUI (which also automagically handles avs2yuv and pipes between 32 bit avisynth and 64 bit x264 :D)

When encoding, I usually use this awesome tool, with a very simple profile.

Example (for 1 pass CRF, high quality, DXVA / HP @ 4.1 compatibility)


x264.exe --preset slower --tune film --crf 20 --level 41 --vbv-maxrate 62500 --vbv-bufsize 62500 --output "movie.mp4" input.avs


This lets you adjust the speed preset and tuning, and get the benefit from slower settings without worrying about overrunning the max references / DPB size allowed by level 4.1. VBV with CRF actually works very well now, so there's no need for 2 pass encoding unless you're targeting a specific bitrate. 1 pass CBR is actually just as good as 2 pass CBR now - which is very cool for us folks encoding streaming video ;)

EDIT:
It looks like someone has actually continued MeGUI development, and is trying to make it work properly with the new x264 preset system. That's awesome for folks who still want to use MeGUI! Hooray!

~MiSfit

FraGTaLiTy
18th December 2009, 21:27
The newest megui builds can be found here (http://forum.doom9.org/showthread.php?t=151159). The guy developing them currently tries to get rid of all the bugs that are left.
Command line (http://en.wikipedia.org/wiki/Command-line_interface) is doing stuff by hand or with batch files, like in the good old days :rolleyes:. Takes time getting used to, but it has its benefits. I hardly ever use GUIs for video encoding, but I sometimes use megui for audio encoding and deinterlacing.
Thanks man.
x264 Unrestricted (DXVA)? Sounds interesting.

nurbs
18th December 2009, 21:29
I didn't say anything about unrestricted. If you want hardware compatibility you'll have to live with some restrictions. They are not that bad in my opinion.

FraGTaLiTy
18th December 2009, 21:42
I didn't say anything about unrestricted. If you want hardware compatibility you'll have to live with some restrictions. They are not that bad in my opinion.

It's a new preset in the .1059 version you linked me too. "x264 Unrestricted (DXVA) Very High Quality. I was really surprised when I saw it; as I didn't know Unrestricted could support DXVA.

prOnorama
18th December 2009, 21:57
x264.exe --preset slower --tune film --crf 20 --level 41 --vbv-maxrate 62500 --vbv-bufsize 62500 --output "movie.mp4" input.avs


Actually the value for L 4.1 maxrate is 50000 according to Wikipedia and this page (http://rob.opendot.cl/index.php/useful-stuff/h264-profiles-and-levels/)

Also --preset slower sets --partitions all and I was under the impression that p4x4 can brake DXVA compatibility in some (rare) cases. At least the old MeGUI DXVA profiles specified: --partitions p8x8,b8x8,i4x4,i8x8. (Which is the default setting for x264 now but --preset slower overrides it).

This is --preset slower (from x264 --fullhelp):

- slower --b-adapt 2 --direct auto --me umh
--partitions all --rc-lookahead 60
--ref 8 --subme 9 --trellis 2

So I would use:

x264.exe --tune film --crf 20 --level 4.1 --b-adapt 2 --direct auto --me umh --rc-lookahead 60 --subme 9 --trellis 2 --vbv-maxrate 50000 --vbv-bufsize 62500 --output "movie.mp4" input.avs

Which is almost the same except for the vbv values, no --partitions all and --ref can be higher than 8 (handled by the --level 4.1 switch)

Dark Shikari
18th December 2009, 22:01
Actually the value for L 4.1 maxrate is 50000 according to Wikipedia and this page (http://rob.opendot.cl/index.php/useful-stuff/h264-profiles-and-levels/)Wrong, that's for Main Profile.
Also --preset slower sets --partitions all and I was under the impression that p4x4 can brake DXVA compatibility in some (rare) cases.Also wrong.

FraGTaLiTy
18th December 2009, 22:59
http://img15.imageshack.us/img15/2150/wtfgs.jpg

This is getting agitating :/

Dark Shikari
18th December 2009, 23:03
Without a backtrace I can't do anything, not even determine whether it was x264 that failed or your video decoder/Avisynth filters.

FraGTaLiTy
18th December 2009, 23:09
Without a backtrace I can't do anything, not even determine whether it was x264 that failed or your video decoder/Avisynth filters.

I'm trying it again at "normal" speed instead of slow; if the same thing happens I'll post the log.

Dark Shikari
18th December 2009, 23:15
I'm trying it again at "normal" speed instead of slow; if the same thing happens I'll post the log.A log isn't sufficient. Without a debug backtrace using a debugger and a debug build of x264, there is absolutely no way of knowing what crashed.

FraGTaLiTy
18th December 2009, 23:18
http://img709.imageshack.us/img709/932/logz.jpg

FraGTaLiTy
18th December 2009, 23:28
A log isn't sufficient. Without a debug backtrace using a debugger and a debug build of x264, there is absolutely no way of knowing what crashed.

I'm not sure how to do that. I got "x264 Revision 1376" from the site. Windows just crashed this time during the encode.

prOnorama
19th December 2009, 01:16
Wrong, that's for Main Profile.
Also wrong.

OK maybe my info is outdated so it's safe to use p4x4 for maximum DXVA compatibility without problems (I thought ATI cards could have problems with this and I might switch to an ATI card soon)?

So what are the allowed vbv values for the High profile @ level 4.1?

quantum5uicid3
19th December 2009, 02:25
the megui DXVA preset was made on the assumption that previous decoding limitations have been solved by driver fixes. correct me if i'm wrong, but my 9600gt plays unrestricted h264 using dxva np.

AiDz0r
19th December 2009, 04:51
I guess im getting the same thing.

Blue_MiSfit
19th December 2009, 05:56
@p0rnorama:

My values of 62500 were straight from the Wikipedia entry for High @ 4.1 :)

Not sure about the buffer size, but I assume 1 second

~MiSfit

prOnorama
19th December 2009, 06:45
You are right Blue_MiSfit, 62500 is for L. 4.1 @ High Profile indeed. I think I'll just stick to --vbv-bufsize 50000 --vbv-maxrate 50000 should be overkill for 720p @ max. 8000 Kbits avg. and plenty for 1080p @ max. 15000 Kbps average I think.

Snowknight26
19th December 2009, 07:34
Better yet, don't use VBV if you're wanting DXVA compatability.

prOnorama
19th December 2009, 08:14
Hmmm, a bit confusing these values were always present in the MeGUI DXVA profiles, but I guess they are outdated.
So setting VBV values is not needed for DXVA compatability? (just for BluRay and other devices I guess)