Log in

View Full Version : Need help with DVD to x264


Thalyn
11th June 2013, 16:40
I realise this has probably been asked before. And before that. And probably again before that. But searching for said askings and their answers has proven fruitless, so I'm going to ask and risk the combined wrath of the long-timers.

I've been converting my movies for storage on a NAS using VidCoder (a front-end for Handbrake, for those unfamiliar with it). After finishing some 228 BluRays (including 25 3D encodes) it's time to start work on the ~312 DVDs. Problem is, I'm having no luck finding encoding settings that I'm satisfied with, much less happy with.

Currently, I'm playing around at CRF17 with the following advanced settings: no-fast-pskip=1:nr=100:ref=6:bframes=6:b-adapt=2:direct=auto:me=umh:subme=10:merange=24:analyse=all:trellis=2:aq-strength=0.5:psy-rd=1.0,0.05:no-dct-decimate=1:deblock=0,-1

This is taking around an hour per disc and producing "watchable" results, but the resulting filesize coupled with the disappointing output leads me to think I could be doing better with less. For example, Police Academy 1, with its mono audio, is currently looking like it's going to be around 2.5GB when it finally finishes for a final data rate of around 3.8Mbps. The original is 4.2GB with multiple languages and subtitle tracks, so something seems really wrong to me.

I understand that increasing the CRF will lower the filesizes. The problem is that it doesn't help the appearance any, and the same things which currently bother me - edge distortion (particularly on subtitles) and blotches coming and going - will persist, and likely get worse if nothing else has changed.

Are there any hints, tips or tricks people can offer for someone in my position? Time should be considered a non-issue, but I'd rather not triple the time for a 2% better transcode. I'd also like to stick with Handbrake/Vidcoder just for simplicity if possible.

Groucho2004
11th June 2013, 17:35
For example, Police Academy 1, with its mono audio, is currently looking like it's going to be around 2.5GB when it finally finishes for a final data rate of around 3.8Mbps. The original is 4.2GB with multiple languages and subtitle tracks, so something seems really wrong to me.
Such an old movie probably has a lot of grain and the encoder tries to preserve it which leads to very high bitrates. Try some de-noiser like MCTemporalDenoise().

benwaggoner
11th June 2013, 22:41
Currently, I'm playing around at CRF17 with the following advanced settings: no-fast-pskip=1:nr=100:ref=6:bframes=6:b-adapt=2:direct=auto:me=umh:subme=10:merange=24:analyse=all:trellis=2:aq-strength=0.5:psy-rd=1.0,0.05:no-dct-decimate=1:deblock=0,-1
Any reason you're specifying so much stuff? I'd probably stick with --tune film --crf 18 --preset veryslow.

This is taking around an hour per disc and producing "watchable" results, but the resulting filesize coupled with the disappointing output leads me to think I could be doing better with less. For example, Police Academy 1, with its mono audio, is currently looking like it's going to be around 2.5GB when it finally finishes for a final data rate of around 3.8Mbps. The original is 4.2GB with multiple languages and subtitle tracks, so something seems really wrong to me.

I understand that increasing the CRF will lower the filesizes. The problem is that it doesn't help the appearance any, and the same things which currently bother me - edge distortion (particularly on subtitles) and blotches coming and going - will persist, and likely get worse if nothing else has changed.

Are there any hints, tips or tricks people can offer for someone in my position? Time should be considered a non-issue, but I'd rather not triple the time for a 2% better transcode. I'd also like to stick with Handbrake/Vidcoder just for simplicity if possible.
If the artifacts are in the source, better compression will just give you a more accurate reproduction of those artifacts. What you need to do is reduce those artifacts in preprocessing prior to encoding.

I think Handbreak can turn on MPEG-2 deblocking and perhaps deringing, ala dgdecode. cpu=4 does a good job of reducing block artifacts (at the cost of some detail), and cpu=6 reduces blocking and ringing (at the loss of quite a lot of detail). These also progressively reduce bitrate at a given CRF, because you aren't spending bits trying to encode either the artifacts or the other details that are getting removed. I bet your ABR drops in half at least if you use cpu=6. You may well decide that the quality loss isn't worth it for most content, however.

It's very hard and quite labor intensive to get good quality results out of sources that already have visible encoding artifacts.

Thalyn
12th June 2013, 02:43
Groucho: I'll have to look into denoising more thoroughly, though I guess that would mean needing to switch to MeGUI (or similar) instead of Handbrake, yeah?

Any reason you're specifying so much stuff? I'd probably stick with --tune film --crf 18 --preset veryslow.

Experimentation with my BluRay transcodes, mostly:

The P-skip and Decimate are simply for maximum retention. It's probably only a very, very minor difference, but it did help (slightly) with banding so I've kept it.

The 6 B-frames was because that seems to be the useful limit. The 5th frame still tends to have very high usage (normally over 30%) but the 6th is down near 1%, and my "+1" approach lead me to use 6. This goes in tandem with the B-adapt of 2.

Direct, Analyse, ME, SubME and MERange are all pretty straight forward time-for-compression tradeoffs, with the trellis being required for SubME 10. My understanding is that these really don't have any noticeable effect on the output quality - just its size. Of course, there's every chance I'm wrong here and just don't know it.

Deblock, AQ and Psy settings are mostly "shot in the dark" things. I've been almost arbitrarily assigning them in the hopes of finding the "Sweet spot" since they seem to have the most obvious impact on the output quality. The only thing I know for certain is that lowering the AQ seems to help edges at the expense of flat areas.

NR is in hopes of taking the "edge off," so to speak. Mostly for consistency in the output and to help reduce dancing noise, along with the encode size. The BluRays were showing up to a 10% reduction in filesize with no perceivable loss in quality with the same, so I left it.

And the 6 reference frames is simply to ensure that the output remains as a High profile level 3.1 file.


Curiously, is there any more you can tell me about this "CPU" flag?

SamNeal2001
12th June 2013, 12:51
My personal experience has been strictly encoding DVDs to x264.

Your results sound correct.

At crf17 on SD content you can expect bloating to begin on grainy/noisy sources. Whether that bloating results as better quality to your eyes is the question.

But, regardless of how much you're gonna mess with the settings, you will never find anything acceptable to YOUR EYES.

You also have to consider how much time wasting it is to try and make an already encoded source (MPEG-2 DVD) look perfect. Not worth it.

So really, just use: --preset veryslow --tune film --crf 18 --level 3 and you life will be much happier.

crf 18 will help with bloating. Most DVDs will be in the 1500 to 2000 range. A few will end up in the 3000s.

I have thrown my entire DVD collection to that commandline with great success.

Groucho2004
12th June 2013, 13:05
Groucho: I'll have to look into denoising more thoroughly, though I guess that would mean needing to switch to MeGUI (or similar) instead of Handbrake, yeah?
Sorry, I don't know what the various GUIs can or cannot do, never used one.

Guest
12th June 2013, 13:29
Curiously, is there any more you can tell me about this "CPU" flag? Refer to the filter syntax for MPEG2Source() in this document:

http://neuron2.net/dgmpgdec/DGDecodeManual.html

Thalyn
12th June 2013, 15:45
Cheers, folks.

Sam, I'm starting to think you could be right there. I'll have a bit more of a play with the other suggested AVISynth plugins but it seems more and more like I'm aiming for the impossible. Perfect isn't really what I'm after, but visual transparency is becoming more trouble (and space) than it's worth.

SamNeal2001
12th June 2013, 17:47
I'd suggest checking out the latest handbrake as they finally put the x264 presets inside their panel. This makes create quality rips more brainless and painless then ever before (as it should be).

http://forum.doom9.org/attachment.php?attachmentid=13552&stc=1&d=1371055568

Thalyn
13th June 2013, 08:04
Ugh... why is the Mac UI so much more refined than the Windows one? I probably wouldn't have even found VidCoder if the Win one was like that. Sure, I can understand a few differences due to default formatting and such, but the Win one doesn't show you jack-all about what the presets do, what actual cropping is in use and so forth. It's actually interesting to see how close the settings I've been experimenting with match the Film tune et al.

By the way, I appreciate your time on this, folks.