Plex displays wrong colours with Dolby Vision on AppleTV 4k

I have seen the audio, but no video issue, and they were malformed MKV files. Remuxing them resolved the issue

Then there should be an appropriate error message. I’ll look into it, thanks.

this, only DV files i can play with plex are ones ripped from blurays that have the dual profile but like mentioned, its not “real DV”… everything else is rather “playback not supported” or all i hear is the audio

@Ridley @DaveBinM
This is not working properly.

I have tested with multiple files now. Some files play but the TV is not put into DV mode but HDR mode and some files have the spinner and sound or spinner for some time and then an error.

ALL of those files play perfectly on the Sony Plex app.
I then subscribed to infuse and tested all files on Infuse on the AppleTV and they ALL work fine, everything plays, TV is put into DV mode.

6 Likes

Ditto!

I encounter the same situation - after reporting it about 1.5 year(!) ago here.

Also, I really do not understand this technical back and forth that is going on here since many months.

To me the situation is quite easy: there is a lot of DV encoded videos out there that the AppleTV Plex app cannot properly play (s. many, many messages above) and the TV native versions of Plex (LG in my case) have absolutely no problem playing (at least for me.)

@Ridley and @DaveBinM: should we understand that even though so many of us seem to have this problem and demo files were submitted over the last few months, the Plex team has not been able to replicate the issue, nail down the cause by comparing how e.g. the AppleTV Plex vs. the LG Plex handle these files, and come up with an analysis plus solution proposal?

I would really appreciate to get information that is stepping away from the nitty gritty and answer the above (for me) fundamental questions. Or show me where and why my points are wrong…

Thanks and best regards.

6 Likes

@Ridley any updates to share?

Same here.

All demo files are guaranteed to work with Apple’s native player, should also work on PLEX. They can also be directly played in Safari and have Dolby Vision.

9.1.6 eac3+atmos:

mp4box now supports atmos remux
mp4box -add dv.hevc -add atmos.ec3 -new p5_dvh1_eac3_atmos.mp4
1. mp4muxer to fix/generate proper atmos.mp4 with right “complexity index”:
mp4muxer -i atmos.ec3 -o atmos.mp4
2. mp4box to generate proper dvh1.mp4:
mp4box -add dv.hevc -new dvh1.mp4
3. mp4mux(bento4) to merge them:
mp4mux(bento4) --track dvh1.mp4 --track atmos.mp4 p5_dvh1_eac3_atmos.mp4

Note only Apple platform will have atmos problem regarding “complexity index”
All other devices are fine.

ICtCp profile 5 dvh1 mp4:

no further change needed.

ICtCp profile 5 dvhe:

  1. ffmpeg -i p5.dvhe.mp4 -map 0:0 -c copy dv.hevc
    //-map 0:0 refers to DV track.

if (mov_text sub in it)
{

  1. ffmpeg -i p5.dvhe.mp4 -map 0:1 -map 0:3 -c copy audio_sub.mp4
    //-map 0:1 refers to eac3/ac3, -map 0:3 refers to mov_text sub.

}
else if ( .srt/.ass sub is needed)
{

  1. ffmpeg -i p5.dvhe.mp4 -i srt.srt -map 0:1 -map 1 -c copy -c:s mov_text -metadata:s language=eng audio_sub.mp4
    //mov_text is the only sub codec for Apple’s native player. Maybe others can be recognized by PLEX.
    //language field on both audio and sub are important for sub to default show up.

}

  1. mp4box -add dv.hevc -add audio_sub.mp4 -new p5.dvh1.mp4
    //mp4box change dvhe to dvh1 by default while preserving DV RPU data.
    //note change ‘dvhe’ to ‘dvh1’ by only using hex editor will result in problem on iOS playback. GitHub - rixtox/mp4dovi will lead to black screen on iPad pro 2017.

Dual layer FEL dolby vision to Apple compatible BL+RPU+7.1 lossless:

DV proof around P455 and P460
7.1 lossless proof

  1. ffmpeg -i FEL_test_for_AVS.m2ts -c copy -map 0:0 bl.hevc -map 0:1 -c copy el.hevc -map 0:2 -c pcm_s32le pcm.mov
    //Apple only supports pcm 7.1 lossless.

  2. dovi_tool --edit-config fel_to_p81.json mux --bl bl.hevc --el el.hevc --discard
    //mode 2 to convert to profile 8.1
    //remove_mapping to remove reshaping data that processing 4:2:2 12bit FEL to 4:2:0 10bit HDR.
    fel_to_p81.json:

{
"mode": 2,
"remove_mapping": true
}
  1. mp4box -add BL_RPU.hevc -add pcm.mov:lang=eng -add srt.srt:lang=eng:hdlr=sbtl -new p5_BL_RPU_PCM(7.1).mp4
    //lang=eng:hdlr=sbtl for sub to default show up.
    //one can also use ffmpeg command for sub as above.

Single layer FEL dolby vision to Apple compatible BL+RPU+7.1 lossless:

  1. dovi_tool --edit-config fel_to_p81.json convert BL_EL_RPU.hevc --discard
    //rest as Dual layer FEL.

Dual layer MEL dolby vision to Apple compatible BL+RPU+7.1 lossless:

  1. dovi_tool -m 2 mux --bl bl.hevc --el el.hevc --discard
    //MEL is already HDR10 BL and doesn’t have reshaping data, so ‘remove_mapping’ is not needed, use default mode 2 in dovi_tool.
    //rest as Dual layer FEL.

Single layer MEL dolby vision (p8.1) to Apple compatible BL+RPU+7.1 lossless:

  1. dovi_tool -m 2 convert BL_EL_RPU.hevc --discard
    //rest as Dual layer FEL.

HDR10 hev1 mkv/mp4:

  1. ffmpeg -i hev1.mp4/mkv -map 0:0 -map 0:1 -map 0:2 -c copy -c:s mov_text -metadata:s language=eng -vtag hvc1 hvc1.mp4
    //hvc1 for Apple native player compatibility.

Hybrid Profile 5 and HDR10 Blu-ray to get unofficial MEL:

  1. Extract dv.hevc from streaming P5.
    ffmpeg -i p5.dvhe.mp4 -map 0:0 -c copy dv.hevc
  2. Extract RPU and remove reshaping data that are used for ICtCp->HDR10.
    dovi_tool -m 3 extract-rpu dv.hevc
  3. Modify RPU frame to synchronize with Blu-ray BL. (optional)
    dovi_tool editor -i RPU.bin -j modify_frame.json
    modify_frame.json:
{
    // List of frames or frame ranges to remove (inclusive)
    // Frames are removed before the duplicate passes
    "remove": [
        "0-39"
    ],

    // List of duplicate operations
    "duplicate": [
        {
            // Frame to use as metadata source
            "source": int,
            // Index at which the duplicated frames are added (inclusive)
            "offset": int,
            // Number of frames to duplicate
            "length": int
        }
    ],
}
  1. Extract bl.hevc from Blu-ray.
    ffmpeg -i BluRay.m2ts/mkv -map 0:0 -c copy bl.hevc
  2. Inject RPU_modified.bin to bl.hevc.
    dovi_tool inject-rpu -r RPU_modified.bin -i bl.hevc
  3. Remux to mp4 with audio/sub/etc.
    mp4box -add BL_RPU.hevc -add pcm.mov:lang=eng -add sub.srt:lang=eng:hdlr=sbtl -new P5_dvh1_BL_RPU.mp4

Also check @RESET_9999 's DoVi_Scripts under his signature, saves a lot of effort than typing in command line.

6 Likes

This is great stuff, thank you!!

Regarding Profile 5 in MKV containers…

It doesn’t seem like ffmpeg or mp4box support EAC3+Atmos muxing. So while Dolby Vision works on Apple TV 4K, Lossy Atmos does not work after remuxing from mkv to mp4. (Both Dolby Vision and Atmos work correctly when playing Dolby’s sample mp4 files)

Dolby’s mp4muxer is capable of correctly muxing EAC3+Atmos, but the output mp4 doesn’t play on an Apple TV, even when using the --dvh1flag 0

Do you know if there’s a way to remux both DV Profile 5 and EAC3+Atmos from mkv to mp4 without losing atmos?

@Ridley Any update would be appreciated, thank you.

P5 should work fine in DP and DS in the current public versions of the iOS and tvOS apps, with the exception of certain MP4 files muxed with the dvhe codec tag, which may fail to DP. You can work around this for the affected files by disabling DP; this will be fixed in an upcoming release.

If you find cases where this still isn’t working (even when disabling DP), then I’m once again going to need iOS logs, PMS logs, and a sample file.

1 Like

Thank you for the update.
Unfortunately I did not find a single file that worked properly.

What does DP and DS stand for?

Direct Play and Direct Stream
as opposed to situations where transcoding is necessary.

Well, at least you should have no difficulty reproducing your issue to obtain logs.

Direct Play and Direct Stream.

1 Like

:laughing: Goddam

Apparently your QA ppl do have difficulty…

Anyhow I just sent you server and client logs with debug enabled. Please note that only on the third play did I enable debug lvl on the client side, so scroll down :wink:
The file did DS, convert mkv to mp4.
The file (all files) play properly on a) the Sony Android TV Plex app directly on the TV and b) the infuse app on the aTV, infuse also direct plays the file.

If you can provide a place where I can upload a 9G file, I’ll happily share that, or if you can provide a proper ffmpeg call, I can share a smaller file, alternatively I can add you to the plex server and you can DL it via api call.

Thank you for your time @Ridley

Edit: the file name is ‘not.working.mkv’

2 Likes

I think that is related to this.

mp4box currently doesn’t support atmos packaging.
Could you please try:

  1. ffmpeg -i mkv.mkv -map 0:1 -c copy atmos_by_ffmpeg.mp4
    and play it directly in Apple’s native player without video.
    If the receiver show PCM/Atmos or something like that it means ffmpeg supports eac3+atmos. Then try to mux that with DV video:
    mp4box -add dv.hevc -add atmos_by_ffmpeg.mp4 -new dv_atmos_ffmpeg.mp4
    ormp4box -add dv.hevc atmos_by_ffmpeg.mp4
    to see if mp4box will parse the atmos track untouched.
    The latter will directly add dv.hevc into atmos_by_ffmpeg.mp4

If above doesn’t work, please try:

  1. mp4muxer -i atmos.ec3 -o atmos.mp4
    mp4box -add dv.hevc -add atmos.mp4 -new p5.dvh1.atmos.ec3.mp4
    ormp4box -add dv.hevc atmos.mp4
    to see if mp4box will parse the atmos track untouched.

If that fails, the last chance would be mp4mux - Bento4

  1. Command line is probably this:
    mp4mux(bento4) --track dv.hevc#dv_profile=5,frame_rate=23.976 --track atmos.ec3 bento4sample.mp4
    It’s the tool I used before mp4muxer and mp4box.
    I haven’t used it for a long time and it has frame_rate mismatch issue.

I don’t have an atmos capable device, so will need you guys to test.
Please let me know if these workflows work or not, many thanks.

Wait, I don’t use INFUSE, but can’t INFUSE play eac3/atmos mkv properly?

1 Like

Thanks, I’ll try this tomorrow evening.

For anyone watching this thread, “Subler” for MacOS has so far been perfect at remuxing to mp4 while retaining Dolby vision and atmos data.

Yes, Infuse will play eac3 atmos from either mkv or mp4

1 Like