Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sw5163

macrumors newbie
Original poster
Sep 6, 2022
6
1
Orginal post at https://www.avsforum.com/threads/apple-dolby-vision.3252865/

No idea where I should post this, but in case someone find this useful,
here are some workflow for DV on Apple device.

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. Thanks @quiet_void and @yusesope 's amazing tool, credit goes to them.

7.1 eac3+atmos:​

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

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)
{
2. 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)
{
2. 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.
}

3. 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:
Code:
{
"mode": 2,
"remove_mapping": true
}
3. 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:​

2. 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:​

2. 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:​

2. 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:
Code:
{
// 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
}
],
}
4. Extract bl.hevc from Blu-ray.
ffmpeg -i BluRay.m2ts/mkv -map 0:0 -c copy bl.hevc
5. Inject RPU_modified.bin to bl.hevc.
dovi_tool inject-rpu -r RPU_modified.bin -i bl.hevc
6. 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.
 

7.1 eac3+atmos:​

1.mp4muxer to fix/generate proper atmos.mp4 with right “complexity index”:
mp4muxer -i atmos.ec3 -o atmos.mp4
Mac users can mux any DD+ Atmos (lossy) track into MP4 file with correctly created complexity index and magic cookie using Subler. Also dvh1 video track can be muxed with Subler.
In GUI.
 
Mac users can mux any DD+ Atmos (lossy) track into MP4 file with correctly created complexity index and magic cookie using Subler. Also dvh1 video track can be muxed with Subler.
Yes, for Mac users Subler basically is the best lossless remixing tool, does everything as they should.
However, you may also still want to use dovi_tool for proper FEL or MEL conversion.
And please avoid using Infuse when playing MEL converted this way, current build fails to adapt RPU, use internal player or PLEX instead.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.