Thanks for reporting your issue. Please make sure these boxes are checked before submitting your issue - thank you!

- [x] I looked for a similar issue and couldn't find any.
- [x] I tried with the latest version of GPAC. Installers available at http://gpac.io/downloads/gpac-nightly-builds/
- [x] I give enough information for contributors to reproduce my issue (meaningful title, github labels, platform and compiler, command-line ...). I can share files anonymously with this dropbox: https://www.mediafire.com/filedrop/filedrop_hosted.php?drop=eec9e058a9486fe4e99c33021481d9e1826ca9dbc242a6cfaab0fe95da5e5d95

Detailed guidelines: http://gpac.io/bug-reporting/

I'm struggling with muxing dolby vision mkv's into mp4. Usual suspect is an LG tv (B9).

What I'v ran into is that for files that have multiple audio tracks the tv will only recognize dolby vision when playing with the first audio track for other tracks it falls back to HDR10. I'm completely puzzled by this as I don't see how the audio tracks relate to dolby vision. This behaviour is regardless of which track is actually used, if I add the audio streams in reversed order then still the first audio stream works correclty (originally last).

This issue doesn't seem to be specific to one file, all sources I tried (though limited, only 4 files) behaved the same. If I drop the second audio track then the file plays correctly, again regardless of which track is left.

I went through all the issues I found about dolby vision here and tried the varios options from there to avail.

The process I followed:

1. Extract HEVC and audio streams using ffmpeg
  `ffmpeg -y -i /media/movie.mkv -map 0:1 -c:a:0 copy /media/audio_streams/Hungarian/0.hun.0.eac3 -map 0:2 -c:a:0 copy /media/audio_streams/English/1.eng.0.eac3 -map 0:0 -c:v:0 copy -bsf:v hevc_mp4toannexb /media/movie.hevc`
2. Extract DV RPU with [dovi_tool](https://github.com/quietvoid/dovi_tool)
  `dovi_tool -c -m 2 extract-rpu /media/movie.hevc -o /media/movie.rpu.bin`
3. Downscale HEVC stream to 1080p with ffmpeg
  `ffmpeg -y -hwaccel qsv -i /media/movie.hevc -map 0:0 -c:0 hevc_qsv -qp 25 -preset fast -pix_fmt + -x265-params hdr-opt=1:repeat-headers=1:colorprim=bt2020:range=limited:transfer=smpte2084:colormatrix=bt2020nc:range=limited:master-display='G(8500,39850)B(6550,2300)R(35400,14600)WP(15635,16450)L(10000000,0)':dolby-vision-profile=8.1:dolby-vision-rpu='/media/movie.rpu.bin' -vf scale_qsv=w=1920:h=1080 /media/movie-1080p.hevc`
4. Inject DV RPU to the downscaled stream with dovi_tool
  `dovi_tool inject-rpu -i /media/movie-1080p.hevc --rpu-in /media/movie.rpu.bin -o /media/movie.rpu.hevc`
5. Package all streams into mp4 with MP4Box
  `MP4Box -new -add /media/movie.rpu.hevc:dvp=f8.1.hdr10 -add /media/audio_streams/Hungarian/0.hun.0.eac3 -lang 2=hun -name 2=Hungarian -delay 2=0 -add /media/audio_streams/English/1.eng.0.eac3 -lang 3=eng -name 3=English -delay 3=0 -brand mp42 -ab isom -ab dby1 --force_dv /media/movie.mp4`

Altough I'm resizing the streams, it doesn't seem be the cause of this, if I skip that step the behaviour is still the same.

I'm using the following versions:

- MP4Box - 2.2.1-rev0-gb34e3851-release-2.2
- ffmpeg - 6.0-Jellyfin
- dovi_tool - 1.4.6
Dolby Vision with multiple audio tracks
This is a GitHub Issue
repo:gpac
owner:gpac
Title : Dolby Vision with multiple audio tracks
Issue date:

--- start body ---
Thanks for reporting your issue. Please make sure these boxes are checked before submitting your issue - thank you!

- [x] I looked for a similar issue and couldn't find any.
- [x] I tried with the latest version of GPAC. Installers available at http://gpac.io/downloads/gpac-nightly-builds/
- [x] I give enough information for contributors to reproduce my issue (meaningful title, github labels, platform and compiler, command-line ...). I can share files anonymously with this dropbox: https://www.mediafire.com/filedrop/filedrop_hosted.php?drop=eec9e058a9486fe4e99c33021481d9e1826ca9dbc242a6cfaab0fe95da5e5d95

Detailed guidelines: http://gpac.io/bug-reporting/

I'm struggling with muxing dolby vision mkv's into mp4. Usual suspect is an LG tv (B9).

What I'v ran into is that for files that have multiple audio tracks the tv will only recognize dolby vision when playing with the first audio track for other tracks it falls back to HDR10. I'm completely puzzled by this as I don't see how the audio tracks relate to dolby vision. This behaviour is regardless of which track is actually used, if I add the audio streams in reversed order then still the first audio stream works correclty (originally last).

This issue doesn't seem to be specific to one file, all sources I tried (though limited, only 4 files) behaved the same. If I drop the second audio track then the file plays correctly, again regardless of which track is left.

I went through all the issues I found about dolby vision here and tried the varios options from there to avail.

The process I followed:

1. Extract HEVC and audio streams using ffmpeg
  `ffmpeg -y -i /media/movie.mkv -map 0:1 -c:a:0 copy /media/audio_streams/Hungarian/0.hun.0.eac3 -map 0:2 -c:a:0 copy /media/audio_streams/English/1.eng.0.eac3 -map 0:0 -c:v:0 copy -bsf:v hevc_mp4toannexb /media/movie.hevc`
2. Extract DV RPU with [dovi_tool](https://github.com/quietvoid/dovi_tool)
  `dovi_tool -c -m 2 extract-rpu /media/movie.hevc -o /media/movie.rpu.bin`
3. Downscale HEVC stream to 1080p with ffmpeg
  `ffmpeg -y -hwaccel qsv -i /media/movie.hevc -map 0:0 -c:0 hevc_qsv -qp 25 -preset fast -pix_fmt + -x265-params hdr-opt=1:repeat-headers=1:colorprim=bt2020:range=limited:transfer=smpte2084:colormatrix=bt2020nc:range=limited:master-display='G(8500,39850)B(6550,2300)R(35400,14600)WP(15635,16450)L(10000000,0)':dolby-vision-profile=8.1:dolby-vision-rpu='/media/movie.rpu.bin' -vf scale_qsv=w=1920:h=1080 /media/movie-1080p.hevc`
4. Inject DV RPU to the downscaled stream with dovi_tool
  `dovi_tool inject-rpu -i /media/movie-1080p.hevc --rpu-in /media/movie.rpu.bin -o /media/movie.rpu.hevc`
5. Package all streams into mp4 with MP4Box
  `MP4Box -new -add /media/movie.rpu.hevc:dvp=f8.1.hdr10 -add /media/audio_streams/Hungarian/0.hun.0.eac3 -lang 2=hun -name 2=Hungarian -delay 2=0 -add /media/audio_streams/English/1.eng.0.eac3 -lang 3=eng -name 3=English -delay 3=0 -brand mp42 -ab isom -ab dby1 --force_dv /media/movie.mp4`

Altough I'm resizing the streams, it doesn't seem be the cause of this, if I skip that step the behaviour is still the same.

I'm using the following versions:

- MP4Box - 2.2.1-rev0-gb34e3851-release-2.2
- ffmpeg - 6.0-Jellyfin
- dovi_tool - 1.4.6
--- end body ---
