View Full Version : Which Megui x264 profile would suit my needs?
MaxPlanck
19th October 2006, 02:57
I've been using the "insane" profile for the last couple of weeks. I've been very satisfied with the quality, but it takes an unbelievable amount of time for me to do a full length movie. Could someone that's been playing around with the profiles for longer reccomend a profile that could give me excellent quality but with a substantially less encoding time. It takes like 15 hours for me to do a movie with Insane.
arfster
19th October 2006, 03:50
There's very little difference in quality between the various HQ settings. I seem to recall the difference between Slower and Slowest is something like 0.3 average SSIM, which is peanuts. Insane probably makes even less difference.
unskinnyboy
19th October 2006, 04:10
Here is an idea - try out the different profiles for yourself and arrive at your own decision. It is impossible to give a definite answer to questions like these because "excellent quality" is subjective and also there are many variables here (length of the movie, type of the material, resolution, audio,..blah blah).
Oh, and remember - quality always takes time. The vice versa is not always true.
MaxPlanck
20th October 2006, 05:21
yeah I know, I should try different profiles. I like to hear what other people think though despite the fact that quality is subjective. I just thought maybe there was profile that everyone used which balanced speed and quality. I'll try out slower and see what I come up with.
DDogg
20th October 2006, 18:12
hi, MaxPlanck - A big part of doing a good encode is making sure you allocate enough bitrate to contain the complexity of the source (kind of what unskinnyboy was saying). If you don't allocate enough bitrate for the particular source, it does not matter what profile you use.
One way to bring yourself up to speed on that subject is to do a few test encodes using the CQ-ASP_Q2_eq(crf) profile. It uses a preset crf of 18. You will need to do the test so as to be able to see the command window after the encode is finished (add a "pause" to the end of the batchfile perhaps). Note the last line: "encoded xxxxx frames, 11.12 fps, 1617.83 kb/s"
Not an exact science of course, but generally you will want to check that you allocated at least that amount of bitrate for your 2 pass encode if you want an rough approximate quality to crf 18. You might want to play around with changing the crf value up to to 22 to get a smaller encode if that is important to you. The quality will go down some, but it may work for you.
You can shorten that test encode to just a few minutes by adding a temporary "SelectRangeEvery(600,12)" at the end of your script. This is a quick, though not exact method to get a general idea of where you need to be, bitrate wise, to deal with the complexity of the source.
To give you an example how complexity effects the bitrate needed, here is a snip of data from a data sheet I am working on at the moment. Btw, src3 is Matrix1 which is fairly easy to compress, and src4 is SPR which is very, very difficult to compress.
Kbps Src1 Src2 Src3 Src4
Q18.0.mp4 1,406 961 1,231 2,963
Q18.1.mp4 1,385 942 1,209 2,916
Q18.2.mp4 1,366 927 1,184 2,877
Q18.3.mp4 1,346 916 1,161 2,835
Q18.4.mp4 1,326 898 1,139 2,786
Q18.5.mp4 1,307 888 1,116 2,743
Q18.6.mp4 1,288 875 1,093 2,703
Q18.7.mp4 1,268 863 1,072 2,664
Q18.8.mp4 1,249 848 1,051 2,623
Q18.9.mp4 1,231 836 1,033 2,584
Q19.0.mp4 1,211 823 1,012 2,542
So, you can see that no 2pass profile can deal with src4 if enough bitrate has not been allocated in the first place, while src2 requires much less bitrate than one would think to achieve an rough approximate crf 18 quality.
I am assuming you want to hit a size target? If not, you may find the full 1-pass crf encode is all you need. You have to judge that.
MaxPlanck
20th October 2006, 20:36
I do want to hit an exact file size if I can, but truthfully quality is more important to me. I'll try out your reccomendations and see what I come up with, thanks.
DDogg
20th October 2006, 21:11
I do want to hit an exact file size if I can, but truthfully quality is more important to me. I'll try out your reccomendations and see what I come up with, thanks.When you set up your size target, say 2 cd's, check that the bitrate calculated to hit 2 cd's is close to the value you obtained with the quick crf test. Just guesstimating at this stage, but personally I would go ahead with the encode on the 2 cd's even if your bitrate is lower, up to around 5% lower, because the 2 pass is going to do a little better job with the bitrate and the prediction seems to always be a little high when doing the 2% snip.
That should be a decent rule of thumb that errs to the quality side. If not, simply add a slice - In this case a 3rd cd. At that stage you most probably will be using a bitrate higher than the test crf pass, which is cool, and just means the quality will be even better.
You may also find you don't need one of those super slow 2 pass modes since you have allowed an adequate amount of bitrate to work with. Your call. Let us know what you see. Good luck.
Dayvon
20th October 2006, 21:21
I've found that if you are resizing, the end resolution of your file combined with the average bitrate of your 2-pass encoding are really what most determine your quality. In other words, if you set a 720x368 resolution size, a 700MB with a 2-pass x264 encode that will average a bitrate under 1000kbps, you will see quality issues. However, if you do an encode at about 640x352 resolution size, a 700MB with a 2-pass x264 encode that will average a bitrate about 1200kbps, you will end up pretty happy.
I've found that these factors (resolution and file size) matter MORE than the high-specific settings (such as b-frames, RDO, etc). Your bitrate MUST be high enough on average or you will not get a good quality.
I have found that for great quality with x264 on [640-720]x[320-480] resolutions, you need at least about 1100kbps. But thats just me.
DDogg
20th October 2006, 22:01
Dayvon, while it may seem so to you, you can't generalize about bitrate as every source has a unique requirement. The reason you may feel what you said is correct is more a matter of most commercial dvd's tend to fall within a similar complexity range by the nature of their production.
The confusion arises because their complexity range accidentally or coincidentally tends to fit within many of the bogus, generalized, and incorrect bitrate statements made by some. This is the reason this complete myth keeps propagating itself and causes so much confusion for people newer to encoding.
Add: Note the chart above and see how src 1,2,3 could comfortably fall inside your assumption thereby maintaining the myth, while source 4 is completely outside the envelope you mentioned.
Dayvon
22nd October 2006, 02:46
You are right DDogg. I definitely won't fight with you on your points. However, what I stated was what I use as a general rule of thumb for a lower limit. I agree that for true quality encoding, your methods do work quite well. When you focus more on reasonable size as opposed to source-matching quality, though, it kinda throws the facts out the window. I tend to like my x264 files at around 1GB on my hard drive. So there is no way that I would encode SPR, a 3 hour movie, at 2,800kbps, which would equate to a 3.7GB file.
I'm picky about quality, but not tooo picky. I figured I'd throw a quick bone in about my general experienc for reasonable quality encodes on average retail DVDs. Your scientific way of accuracy has me beat and it is the best way, but for some of us (like me) I just don't care enough to go that far.
MaxPlanck
22nd October 2006, 14:30
ddogg, I'm glad you showed me an example for SPR because that happens to be the very movie that I'm doing next.
DDogg
22nd October 2006, 16:03
Dayvon, sorry for what may have seemed a semi-rant. Was not really targeted at you as it may have appeared, more the frustrating myth. SPR is unusual anyway.
It is an interesting exercise though. To be more constructive, I wondered what would be a workable solution for your spec of ~ 1g filesize for SPR. Ran 2 samples of SPR with a lowered resolution of 480 X 256 unfiltered:
crf 18 - 38,704,750
crf 18.1 - 38,212,804
Look at the attached tool sheet where these numbers have already been input - note that Q22.0.mp4 is not too far off.[]
Then, 2 more sets using filters were run. This is a touchy area when encoding SPR because altering the grain alters the directors original artistic idea. Still, for discussion purposes only, input these numbers into the tool sheet and note the bitrate changes:
crf 18 - 36,644,857 - RemoveGrain(mode=2)
crf 18.1 - 36,163,617 - RemoveGrain(mode=2)
Then this heavier filter:
crf 18 - 32,986,779 - FFT3DFilter(sigma=3)
crf 18.1 - 32,597,084 - FFT3DFilter(sigma=3)
Note that Q20 now shows a bitrate of 1,023 and a predicted size of 1,300,429,254. Actual size would be at 5-15% smaller. Not too far off your spec.
Dayvon
22nd October 2006, 21:50
DDogg -
I totally agree with you about the grain issues that can crop up with too much compression on certain sources. I find that some movies, especially older movies that haven't been cleaned up, suffer from this. I noticed that I needed a crazy high bitrate on "Superman - The Movie" to get a reasonable quality encode. There are a few others that I recently enocded that I particularly wish I had given a bit more bitrate for grain purposes (The Princess Bride and Top Gun). But all in all, I was able to enjoy these movies with the encode I had, so I didn't re-encode. Alot of this depends on whether you want your encodes to be "back-ups" of your collection, or just conveniences. For me, it's hard drive HTPC access convenience so quality takes a step back from the quality goal.
Anyways, I think I get what you are saying to do, but could you put a sample code for how to do this? A x264 cmd line with the CRF mode you are recommending would be nice. Also, a sample script with the lines for bitrate sampling a source would be great. I'm not a noob, but I don't know what a script to do what you speak of would be or look like. I would gladly take 2-15min to know what kind of bitrate I should look for in each of my encodes. Anyway thanks for the help/info!!
DDogg
22nd October 2006, 23:04
Scroll down to the bottom of the sheet and you should see the commandline. Still not sure if all the options are the best suited for this purpose. It is the stock CQ-ASP_Q2_eq(crf) command line from MeGUI. The script was also generated by MeGUI. I added the SelectRangeEvery(600,12) to the bottom of that script being used for the sample.
Normally I put the 2 commandlines using crf 18.0 and 18.1 in notepad then save it as mytest.bat and run it. Does not take very long to do two 2% samples. Like you said, taking a few minutes up front can save hours on the backside.
Remember, the final size prediction is not exact. However, if you do a sample and then compare it with a sample using a filter or matrix change, the difference between the two samples, percentage wise, will be a near exact indicator of the difference between the final filesizes if you were to remove the select line and do a full encode using both scripts. Kind of confusing I guess :)
You might want to grab the full zipfile in the dabr thread. It has some more information and you might be the second person to download it :rolleyes:
Here is the commandline I used.
C:\apps\x264.exe --crf 18.0 --ref 3 --mixed-refs --bframes 3 --b-pyramid --b-rdo
--bime --weightb --filter -2,-1 --subme 6 --trellis 1 --analyse all --8x8dct
--vbv-maxrate 25000 --me umh --threads 2 --thread-input --progress --no-psnr
--output "D:\SPR_Out\Q18.0_2pct.mp4" "D:\SPR_Out\movie.avs"
Dayvon
23rd October 2006, 00:46
I added the SelectRangeEvery(600,12) to the bottom of that script being used for the sample.
Here is the commandline I used.
C:\apps\x264.exe --crf 18.0 --ref 3 --mixed-refs --bframes 3 --b-pyramid --b-rdo
--bime --weightb --filter -2,-1 --subme 6 --trellis 1 --analyse all --8x8dct
--vbv-maxrate 25000 --me umh --threads 2 --thread-input --progress --no-psnr
--output "D:\SPR_Out\Q18.0_2pct.mp4" "D:\SPR_Out\movie.avs"
So just do my normal thing, add the script "SelectRangeEvery(600,12)" to my AVSScript, select the CQ-ASP_Q2_eq(crf) preset, and run it?
Will try this soon! (Maybe tonite)
EDIT:
Flippin' A!!! This is amazing! Best deal I've seen yet for finding a good bitrate. Shoot, I wish I had know of this earlier. Thanks much DDogg!!
DDogg
23rd October 2006, 19:11
DL this (http://files.project357.com/uploads/index.php?dir=&file=quick_CRFSample_bat.zip/) small batch file and let me know if it is helpful to you. Put it on your desktop and drag your sample avs onto it. You should end up with 2 sample files in the same directory as the avs. Remember to edit the batchfile with notepad and make sure both commandlines point to where you have x264.exe [also make sure you have x264.exe build r591 or higher]
Dayvon
24th October 2006, 05:17
My file structure isn't getting recognized...Thanks anyway, but using MeGUI and making a couple profiles to que up is doing the same thing for me. I totally am liking this method though. It really helps, and I've run quite a few tests looking at how resolution and options/features of x264 really do affect the bitrate needed for the identical quality. This also will probably help me with hitting approximate file sizes doing only a 1-pass CRF. Very good. 2-pass is gonna go bye bye :D!!
Teemo
9th November 2006, 01:11
:thanks: Thanx DDog for this great little tool. Guess I must be the 3rd to dl it :-)
I do a lot of encodes from satellite .ts rips. The tool is perfect for this. I did however make a few adjustments to make it more accurate (at least with my samples). Changed the Q-samples from 18.0/18.1 to 18.0/20.0 and SelectRangeEvery(600,12) to SelectRangeEvery(1250,25). And added a few more .bat files to make life easier. Sample % is calculated from actual # of frames in the samples. Size of Audio and Subs can be entered as well as desired filesize.
Files and functions are explained in the xl-file.
Cheers
DDogg
9th November 2006, 23:41
Look forward to seeing checking it out when approved. It takes several days normally. Thanks.
Teemo
10th November 2006, 19:55
If Excel ask if you want to run macros, just say no - they are not used. I used some macros while editing and I don't know how to get rid of them again.
chros
12th November 2006, 21:35
I have tried the HQ-Insane and the HQ-Slower profile with the same conditions and HQ-Insane has produced with 2MB smaller filesize (93MB) then HQ-Slower (95MB)
- source 720p MPEG2 trailer 1min 45 sec
- at the profile setting I change 2-pass to Const. Quality and set 18
What does it mean?
Can I gain better quality with smaller filesize with HQ-Insane?
Thanks
Sharktooth
13th November 2006, 03:22
Insane compression settings will rise the compression... so you get smaller files at a given quantizer.
While if you use 2 passes the filesize will be the same but the average quantizer will be lower so you will get better quality (theoretically speaking)...
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.