Jellyfin Forum
Converting Dolby Vision to HDR10 - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Guides, Walkthroughs & Tutorials (https://forum.jellyfin.org/f-guides-walkthroughs-tutorials)
+--- Thread: Converting Dolby Vision to HDR10 (/t-converting-dolby-vision-to-hdr10)

Pages: 1 2 3 4 5 6 7 8 9 10 11


RE: Converting Dolby Vision to HDR10 - gnattu - 2025-02-19

The one-liner is known to work bad with the mkv muxer of ffmpeg because ffmpeg's own mkv muxer tries to do too many smart things during stream coping and it will fail the process when the dolby vision metadata is removed for some videos. You have to remux to a better implemented muxer like mp4, and then from that mp4 to remux back to mkv.


RE: Converting Dolby Vision to HDR10 - SquishySquash - 2025-02-19

(2025-02-18, 11:16 PM)TheDreadPirate Wrote: But the 8.2 was converted from the DV5 source, correct?  I'll eventually get around to getting a DV5 test file and experiment with using dovi_tool to convert it to HDR10.  Mostly for the lulz.

Personally, I wouldn't bother converting DV5 videos to HDR10.  Some Android TV devices use mediatek SoCs, and some of those models have driver bugs that break Dolby Vision 7 and 8.  And one of my devices also has a mediatek chipset.

That is in addition to my re-encoding all my media to AV1, which doesn't support DV 7 or 8.

Yes, you are right. And I gave up Weary-face Tried all possible combinations of dovi_tools conversion from 5 to 8 prior to using ffmpeg and tried using ffmpeg on original files but with old method and Mp4 intermediary. No result. Even on first steps video was all purple-ish.

I figure its because DV5 is using properitary colorspace and not many tools are capable of reading it and doing anything about it.

I even read that owners of Dolby Vision standard have IP patent on the method of converting DV5 to HDR and thats why there are no tools to do it avaliable to public.


RE: Converting Dolby Vision to HDR10 - Majesticaveman - 2025-03-31

(2024-08-06, 09:25 PM)TheDreadPirate Wrote: ****This guide has been updated****

Jellyfin-ffmpeg 7.0.2-4 added a feature to remove Dolby Vision directly.  The process of removing Dolby Vision can now be accomplished with a single ffmpeg command, greatly simplifying the process.  I am leaving the original walkthrough for those on non-Jellyfin builds of ffmpeg or jellyfin-ffmpeg6.

Code:
/usr/lib/jellyfin-ffmpeg/ffmpeg -y -hide_banner -stats -fflags +genpts+igndts -loglevel error -i "/path/to/dv_video.mkv" -map 0 -bsf:v hevc_metadata=remove_dovi=1 -codec copy -max_muxing_queue_size 2048 -max_interleave_delta 0 -avoid_negative_ts disabled hdr10_video.mkv

And that is it.  Still no re-encoding required.

A bonus feature: If you do re-encode, to AV1 specifically, you can skip using the bitstream filter entirely.  Re-encoding to AV1 will automatically strip the Dolby Vision EL and RPU while maintaining the BT2020 HDR10 color space.

=========================================================================

****Original Walkthrough****

If you've watched HDR content on Jellyfin you've likely struggled with the mish-mash of client/server compatibility that comes with HDR content.  Especially with Dolby Vision.

In my quest to encode my entire library with AV1, that required I tackle the issue of Dolby Vision.  Both because HDR10 is vastly more compatible (yay open standards) and because AV1 does not officially support these Dolby Vision profiles anyway (AV1 Dolby Vision via Profile 10).  To be clear, you can still use HEVC if you haven't gotten on the AV1 bandwagon yet.  We're going to focus on simply removing Dolby Vision, which does not require any re-encoding.

For this guide we are focusing on the two more common Dolby Vision profiles: 7.6 and 8.1.  Profile 7.6 is used exclusively by 4K HDR Blurays and can only be decoded by Bluray players.  To my knowledge, there are no mobile phones or streaming devices that support profile 7.6.  Then there's the related profile 8.1.

Both Dolby Vision profiles use HDR10 as their base and add dynamic metadata, a.k.a. enhancement layers, on top of it.  A single layer, called the RPU (Reference Picture Unit), for profile 8.1.  And two enhancement layers for profile 7.6, RPU and MEL/FEL (minimum or full enhancement layer).  Converting Dolby Vision 7.6 and 8.1 to HDR10 simply requires discarding these extra layers.

FFMPEG cannot, by itself, discard Dolby Vision metadata.  We will need the aid of an open source app called dovi_tool.  I've tested this process in Linux, but both dovi_tool and jellyfin-ffmpeg6 are available on Windows and Mac.  You may need to make minor syntax adjustments for Windows and Mac.  Vanilla FFMPEG should also work fine.

First we need extract the video and run it through dovi_tool to remove the Dolby Vision layers.

Code:
/usr/lib/jellyfin-ffmpeg/ffmpeg -y -hide_banner -loglevel error -stats -i "/path/to/your/DV_video.mkv" -dn -c:v copy -bsf:v hevc_mp4toannexb -f hevc - | dovi_tool remove - -o "hdr10_video.hevc"

Now we have a naked HDR10 HEVC file with no structure.  I tried directly remuxing the video back into the source MKV file, but muxing it into a MP4 container first seemed to work better.

Code:
/usr/lib/jellyfin-ffmpeg/ffmpeg -hide_banner -loglevel error -stats -y -fflags +genpts -i "hdr10_video.hevc" -c:v copy "hdr10_video.mp4"

NOW we can remux the new HDR10 video with the original audio and subtitles.

Code:
/usr/lib/jellyfin-ffmpeg/ffmpeg -hide_banner -loglevel error -stats -y -fflags +genpts+igndts -i "hdr10_video.mp4" -i "/path/to/your/DV_video.mkv" -map_chapters 1 -map 0:v -map 1:a -map 1:s -c:v copy -c:a copy -c:s copy -max_muxing_queue_size 2048 -avoid_negative_ts disabled -max_interleave_delta 0 "new_hdr10_video.mkv"

Now we've muxed the HDR10 video with the original audio, subtitles, and chapter markers.  Zero re-encoding required.

I followed this guide using the new command and it seems like I'm getting an Out of memory issue. I thought it worked at first, however the file is 25GB smaller and the end of the video (which isn't the end of the movie) seems to be corrupted. Is there something wrong with what I'm doing?
I've attached a .txt with the logs and command.

Information about my system.

OS: Windows 10
CPU: 9700k
Memory: 32GB
Graphics: Integrated
Hard Drive: 1 x 8tb WD blue.


RE: Converting Dolby Vision to HDR10 - TheDreadPirate - 2025-03-31

The parameter "-max_interleave_delta 0" can cause OOM issues if the original file is muxed in such a way that the various tracks are on "opposite sides" of the file instead of interleaved in short segments. ffmpeg will keep reading the file, storing it in memory, until it encounters other tracks.

This parameter is optional and can be left out.