mpv-player / mpv

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

HDMI output defaulting to stereo in exclusive mode #10668

Open stevenh opened 1 year ago

stevenh commented 1 year ago

Important Information

Provide following Information:

Reproduction steps

Playback a multi channel audio file e.g. flac (sample attached) with a compatible HDMI output device.

Expected behavior

Playback layout should match the file layout if supported by the HDMI output device.

Actual behavior

Playback defaults to stereo.

Log file

htpc.log

Sample files

sample.zip

It's clear that this was an intentional change, but looking at the log it seems that it should be possible to select a compatible layout as the enumeration shows it does know what channel formats are supported.

As the commit which disables multichannel when exclusive mode is enabled was 6 years ago, I'm wondering if its now possible to do better?

mitzsch commented 1 year ago

Playback layout should match the file layout if supported by the HDMI output device.

With mpv and Plex HTPC this works. For Plex HTPC you need to select exclusive mode, HDMI for audio output and 7.1 for channel count, then it should work. (Auto does not work - This was different in Plex Media Player as far as I can remember it - Plex HTPC uses -audio-channels=auto-safe, whereas PMP used -audio-channels=auto)

For -audio-channels=auto-safe have a lookt at the manual => https://mpv.io/manual/master/#options-audio-channels

For mpv run mpv.com 7.1-multichannelfile.mkv -audio-exclusive=yes -audio-channels=auto and it should work.

stevenh commented 1 year ago

Yes enabling exclusive in Plex HTPC settings and then overriding audio-channels in mpv.conf works, but it's not obvious, resulting in a poor user experience. You can see that in the thread I created on the Plex forums, to get to this point.

So with that in mind, I'm wondering if that could be improved? From what I saw in the log mpv does know which layouts are supported, given this could that knowledge be used so that audio-channels=auto-safe works out the box?

The goal is to improve the end user experience, avoiding them having to manually config it.

Thoughts?

mitzsch commented 1 year ago

Yes enabling exclusive in Plex HTPC settings and then overriding audio-channels in mpv.conf works, but it's not obvious, resulting in a poor user experience.

Well, you don´t need to add it to the mpv.conf, setting it up in the Plex HTPC settings should be (is) sufficient. But yes not very user-friendly, I also needed some time to find the settings needed to get it working. (without the need of an mpv.conf)

I will fire up PlexMediaPlayer/Plex HTPC tomorrow on my HTPC to back up my statement regarding the audio-channel line. * For PMP it was managed here => https://github.com/plexinc/plex-media-player/blob/d9685b274934855a707a37613cae09108ee9db6c/src/player/PlayerComponent.cpp#L1103

So with that in mind, I'm wondering if that could be improved? From what I saw in the log mpv does know which layouts are supported, given this could that knowledge be used so that audio-channels=auto-safe works out the box?

Well, to get it working the plex devs need to change the regarding line to audio-channels=auto, then it should work. (Same experience as in PMP) I was never able to get the correct layout with audio-channels=auto-safe.

stevenh commented 1 year ago

Well, you don´t need to add it to the mpv.conf, setting it up in the Plex HTPC settings should be (is) sufficient. But yes not very user-friendly, I also needed some time to find the settings needed to get it working. (without the need of an mpv.conf)

As far as I can tell there is no option in the HTPC settings that controls the audio-channels, the only option was adding an mpv.conf. Plex Media Player doesn't have this problem as the version of mpv used predates the mentioned changed so there was no audio-channels=auto-safe (the new default).

Well, to get it working the plex devs need to change the regarding line to audio-channels=auto, then it should work. (Same experience as in PMP) I was never able to get the correct layout with audio-channels=auto-safe.

That would work but still doesn't fix it for any other mpv users. If mpv knows the supported layouts of the device then by definition they are safe, unless I'm missing something?

In this case improving the smarts of selection process so that it chooses from only those supported layouts would be the best route as it fixes it for everyone.

mitzsch commented 1 year ago

I don't know if it belongs here or better in the plex forum, but well now we are here I will continue to post it here.

As far as I can tell there is no option in the HTPC settings that controls the audio-channels, the only option was adding an mpv.conf.

There is, have look at the pictures:

Screenshot 2022-09-22 095910-phtpc-7 1-settingspng

Screenshot 2022-09-22 095910-phtpc-7 1-cropped

Screenshot 2022-09-22 095910-phtpc-auto-settings

Screenshot 2022-09-22 095910-phtpc-auto-cropped


Screenshot 2022-09-22 095407-pmp-7 1-settings

Screenshot 2022-09-22 095407-pmp-7 1

Screenshot 2022-09-22 095407-pmp-auto-settings

Screenshot 2022-09-22 095407-pmp-auto


That would work but still doesn't fix it for any other mpv users.

That's probably true, but mpv is not an out-of-the-box perfect media player it needs some tinkering by the user. There is a manual available, but yeah regarding this one it could have been written a bit clearer. So if you want to automatically set the output based on the file's audio layout you need to add -audio-exclusive=yes -audio-channels=auto to the command line or the mpv.conf.

stevenh commented 1 year ago

Thanks @mitzsch, you're correct there are workarounds however the goal of raising this issue is to improve mpv so any consumers of it will benefit.

I've checked the code out and will do some hacking and see what I can come up with.