Dolby Vision x265 Encoding, DV Profile Advantages/Caveats?

MKV playback, recompression, remuxing, codec packs, players, howtos, etc.
Post Reply
hogfan
Posts: 3
Joined: Sat Oct 29, 2016 3:33 am

Dolby Vision x265 Encoding, DV Profile Advantages/Caveats?

Post by hogfan »

So I believe after waiting some time, and doing a LOT of reading about Dolby Vision I have finally completed my first successful UHD BR Rip Dolby Vision encodes.

I use the FastFlix application to encode my UHD BR Rips that don't have Dolby Vision, so to date, I've simply been keeping the DV rips as MKV remuxes since encoding them loses the DV information.

After doing a lot of reading (again) on Dolby Vision I believe I have successfully compressed one of my Dolby Vision MKVs, and retained Dolby Vision (although profile-converted).

My process is as follows:

1.) Encode my original DV Profile 7 MKV (source.mkv) in FastFlix, outputting a new x265 encoded mkv. (encoded.mkv)
2.) Next I use ffmpeg to pipe the original source MKV to dovi_tool to extract the RPU from the source file, and convert the RPU to Dolby Vision Profile 8.1 compatible (if I cropped the letterbox bars when encoding in Fastflix, then I make sure to use the --crop option when extracting the RPU from source.mkv)

Code: Select all

ffmpeg -i "D:\Rips\mymovie.mkv" -c:v copy -vbsf hevc_mp4toannexb -f hevc - | dovi_tool -m 2 --crop extract-rpu - -o mymovie_RPU_81.bin
3.) Next I use MKVExtractGUI tool to extract the hevc video track, Audio track(s), & Subtitle track(s), & chapters from my encoded.mkv

4.) I then use dovi_tool to inject my extracted RPU (mymovie_RPU_81.bin) into the encoded HEVC video file

Code: Select all

dovi_tool inject-rpu -i "D:\Encodes Completed\mymovie\track1_[und].hevc" --rpu-in mymovie_RPU_81.bin -o mymovie_injected.hevc
5.) Finally, I open MKVToolnix 63.0.0 and use the Multiplexer to create a new MKV, adding the following source files:

- mymovie_injected.hevc
- Audio Track(s) extracted back in Step 3 above
- Subtitle Track(s) extracted back in Step 3 above
- Chapters XML file extracted back in Step 3 above

A check of the newly multiplexed MKV file (mymovie.dv8.mkv) created in Mediainfo shows the HDR format to be:

Dolby Vision, Version 1.0, dvhe.08.06, BL+RPU, HDR10 compatible / SMPTE ST 2086, HDR10 compatible

When I play this file with the Plex client/app on my Nvidia Shield 2019 Pro --> Yamaha Receiver --> LG OLED TV, the Dolby Vision logo pops up on the screen, and I have working PGS subtitles, and Dolby TrueHD audio.

So it sounds like I have successfully encoded my UHD movie, shrinking it down in size (x265 CRF 18), and retained Dolby Vision (although converting it to Single Layer Profile 8.1)

Is there anything I'm missing here I should be aware of in regards to the DV profile? I chose to convert to profile 8.1 rather than profile 5 to ensure HDR10 compatibility. This way if the file is played on a Samsung TV for example, it won't fail to play (as it would with DV Profile 5), it will just fall back to HDR10.

Is there any big negative to using profile 8.1 vs profile 5 for UHD Bluray source encodes? The spec sheet I read shows both profiles are (BL + RPU) with the main differences being profile 5 uses the IPT color space which is proprietary to Dolby. Does profile 8.1 use the same color space as profile 7 (BL+MEL/FEL+RPU)? From what I read, it seems to imply the IPT color space is unique to profile 5.

It seems Profile 5 & Profile 8.1 are very similar to HDR10+, dynamic metadata only (RPU, not EL). Is my reasoning here correct?

I plan to store my source MKV remuxes on an external drive so I'll always have the 1:1 copies, but encoding with x265 will free up a ton of space on my Plex server.

Answers to any of my questions above are greatly appreciated, and hopefully this thread can help others who are looking to compress DV movies with x265.
ArArdin
Posts: 14
Joined: Fri Nov 20, 2020 1:40 pm

Re: Dolby Vision x265 Encoding, DV Profile Advantages/Caveats?

Post by ArArdin »

Interesting thread. Thanks for your elaborate post on workflow.

How do you deal with FEL? Do you ignore it and only remux profile-converted RPU with your re-encode?
In case of FEL, I think RPU is meant to be applied to the full 12bit video.

Also (not my personal experience) I have read there are issues with certain players that would fill the screen with grey bars (not black) in case video is cropped. Maybe it's safer to keep the black bars during re-encode?
hogfan
Posts: 3
Joined: Sat Oct 29, 2016 3:33 am

Re: Dolby Vision x265 Encoding, DV Profile Advantages/Caveats?

Post by hogfan »

ArArdin wrote:
Wed Nov 24, 2021 8:34 am
Interesting thread. Thanks for your elaborate post on workflow.

How do you deal with FEL? Do you ignore it and only remux profile-converted RPU with your re-encode?
In case of FEL, I think RPU is meant to be applied to the full 12bit video.

Also (not my personal experience) I have read there are issues with certain players that would fill the screen with grey bars (not black) in case video is cropped. Maybe it's safer to keep the black bars during re-encode?
Correct, I'm simply using dovi_tools to extract the RPU, convert the RPU to Profile 8 compatible, discard the MEL/FEL, and then inject the converted RPU data back into the re-encoded Base Layer video track. As I understand it, there aren't really any streaming players out there that are capable of playing the FEL. I'm using the 2019 Nvidia Shield, and although DV Profile 7 files play just fine in Plex and trigger Dolby Vision on my LG TV, I've read that the FEL is basically ignored and not played back (as I understand it, it's a hardware limitation with the current chipsets and implementation since DV Profile 7 Dual Layer is a UHD Blu Ray Disc standard, not intended for streaming).

I think when extracting the RPU and converting the profile to be 8.1 compatible that the metadata may be converted from FEL to MEL essentially, although I'm not sure on this. Also, our current displays can only display 10-bit depth.

On the gray bars on cropped video vs black bars, that is interesting and I hadn't heard that. Do you know which players are affected by this? That actually sounds more like a implementation issue with those specific players. I have not experienced this with the 2019 Shield and Plex app (which uses ExoPlayer). I always see black bars. I also would think this issue wouldn't be specific to DV encoded videos, but all encoded HDR content.

At the end of the day, I believe I'm simply converting Dual Layer profile 7 Dolby Vision to single layer while discarding the enhancement layer. The extracted/converted RPU is created from information present in both the Base Layer & Enhancement Layer tracks (MEL/FEL). Injecting the converted RPU into the encoded BL track basically gives us a BL + RPU. I interpret this to mean we now have the Base Layer (HDR10 video track) + RPU (Dynamic DV Metadata, rather than just static HDR10 Metadata). So still Dolby Vision, just not as good a Profile 7 DV. However, no big loss here as we can't currently playback the Enhancement layer on streaming devices anyway. The advantage I see here is being able to encode the video with x265 AND keep DV Dynamic metadata for playback. As mentioned above I will keep uncompressed original DV Profile 7 rips of my movies archived in case we are able to take advantage of the MEL/FEL layer during playback on streaming devices in the future.
ArArdin
Posts: 14
Joined: Fri Nov 20, 2020 1:40 pm

Re: Dolby Vision x265 Encoding, DV Profile Advantages/Caveats?

Post by ArArdin »

hogfan wrote:
Wed Nov 24, 2021 2:57 pm
As I understand it, there aren't really any streaming players out there that are capable of playing the FEL.
Well, I have a Ugoos AM6+ which has a second hevc decoder so it can do FEL. But it's a very buggy player. I still haven't been able to play one full DV movie without stuttering and audio dropouts. Annoying as hell.
hogfan wrote:
Wed Nov 24, 2021 2:57 pm
I think when extracting the RPU and converting the profile to be 8.1 compatible that the metadata may be converted from FEL to MEL essentially, although I'm not sure on this.
Interesting, I didn't think of the 8.1 conversion this way yet.
hogfan wrote:
Wed Nov 24, 2021 2:57 pm
On the gray bars on cropped video vs black bars, that is interesting and I hadn't heard that. Do you know which players are affected by this? That actually sounds more like a implementation issue with those specific players.
Sorry, I can't remember where or for what player this was. So yes, it was for (a) specific player(s) but I am sure it had to do with Dolby Vision content being cropped.
I did so many reading on Dolby Vision and on so many different places I lost track on what was where. Should I accidentially bounce on it again, I'll let you know.
Post Reply