plexinc / plex-media-player

Next generation Plex Desktop/Embedded Client
GNU General Public License v2.0
1.16k stars 170 forks source link

No audio at all on arm64 and amd64 current 2.54-dev #952

Closed mattgorski closed 4 years ago

mattgorski commented 4 years ago

PMP Version: 2.54-dev Platform Linux/Ubuntu 18.04 amd64 Laptop and NVIDIA Jetson TX1 arm64

Steps to reproduce

  1. Followed build instructions with system QT v5.9.5 ubuntu packages

Current behavior

  1. Zero sound (AC3) even after testing all device outputs in Audio Settings. When pressing "i" info on keyboard nothing shows for audio output/codec/driver etc.

Built MPV on both systems and audio works fine. Tried custom mpv.conf with same results.

Expected behavior

  1. Sound
mseeley commented 4 years ago

Logs?

mattgorski commented 4 years ago

@mseeley Grabbing both logs in a min. Thanks for the reply :)

mattgorski commented 4 years ago

Here is the log from my NVIDIA Jetson TX1 (which I am mainly focused on for a pmp system)

https://pastebin.com/uChKmUj5

Could this be the issue from the log? 2020-03-31 18:42:10 [ INFO ] PlayerComponent.cpp @ 1085 - Audio Config - device: alsa/hdmi:CARD=tegrahda,DEV=0, channel layout: auto, passthrough codecs: none, ac3 transcoding: no

mseeley commented 4 years ago

@gbooker, @rcombs do you see anything out of the ordinary with the attached audio device logs above?

rcombs commented 4 years ago

Are you building current mpv, or using a recent distro-provided package? There's been a change to the hook API that current PMP isn't yet compatible with. I'm not positive when it was introduced, but using mpv 9abb710a should work for now until we get that updated.

chainikdn commented 4 years ago

Here's the mpv change removed legacy hooks API: https://github.com/mpv-player/mpv/commit/2337fa4e0213993398d36cb3222633766d677dfd

mattgorski commented 4 years ago

Thanks a million guys I'll try to build mpv with the provided changes.

kennysgithub commented 4 years ago

FWIW this also affects x86_64 builds (Kubuntu 19.10). Winding back my mpv to commit 9abb710a didn't fix the issue for me, however. I may try winding mpv back to 2337fa4^ if I get time later today.

ETA: mpv wound back to 2337fa4^ restores audio. If I get time I may upload a patch that does an effective git revert 2337fa4 (as it doesn't revert cleanly from master) until such time the PMP devs co-ordinate with the MPV master.

mattgorski commented 4 years ago

Still no audio for me checking out mpv at 2337fa4. I can hear click navigation sounds just no audio driver/codec etc even after selecting alsa/default hdmi 0.3.

kennysgithub commented 4 years ago

Go up one more, to 2337fa4^ (the up-arrow means "the commit before that one").

mattgorski commented 4 years ago

Ahhhh ok one up thanks @kennysgithub

kennysgithub commented 4 years ago

BTW, should we be building PMP against the original MPV repo, or Plexinc's fork, or does it matter?

mattgorski commented 4 years ago

That did the trick! Now how to tell plex to use only specific video codecs, doesnt seem to use the custom mpv.conf in .local/plexmediaplayer. I want to enable specific codecs that allow hardware accel on NVIDIA TX1 but this embedded device doesnt have vdpau or nvdec/nvenc my only option is a custom ffmpeg with nvmpi vc.

--vo=gpu --hwdec=auto --hwdec-codecs=h264_nvmpi,hevc_nvmpi,mpeg2_nvmpi,mpeg4_nvmpi,vp8_nvmpi,vp9_nvmpi --vd=h264_nvmpi,hevc_nvmpi,mpeg2_nvmpi,mpeg4_nvmpi,vp8_nvmpi,vp9_nvmpi

kennysgithub commented 4 years ago

Funny you say that- it was the exact reason why I'd wanted to build PMP myself, to enable vaapi acceleration on my IceLake laptop. Turns out that the player uses libmpv and not the standalone player, so it doesn't use the standard config files- but instead uses library "property" callbacks to set libmpv's characteristics. So I made the following change:

index 8280636..eb3143d 100644
--- a/src/player/PlayerComponent.cpp
+++ b/src/player/PlayerComponent.cpp
@@ -1178,6 +1178,10 @@ void PlayerComponent::updateVideoSettings()
   {
     hwdecMode = "auto-copy";
   }
+  else if (hardwareDecodingMode != "disabled")
+  {
+    hwdecMode = hardwareDecodingMode;
+  }
   mpv::qt::set_property(m_mpv, "hwdec", hwdecMode);
   mpv::qt::set_property(m_mpv, "videotoolbox-format", hwdecVTFormat);

Then what you do is write the hwdec option you'd like to use into the hardwareDecoding entry in the video section of your ~/.local/share/plexmediaplayer/plexmediaplayer.conf file. (Be careful that the "Settings" menu in TV mode doesn't overwrite this).

In my case, I use vaapi-copy, which really reduces my CPU load when watching 4K video.

chainikdn commented 4 years ago

so it doesn't use the standard config files

it does. however it overrides some of parameters, including hwdec.

mattgorski commented 4 years ago

@kennysgithub That's a great workaround!

kennysgithub commented 4 years ago

I just patched up src/player/PlayerComponent.cpp to use the new libmpv hook API; once I double-check it I'll put up a patch here.

Question for the devs: I was going to send up a pull request, but that would mean requiring a MPV_CLIENT_API_VERSION of (lib)mpv >= 108; it's fairly straightforward to support older versions of libmpv via #ifdefs, but would you guys be willing to just want the version requirement?

kennysgithub commented 4 years ago

Here's the patch; seems to be OK. Should handle both API levels seamlessly.

0001-player-Use-new-hooks-API-for-libmpv-107.txt