mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
28.83k stars 2.93k forks source link

Passthrough for Dolby Atmos / DTS:X (only) #12703

Open eXmendiC opened 1 year ago

eXmendiC commented 1 year ago

What currently works

mpv does support Dolby Atmos and DTS:X passthrough via the option "audio-spdif", but since Dolby Atmos and DTS:X aren't codecs itself and just extensions to existing ones, it can't destinct between them and regular DTS-HD/EAC3/TrueHD.

audio-spdif=dts-hd includes DTS:X audio-spdif=eac3,truehd includes Dolby Atmos

Why does this matter?

Not setting "audio-spdif" will output PCM to your sound device, which is totally fine for regular EAC3/TrueHD and DTS-HD. Lossy or lossless to lossless conversion won't hurt the audio quality and PCM with 7.1 channel setup is supported. However, what PCM doesn't have is support for object-based extensions. That means you lose information with PCM playback in that case (with a supported device).

Why not passthrough all codecs

Using "audio-spdif=eac3,truehd" (Dolby Atmos) comes with some disadvatage like "video-sync=display-resample" not working (thus, no "interpolation=yes") or no audio control with mpv. Which is a trade-off that is worth for Dolby Atmos, but not for regular EAC3 or TrueHD playback (in my opinion).

What should change

An option to add "atmos", "dtsx" to "audio-spdif" or maybe even a whole rework of this option (with a better naming), because despite the kinda misleading warning in the docs, this option still matters for HDMI connections (via arc/earc or soundbar) connections. Maybe it might be worth to consider "aac", "flac", etc. (if possible) as options as well, because some soundbars do indeed support such playback and some users might even prefer passthrough for that.

Information that might matter

ffmpeg added detection for Dolby Atmos/DTS:X this year. https://github.com/FFmpeg/FFmpeg/commit/96ed043afa44d468ff3629095f90d391450c4e60 https://github.com/FFmpeg/FFmpeg/commit/98a4699216fbc3a4e382ba6a10026eab39b5214e

cest-la-v commented 1 year ago

Thanks for the config, now I'm using this to auto enable Atmos passthrough. 💯

[audio_DolbyAtmos]
 profile-desc = Dolby Atmos
 profile-cond = filename:match("%.Atmos.")
 profile-restore = copy
 audio-spdif=eac3,truehd
SonaliBendre commented 3 months ago

Thanks, i also automate