mpv-player / mpv

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

Detecting Atmos properly #13193

Closed mdannp closed 1 month ago

mdannp commented 9 months ago

Hi,

for scripting purposes I am looking for a proper way to identify audio with Atmos. I know how to use --audio-spdif="ac3,eac3,dts-hd,truehd,dts" to enable atmos in my setup, but i would like to be able to dynamically enable it. I am using all kinds of properties to detect it like:

The script I currently have works about 95% of the time. Unfortunately, this doesn't work with some EAC3 tracks and I am not able to find any mpv property to help me with those. For example track title is unset, number of channels is 6 and filename doesn't indicate it either.

Mediainfo shows: Audio ID : 2 Format : E-AC-3 JOC Format/Info : Enhanced AC-3 with Joint Object Coding Commercial name : Dolby Digital Plus with Dolby Atmos Codec ID : A_EAC3 Duration : min s Bit rate mode : Constant Bit rate : 768 kb/s Channel(s) : 6 channels Channel layout : L R C LFE Ls Rs Sampling rate : 48.0 kHz Frame rate : 31.250 FPS (1536 SPF) Compression mode : Lossy Stream size : ** MiB (%) Language : English Service kind : Complete Main Default : Yes Forced : No Complexity index : 16 Number of dynamic objects : 15 Bed channel count : 1 channel Bed channel configuration : LFE

There are in theory several properties which would tell me it is an Atmos track:

Is it possible to get any of those 4 within mpv? If yes how? If no, can any of those be added to mpv?

netExtra commented 9 months ago

I was not able to access Format,Commercial Name or Dyanmic Objects under current-tracks. The relevant accessible fields seem to be identical between TrueHD and Atmos. title=??? audio-channels=8 decoder-desc=TrueHD codec=truehd demux-channel-count=8 demux-channels-unknown8 demux-samplerate=4800

In Mediainfo there are some other relevant fields but I wasn't able to access them from current-tracks. codec ID = A_TRUEHD also identical codec name is blank

In an MKV file you can modify some of these MKV header fields. So for example for your Atmos files you could change title to {filename} Atmos then do a profile-cond based on that. Plex screws up the video filename so I do something similar.

mdannp commented 9 months ago

I was not able to access Format,Commercial Name or Dyanmic Objects under current-tracks. The relevant accessible fields seem to be identical between TrueHD and Atmos.

And the same is true between for ex 5.1 Dolby Digital Plus with or without Atmos.

I can run a workaround to use mediainfo directly at the start of a video and check the resulting output. (For example calling a python script which runs mediainfo, parses the result and returns the info to mpv lua script)

I'll probabyl add it that way, but would prefer to have a property within mvp directly.