Jellyfin Forum
MP4 with Dolby Vision to MKV - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Off Topic (https://forum.jellyfin.org/f-off-topic)
+--- Forum: General Discussion (https://forum.jellyfin.org/f-general-discussion)
+--- Thread: MP4 with Dolby Vision to MKV (/t-mp4-with-dolby-vision-to-mkv)



MP4 with Dolby Vision to MKV - Cannikin - 2024-03-05

Solved! See below

Every search on Google for this topic seems to return the opposite problem: someone with an MKV with DV trying to turn it into an MP4.

I've got plenty of MKV files with Dolby Vision, ripped with MakeMKV. But now I've got an MP4 file with DV and want to turn it into an MKV to go with the rest of my collection. When I run a typical ffmpeg command to change containers, I get an error:

Code:
ffmpeg -i movie.mp4 -map 0 -c copy movie.mkv
  [standard ffmpeg verbose output...]
[matroska @ 0x11e028400] Tag dvh1 incompatible with output codec id '173' ([0][0][0][0])
Could not write header for output file #0 (incorrect codec parameters ?): Invalid data found when processing input
Error initializing output stream 0:2 --

I've seen that when doing the opposite people are using a -strict unofficial flag, but that didn't make a difference for me.

The stream identifier looks like:

Code:
Stream #0:0(und): Video: hevc (Main 10) (dvh1 / 0x31687664), yuv420p10le(pc), 1920x1080 [SAR 1:1 DAR 16:9], 6829 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 23.98 tbc (default)
    Metadata:
      creation_time  : 2024-03-02T05:05:29.000000Z
      handler_name    : VideoHandler
      vendor_id      : [0][0][0][0]
      encoder        : DOVI Coding
    Side data:
      DOVI configuration record: version: 1.0, profile: 5, level: 3, rpu flag: 1, el flag: 0, bl flag: 1, compatibility id: 0

Thanks for any help!

Solved!

Turns out MKVToolNix can work with MP4 files! Opening the .mp4 in the GUI and then just hitting "Start Multiplexing" actually worked: the resulting .mkv file plays with Dolby Vision on the Nvidia Shield and my LG G1. Opening the file in VLC shows a green tint, but I don't watch them in VLC!


RE: MP4 with Dolby Vision to MKV - bitmap - 2024-03-07

What version of ffmpeg are you running? I don't see any documentation that suggests official DV support for any version, codec, or container.

Every single time I've searched for how to handle DV, the only recommendation I've found is to use a project called something like dovi tool to extract the metadata and hevc, ffmpeg to re-mux, and mkvtoolnix to re-insert the metadata. I haven't gone through the process because I'm using AV1, which I'm unsure of actual DV support though I'm faking it by copying over the video metadata when I encode.


RE: MP4 with Dolby Vision to MKV - TheDreadPirate - 2024-03-07

Dolby Vision Profile 5 HAS to be in MP4. You would need to use dovi_tool first to convert DV5 to DV8, which can then be placed in a MKV container.

https://github.com/quietvoid/dovi_tool

"Conversion mode 3" converts profile 5 to 8.1.


RE: MP4 with Dolby Vision to MKV - Cannikin - 2024-03-07

Thanks for the replies!

Yesterday on Reddit someone replied with "just use MKVToolNix" and it kind of warped my brain—I thought the MKVToolNix tools only worked with MKV files, I didn't realize it could operate on anything else, like an MP4. But sure enough I opened the MP4 in the GUI, hit Start Multiplexing, and the MKV that came out the other end had DV encoded!

When I played that MKV in VLC it has the greenish tint, but is perfectly fine in my home theater setup (Nvidia Shield and an LG C1) so I'm pretty happy!

Here's the original MP4 info from MediaInfo:

Code:
Video
ID                                      : 1
ID in the original source medium        : 4113 (0x1011)
Format                                  : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                          : Main 10@L5.1@High
HDR format                              : Dolby Vision, Version 1.0, Profile 7.6, dvhe.07.06, BL+EL+RPU, Blu-ray compatible / SMPTE ST 2086, Version HDR10, HDR10 compatible
Codec ID                                : V_MPEGH/ISO/HEVC


And the resulting MKV:

Code:
Video
ID                                      : 1
Format                                  : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                          : Main 10@L5.1@Main
HDR format                              : Dolby Vision, Version 1.0, Profile 5, dvhe.05.06, BL+RPU
Codec ID                                : V_MPEGH/ISO/HEVC

Note Profile 5 here, whereas MKVs that I rip with MakeMKV show Profile 7.6. But again, they seem to play properly on the Shield. According to a random person on Reddit:

Quote:Profile 5 is what the Shield was designed to play. This is what streaming services use. Profile 8 is not a film industry standard. It is converted from profile 7 or 5. It is used mostly to support media players that cannot play profile 7 at all. The Shield does play profile 7 RPU so converting will make no difference.



RE: MP4 with Dolby Vision to MKV - TheDreadPirate - 2024-03-07

As I stated, Dolby Vision Profile 5 MUST be in an MP4 for it to work properly.  This is why the colors were off in VLC.  The only reason this MKV works in jellyfin on your shield is likely because it is being transcoded.


RE: MP4 with Dolby Vision to MKV - ChocOrange - 2024-03-24

(2024-03-07, 08:14 PM)TheDreadPirate Wrote: As I stated, Dolby Vision Profile 5 MUST be in an MP4 for it to work properly.  This is why the colors were off in VLC.  The only reason this MKV works in jellyfin on your shield is likely because it is being transcoded.

The shield is perfectly capable of correctly handling DV profile 5 in .mkv files. I can play them correctly Jellyfin -> Kodi on shield -> TV.

Here's a spreadsheet of DV compatability https://docs.google.com/spreadsheets/d/1jBIGF8XTVi9VmDBZ8a5hEyongYMCDlUiLHU9n1f_S74/preview/sheet?gid=427220017


RE: MP4 with Dolby Vision to MKV - TheDreadPirate - 2024-03-24

It can play it, sure. But is it transcoding? Is it actually HDR? THe DV spec for profile 5 requires MP4. If something can handle it in MKV that is out of spec.

But thanks for sharing that observation. Good to know.


RE: MP4 with Dolby Vision to MKV - ChocOrange - 2024-03-24

(2024-03-24, 09:29 PM)TheDreadPirate Wrote: It can play it, sure.  But is it transcoding?  Is it actually HDR?  THe DV spec for profile 5 requires MP4.  If something can handle it in MKV that is out of spec.

It is most definitely Dolby Vision as my Lg TV pops up with a playing Dolby Vision message, not HDR and not transcoding at all.

I think you are confusing mp4 video with the mp4 container format. Both are named the same but are very different. One is a file format and the container is more like a zip file.
Dolby vision mp4 video format can be added to the mkv container format and played with compatible hardware.
Let's not forget the Nvidia Shield is fully certified for Dolby Vision so it won't play 'out of spec' files. Their license would be invalid.

Care to share your link for the DV spec requiring mp4 for profile 5?


RE: MP4 with Dolby Vision to MKV - TheDreadPirate - 2024-03-25

I am most definitely not mixing up the MP4 container with mpeg4 video.

Having said that, it appears the MP4 requirement for DV5 is no longer true as of ~2021 it seems.