Dolby TrueHD passthrough - modified mpv build
As some of you may have noticed, passing through Dolby TrueHD content can be hit or miss - some files work, others won’t - this build tries to fix this under specific circumstances.
Why is the current mpv lib broken?
Well, 3 years ago I opened a bug report on the FFmpeg bug tracker site**°1** because I noticed a bug with the passthrough logic. When playing back movie files containing a TrueHD track that exceeds a bitrate of 11mbit the player would stop or crash. Time has passed and the issue was “fixed” - well playing back files with a bitrate over 11mbit works fine now but other issues have been introduced by this - which makes TrueHD passthrough nearly unusable. To name two, scrubbing does not work reliably - audio stops when skipping inside the file… Or playing back a file that stems from a source where seamless branching was needed, audio will stop when it hits such a spot.
To address this, I opened a new bug report on the FFmpeg bug track site**°2,** but nobody seems to care…
How is this fixed?
There are two types of fixes:
-
Actual fix
This fix incorporates a code change made by @gbooker02 to possibly fix the TrueHD passthrough problem.
The code change can be found here =>
https://gist.github.com/gbooker/d4fa3ba4f0ad676a403b259f3b74044e
The rest of the(/libavformat/spdifenc.c)file is kept up-to-date so it stays compatible with upstream FFmpeg. The total modified spdifenc.c file can be found here => https://github.com/mitzsch/FFmpeg/blob/master-3/libavformat/spdifenc.c -
Revert to the original TrueHD logic
All I have done here is revert these truehd-related commits, and keep the rest of the file(/libavformat/spdifenc.c)up-to-date - so it stays compatible with upstream FFmpeg.
The modified “original TrueHD logic” spdifenc.c file can be found here:
https://github.com/mitzsch/FFmpeg/blob/master-2/libavformat/spdifenc.c
What does not work with this build?
-
Actual fix build
This build may show some weird behavior with seamless branching files on some receivers. (dropouts…) -
Revert to the original TrueHD logic
Files with a TrueHD bitrate over 11mbit will not work, playback will be stuck.
Where to find the builds?
Modified mpv builds with the actual TrueHD fix can be found here:
https://github.com/mitzsch/mpv-winbuild/releases
Note: This repo only contains “actual TrueHD fix” releases.
If you need builds with the “reverted TrueHD logic” write me a PM and I will send you a build. I build them for myself, as I mainly use them.
How to install?
Follow this guide => https://forums.plex.tv/t/htpc-tips-and-tricks/794228/3
CAVE!
With every update of Plex HTPC the libmpv-2.dll gets overwritten and needs to be replaced again.
The user @Harze2k wrote a PowerShell script to automate this process. It checks for updates and replaces the libmpv-2.dll if necessary.
It can be found here => https://forums.plex.tv/t/script-to-automatically-check-update-both-plex-htpc-and-mitzschs-mpv-with-truehd-support/883742
Note about HDR - breaking change!
Starting with build 2025-07-30 17:57 ( https://github.com/mitzsch/mpv-winbuild/releases/tag/2025-07-30-71a6535 ) the libmpv-2.dll now includes the newly introduced “–target-colorspace-hint-mode” option. This defaults to mpv doing the tonemapping and not the display (= no metadata passthrough). To restore the old behavior, add target-colorspace-hint-mode=source to your mpv.conf!
Linked sites:
°1 https://trac.ffmpeg.org/ticket/7731
°2 https://trac.ffmpeg.org/ticket/9569
Have fun with proper TrueHD playback!