Log in

View Full Version : mpgeg2 to h264 preserve quality


fenomeno83
1st July 2016, 03:54
Hello.
I have an mpeg2 video (about 2/2.30 hours), with a final size of about 26GB!
I need to reconvert it in h264..
Basically i use Handbrake
What settings do you suggest to reduce final space (in 4GB??) and preserve quality?
I can make 2-3 pass, slow settings..no problem..

Thanks

manolito
1st July 2016, 13:13
First of all there is no way to completely "preserve quality" when you are transcoding from one lossy compressed format to another one. There will always be some degradation, the question is if it will be visible.

The preferred encoding method for H.264 is CRF (Constant Rate Factor). The downside is that you have no control over the output size, i.e. the output quality will be about the same, but depending on the source characteristics the size will fluctuate.

If reaching an exact output size is important you need to select "Average Bitrate" and use 2 passes. In Handbrake the settings of the High Profile are optimized for quality already. Using an average bitrate of ~1300 kbps or higher should result in a good quality conversion (I am talking about DVD compatible frame sizes of 720 x 480/576).

For CRF encodings my preferred CRF value for MPEG2 sources is 20 (determined after many tests). You should not go higher than 23, and lower than 18 is overkill in most cases. For audio Handbrake only offers CBR conversions, and the current version does not have the Fraunhofer codec any more. For stereo you should not go lower than 160 kbps with the native FFMpeg AAC encoder (do not use faac).

You should also use the "Tune" option according to your source characteristics.

Other things to consider are the Profile and Level you are using. This has a big influence on playback device compatibility. I use the High Profile@Level 4.1, but some portable devices will not play these files.


Cheers
manolito

fenomeno83
1st July 2016, 16:18
thank you very much.

My source is 1080p, so I need to return an h264 1080p output file.
So i think to use CRF 20.
But, if I use an average bitrate, what bitrate do you suggest for 1080p video?


About profile, to have better compatibily, i need to use Main profile, right?

About x264 tune, can I use film mode? (source video is recorded from camcorder tapes, during a musical concert in a theatre; then I passed video into digital file(mpeg2 format)).

At last can I use x264 preset to "Placebo?" (it not influences the final size, but just quality, right)?

Thanks!!!!!

Ghitulescu
1st July 2016, 17:01
2-2:30 h in 4GB?
That's a bit too aggressive for 1080p.

fenomeno83
1st July 2016, 17:24
Ok..maybe 4GB is not enought..but my purpose is reduce the 26GB input file

microchip8
1st July 2016, 17:35
Ok..maybe 4GB is not enought..but my purpose is reduce the 26GB input file

I use CRF 18 here and from all my encodes I've done, 1080p usually comes out (depending on movie) at 5-15GB

If you need to save more, just increase the CRF until you can spot a visible difference, then go 1 CRF below the visual difference. So if you see difference at say CRF 24, and not at 23, use 23 to encode

The good thing about CRF is that if you standardize on a specific value for all your encodes, all your encodes will have roughly the same quality

When you go the bitrate route, first it's difficult to predict which bitrate will be optimal for a specific movie. And that same bitrate may be not enough on another movie or may be too much for it. But to hit a target file size, you NEED to use a bitrate-based pass (like 1- or 2-pass). CRF does not allow that

fenomeno83
2nd July 2016, 08:38
Thanks!
What about handbrake x264 presets placebo and x264 tune film mode(considering video recorder during musical)?
Thanks

Sharc
2nd July 2016, 08:55
Placebo is a waste of time without any real benefit (therefore its name).
Tuning and settings: Why don't you make a short test encode and judge yourself what you like best, and where you spot a difference?

benwaggoner
6th July 2016, 00:41
About profile, to have better compatibily, i need to use Main profile, right?
No, use High Profile. I don't know of any H.264 decoder than could do 1080p and not with High Profile. And the efficiency/quality advantages of High go up with frame size.

Also, how is the source quality? 1080p 2.5 hours at 26GB really isn't that high a bitrate. If you have any blockiness in your source, you might want to use a deblocking decoder before encoding into H.264. It can look better, and also compress quite a bit smaller.

fenomeno83
6th July 2016, 08:15
Thanks!!source is good..and not 2.5hours, but 1h45m..
High profile and what level?4.1?

and another question about audio: my source is mpeg 48KHZ 2 channel..handbrake set by default mixdown on dolby prologic II..is it a good choise? Thanks

manolito
6th July 2016, 16:30
AFAIK this setting is for MIXDOWN of multi-channel sources to stereo. If your source already is stereo, no mixdown will take place at all.

benwaggoner
6th July 2016, 21:23
AFAIK this setting is for MIXDOWN of multi-channel sources to stereo. If your source already is stereo, no mixdown will take place at all.
And you definitely don't want to add ProLogic flags unless your source is really ProLogic (which isn't very likely).

I'm not sure why you'd use Dolby codecs in this scenario unless you wanted to use dialnorm or something. AAC-LC sounds great at lower bitrates, and is more broadly compatible.

benwaggoner
6th July 2016, 21:24
Thanks!!source is good..and not 2.5hours, but 1h45m..
High profile and what level?4.1?
Unless your fps >30, I'd use Level 4.0 for broader compatibility. For most content with reasonable settings, 4.0 is more than ample.

pandy
17th July 2016, 11:03
I'm not sure why you'd use Dolby codecs in this scenario unless you wanted to use dialnorm or something. AAC-LC sounds great at lower bitrates, and is more broadly compatible.

Nope - sadly i must say that AC-3 is currently most popular relatively modern audio codec supported by SW and HW.
First it is well standardized (also accepted for terrestrial broadcast for example in Europe - my heart crying on this but AAC lost from unknown reason despite being designed in Europe).
Second is one of basic codecs supported in digital audio (S/PDIF) and video (HDMI) interfaces AC-3 market penetration is enormous and customer pay multiple licensee fees of this - good for you Dolby...