Processing UHD rips with Handbrake or other software

Please post here for issues related to UHD discs
preserve
Posts: 746
Joined: Sun Sep 13, 2015 10:21 pm
Location: Canada

Processing UHD rips with Handbrake or other software

Post by preserve »

Processing, converting, encoding, re-encoding, remuxing, etc - this seems to be a topic of interest that is occurring within some of the other threads, so I figured that a dedicated topic could be useful.

Here's a few things that were posted in other threads to kick this off:
preserve wrote:if you output HEVC/H265 (the codec used by UHDs), Handbrake does retain the Rec. 2020 HDR color space.
preserve wrote:Although both have the WCG 2020 color space, the original MakeMKV file has a pixel matrix of yuv420p10 while the Handbrake-converted MKV has a pixel matrix of yuv420p.
Woodstock wrote:the internal work path is only 8-bit, even on the nightly builds with 10- and 12-bit output support.
preserve wrote:I was seeing bitrate spikes of 65+ on Passengers (someone else mentioned in another thread that they were seeing as high as 78). Those are the parts my laptop was stumbling on. At other times, the bitrates can be quite low.

For a 2-pass VBR encode, Handbrake's average bitrate setting does not enforce a maximum - even with a low average, those high spikes were still occuring.

I was getting smooth playback results by using 25000 as the average bitrate and then adding the following settings manually into the provided input box: "vbv-maxrate=30000:vbv-bufsize=40000"
Using: ASUS BW-16D1HT 3.00
mike admin
Posts: 4075
Joined: Wed Nov 26, 2008 2:26 am
Contact:

Re: Processing UHD rips with Handbrake or other software

Post by mike admin »

On blu-ray, for h.264 each frame is encoded as 4 independent slices - this means that it is possible to decode any given frame using 4 parallel tasks. For HEVC each frame is encoded as 8 independent slices. Hardware decoders do take advantage of this, but to my best knowledge no open-source software decoder uses such acceleration. That's why a smart TV could easily play a high-bitrate HEVC from blu-ray, but could fail on much lower bitrate MKV from handbrake.
preserve
Posts: 746
Joined: Sun Sep 13, 2015 10:21 pm
Location: Canada

Re: Processing UHD rips with Handbrake or other software

Post by preserve »

Very interesting! Thanks for the info Mike, always appreciate it when you drop in with helpful knowledge!
Using: ASUS BW-16D1HT 3.00
Woodstock
Posts: 10380
Joined: Sun Jul 24, 2011 11:21 pm

Re: Processing UHD rips with Handbrake or other software

Post by Woodstock »

Also, make sure handbrake is set to "auto" for the "Encoder level" (x264 settings) or "Encoder profile" (x265 settings).

With x264 especially, if it is forced to too low of a level, it will tag the file as such, but other settings can make it exceed the maximum bit rate for the level. Some players will play it, others will call it a bad file.

I'm doing my first UHD encode now, because my current playback devices can't keep up with the full data rate of The Martian.
Low Winter Sun
Posts: 51
Joined: Thu Dec 28, 2017 11:51 pm

Re: Processing UHD rips with Handbrake or other software

Post by Low Winter Sun »

Nvidia Shield with Kodi or SPMC makes a great Media Center. No lag on playing H265 except at some of the most absurd rates that you can find with these Jellyfish test suites.

http://jell.yfish.us/
skiddy
Posts: 23
Joined: Thu Oct 26, 2017 11:11 am

Re: Processing UHD rips with Handbrake or other software

Post by skiddy »

Low Winter Sun wrote:Nvidia Shield with Kodi or SPMC makes a great Media Center. No lag on playing H265 except at some of the most absurd rates that you can find with these Jellyfish test suites.

http://jell.yfish.us/

I've got my shield pulling MKvs from my NAS over a gig network, and only the 400mbps jellyfish file is choppy, even the 300 is completely fine which is excellent news.

Does anyone have recommended handbrake settings for UHD rips, my Bluray (H.264) to H.265 profile is;

Video Codec: H.265
FPS: Same as source (Variable fps)
Constant Quality: 20 RF (I use 18 for any rare DVD rips)
Encode Preset: Medium
Encoder Tune: None (no fast decode)
Encoder Profile: Auto

Is this suitable for encoding UHDs H.265->H.265? Should\can the RF level be raised to account for the higher resolution, just as is recommended for the shift from DVD to BD?
Unicron99
Posts: 11
Joined: Tue Jan 10, 2017 5:31 pm

Re: Processing UHD rips with Handbrake or other software

Post by Unicron99 »

Very interesting topic, I was able to process the Martian Extended Edition UHD by using the keydb.cfg method in this forum with Makemkv 1.18. I have a i-7 7820k overclocked to 4.6Ghz and on a h.265 encode (Auto Passthru AC3 audio, default h.265 settings, rf 23, h.265 encoder set to very fast, 3 subtitle tracks) it took over 6 hours to encode in Handbrake. I am interested in anything that might decrease encode time without drastically affecting quality.
skiddy
Posts: 23
Joined: Thu Oct 26, 2017 11:11 am

Re: Processing UHD rips with Handbrake or other software

Post by skiddy »

Unicron99 wrote:Very interesting topic, I was able to process the Martian Extended Edition UHD by using the keydb.cfg method in this forum with Makemkv 1.18. I have a i-7 7820k overclocked to 4.6Ghz and on a h.265 encode (Auto Passthru AC3 audio, default h.265 settings, rf 23, h.265 encoder set to very fast, 3 subtitle tracks) it took over 6 hours to encode in Handbrake. I am interested in anything that might decrease encode time without drastically affecting quality.
Ouch. I only have a 4790K at 4.6gig so dread do think how long it will take. Out of interest, what was the original, Vs. final file size?

One thing that I omitted in my previous post was suitability of Handbrake for processing UHD rips due to the 8-bit pipeline.
shadowNET
Posts: 1
Joined: Wed Jan 03, 2018 2:02 am

Re: Processing UHD rips with Handbrake or other software

Post by shadowNET »

preserve wrote:Although both have the WCG 2020 color space, the original MakeMKV file has a pixel matrix of yuv420p10 while the Handbrake-converted MKV has a pixel matrix of yuv420p.
I have been able to transcode a file with the command line using ffmpeg using the following. It maintained the BT.2020 colour specs

Image

The command I used was

Code: Select all

ffmpeg -i $inputpath -pix_fmt yuv420p10le -c:v libx265 -preset fast -b:v 50M -x265-params keyint=60:bframes=3:vbv-bufsize=75000:vbv-maxrate=75000:hdr-opt=1:repeat-headers=1:colorprim=bt2020:transfer=smpte-st-2084:colormatrix=bt2020nc:master-display="G(13250,34500)B(7500,3000)R(34000,16000)W P(15635,16450)L(10000000,500)" -c:a aac -b:a 256K -y "$outputpath"
where $inputpath is the input file -c:v libx265 is the video codec -b:v 50M was the video bitrate -c:a aac is the audio codec -b:a 256K is the audio bitrate. and $outputpath is the fullpath to the output file.

As a novice trans-coder it took a lot of time to figure this one out. The file just just under 2 days to trans-code on my CPU. But I thought I would throw this out there for others who wanted to mess with HDR. As far as I can tell it is fully maintained in the output file, but someone please correct me if I am wrong.
preserve
Posts: 746
Joined: Sun Sep 13, 2015 10:21 pm
Location: Canada

Re: Processing UHD rips with Handbrake or other software

Post by preserve »

Notice however that even though it's 2020 color space, your bit depth is 8-bit. And even if it was 10-bit, the info from Woodstock I believe would still apply - that though Handbrake nightly builds can output to 10-bit, the internal processing is still only 8-bit. Perhaps this analogy works: if you save a 128kbps MP3 file as a WAV file, that doesn't change the fact that the source was low bitrate :)

That doesn't mean you aren't getting a reduced size 4K file that you can be happy with... I'm just not sure about what this really means for the WCG and HDR yet.
Using: ASUS BW-16D1HT 3.00
Unicron99
Posts: 11
Joined: Tue Jan 10, 2017 5:31 pm

Re: Processing UHD rips with Handbrake or other software

Post by Unicron99 »

skiddy wrote:Ouch. I only have a 4790K at 4.6gig so dread do think how long it will take. Out of interest, what was the original, Vs. final file size?

One thing that I omitted in my previous post was suitability of Handbrake for processing UHD rips due to the 8-bit pipeline.
The output on mine must've been 8-bit as I passed the file through Handbrake 1.0.7. HDR worked fine. After some playing with MadVR my TV picks up the HDR fine in the uncompressed rip and the compressed file. The uncompressed file was approximately 38GB. After processing it through Handbrake the file was compressed to 5.1GB! I never cease to be amazed at h.265's compression ability.
JGrant06
Posts: 5
Joined: Thu Jan 11, 2018 5:44 pm

Re: Processing UHD rips with Handbrake or other software

Post by JGrant06 »

I am still a novice MakeMKV user... I generally pull the movie off blu-rays with just about all the audio tracks to then select which tracks I want when I compress into Handbrake. I have been following the forums and was excited when UHD support was added. Just bought an Asus BW-16D1HT and ripped La La Land with more UHDs coming in from Amazon soon.

I have a 74 GB file size for La La Land, is this larger than normal? I did assume they would be larger since 4k is x4 the resolution of blu-ray but is H.265. I am just not seeing anyone's file size for an UHD that large, is it because of the audio tracks added? I did download an UHD REMUX of Dunkirk which was 46 GB and only two audio tracks. I am experiencing some lag when streaming from my Plex server (gigabit network), but only when using the DTS track (ACS has no lag but is commentary) because the Plex server has to transcode the audio on the fly.

I will be following the thread for recommendations on compressing UHD without noticeable quality loss using Handbrake. Do you all recommend re-ripping without the audio tracks or just expect each UHD to be about this size?

i7-4790k for transcoding
starmax
Posts: 45
Joined: Mon Jul 17, 2017 4:19 pm

Re: Processing UHD rips with Handbrake or other software

Post by starmax »

Thats about the right size if you are pulling in all the audio. Every movie is different, but most will be 50-80GB.

For me, I use MakeMKV to pull the video track and the main audio track and then don't re-encode it unless the source is VC-1, MPEG2 or I want to burn in subtitles. I am less concerned about the size since I have a 20TB RAID for my Plex Media Server. Also, I read that Handbrake will always convert HDR to SDR unless you are using one of their experimental nightly builds.

Transcoding audio, even DTS, shouldn't tax your i7. My PMS uses an i5-2500k, and it only struggles with transcoding 4k down to 1080p. I have read some stuff in the Plex forums that playback of HDR is a bit messed up at the moment, which some clients triggering a full transcode of the video and audio if source requires any kind of conversion. Not sure if that is your problem or not, but you can check the Plex Web status when playing back the DTS stream to see what all its transcoding.
JGrant06
Posts: 5
Joined: Thu Jan 11, 2018 5:44 pm

Re: Processing UHD rips with Handbrake or other software

Post by JGrant06 »

starmax wrote:Thats about the right size if you are pulling in all the audio. Every movie is different, but most will be 50-80GB.

For me, I use MakeMKV to pull the video track and the main audio track and then don't re-encode it unless the source is VC-1, MPEG2 or I want to burn in subtitles. I am less concerned about the size since I have a 20TB RAID for my Plex Media Server. Also, I read that Handbrake will always convert HDR to SDR unless you are using one of their experimental nightly builds.

Transcoding audio, even DTS, shouldn't tax your i7. My PMS uses an i5-2500k, and it only struggles with transcoding 4k down to 1080p. I have read some stuff in the Plex forums that playback of HDR is a bit messed up at the moment, which some clients triggering a full transcode of the video and audio if source requires any kind of conversion. Not sure if that is your problem or not, but you can check the Plex Web status when playing back the DTS stream to see what all its transcoding.
Thanks for the info. Here is an update:

I just ripped Blade Runner: The Final Cut and was 45 GB. I have a 10TB RAID but am already using 6 TB so I know I can't do too many 70+GB movies. I did re-rip La La Land without the Spanish and French audio tracks and only lost a few GB which is fine. What do you use as a backup? I am currently using a 7TB external drive and have an additional at my parents. I found more articles also indicating that any re-encoding in Handbrake will remove the HDR, so not doing that.

The transcoding doesn't tax my cpu but it seems to cause the video/audio to lag behind. I have Cat6 running throughout my house except for a Cat5 cable (pre-run from Fios) running from outside to inside my basement. I think this may be the bottleneck and cause of the lag, but do not have another 4k monitor/tv to test. I had the same thing happed with La La Land if I chose an audio track my server had to transcode. My cpu on my server is being utilized very little to transcode audio so I know it is not the bottleneck. I can fix the problem by getting another audio track of Dunkirk but worth a note for any others noticing lag with a 4k direct stream through Plex.

I did successfully watch Blade Runner: The Final Cut and La La Land (both UHD) all the way through and did not notice any buffering. My server did not have to transcode audio either time.
starmax
Posts: 45
Joined: Mon Jul 17, 2017 4:19 pm

Re: Processing UHD rips with Handbrake or other software

Post by starmax »

JGrant06 wrote: Thanks for the info. Here is an update:

I just ripped Blade Runner: The Final Cut and was 45 GB. I have a 10TB RAID but am already using 6 TB so I know I can't do too many 70+GB movies. I did re-rip La La Land without the Spanish and French audio tracks and only lost a few GB which is fine. What do you use as a backup? I am currently using a 7TB external drive and have an additional at my parents. I found more articles also indicating that any re-encoding in Handbrake will remove the HDR, so not doing that.

The transcoding doesn't tax my cpu but it seems to cause the video/audio to lag behind. I have Cat6 running throughout my house except for a Cat5 cable (pre-run from Fios) running from outside to inside my basement. I think this may be the bottleneck and cause of the lag, but do not have another 4k monitor/tv to test. I had the same thing happed with La La Land if I chose an audio track my server had to transcode. My cpu on my server is being utilized very little to transcode audio so I know it is not the bottleneck. I can fix the problem by getting another audio track of Dunkirk but worth a note for any others noticing lag with a 4k direct stream through Plex.

I did successfully watch Blade Runner: The Final Cut and La La Land (both UHD) all the way through and did not notice any buffering. My server did not have to transcode audio either time.
I use Time Machine since my PMS is running MacOS X 10.9 on a Sandy Bridge-based Hackintosh. It has been absolutely flawless since I moved it to 10.9 a couple years ago. Super happy with it.

Cat5 should be good enough for gigabit ethernet.

So what are you using for your plex client to playback these UHD rips?
Post Reply