MPV regression (FFmpeg?)

Hi all,

I’ve experienced a dramatic drop in performance from MPV as of today. Playback drops frames and lowering quality down from 1080p to 720p doesn’t seem to make any difference, I think it might be ffmpeg. I tried with --no-audio just in case itwas muxing thing but no joy.

It seems to affect all container formats.


[ffmpeg] AVHWDeviceContext: Cannot load libcuda.so.1 [ffmpeg] AVHWDeviceContext: Could not dynamically load CUDA Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory Cannot load libcuda.so.1 [ffmpeg/video] h264_v4l2m2m: Could not find a valid device [ffmpeg/video] h264_v4l2m2m: can't configure decoder Could not open codec.

Those last two ffmpeg errors are new, I think. I’ve been updating regularly with no problems but something appears to have changed. This is a normal Reform based on Sysimage v3, and updated frequently.

Hi, we used to patch ffmpeg to do hardware acceleration but we stopped doing that in June this year. Since then, mpv is basically not usable with 1080p h264 video on the reform because everything gets rendered in software and the imx8mq is too slow for that.

It would be interesting to find out what you changed between the time when it worked for you and now. Does /var/log/apt/history.log offer any clues?

Confirmed. Something changed in mpv. With version 0.34.1-1+b5 I can watch low-bitrate h264 1080p video but with 0.35.0-4 I cannot. I reported the problem here:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1027455

The workaround for the moment is to downgrade back to 0.34.1-1+b5. You can obtain old versions of packages from snapshot.debian.org:

http://snapshot.debian.org/archive/debian/20220921T064819Z/pool/main/m/mpv/mpv_0.34.1-1%2Bb5_arm64.deb

I bisected mpv upstream git and found out that the following commit broke software decoding on the reform:

The commit can be reverted cleanly on the latest mpv release, so until this is fixed properly, we could ship a patched mpv in the reform repo.

2 Likes

Thanks so much for looking into it @josch , a very happy new year to you.

Also, running (unpatched) mpv 0.35.0 with --vd-lavc-dr=no should also solve this issue. @Sully_B can you confirm?

1 Like

Yes, I can confirm this restores the previous performance on all my test videos. Thanks, will add to my conf.

For the record, the imx8mq can absolutely decode 1080p@25 in software. I have been using VLC since a while to watch movies instead of mpv, FWIW.

1 Like

VLC has been my benchmark as it always plays back smoothly, however i prefer mpv and yt-dlp for watching YouTube and Vimeo content.
Chromium also does pretty well with 720 and 1080 video,but in my experience uses more CPU versus VLC and MPV.

I also use VLC with my plex server to playback streams via UPnP - it is superior to the browser client.

The MNT Reform Debian repos now ship a patched version of mpv, so no need anymore to add environment variables or config options.

As for smooth playback: Yes, the imx8mq can do 1080p@25 in software. The reason why i switched to a player (clapper) that can do hardware decoding is, that it becomes harder and harder to find videos on youtube or twitch that are 1080p@25. Most stuff I consume seems to get encoded in 1080p@60 and even the 720p is only available in 60 fps which the imx8mq can sadly not do without stuttering and going even lower to 480p would be really painful. :frowning:

I can’t believe I didn’t know about Clapper!

Theoretically mpv can also do hardware decoding via ffmpeg. There is a patch set that has been rebased for years but never found its way into ffmpeg proper for reasons unknown to me. Supposedly, these patches work well for Kodi, as they are used by LibreELEC: LibreELEC.tv/packages/multimedia/ffmpeg/patches at master · LibreELEC/LibreELEC.tv · GitHub

But LibreELEC uses ffmpeg 4.4.1 while Debian is at 5.1.2. Rebased patches for that popped up as well after a couple of months at GitHub - jernejsk/FFmpeg and when I build ffmpeg with these patches, the h264 videos I open in mpv do get decoded in hardware (no cpu usage) but the video is all tinged in red and kinda unwatchable. If I try out h264 video, an error is thrown.

Since this isn’t working and since ffmpeg doesn’t seem interested to support this, I have personally switched to clapper. I packaged it for Debian in July last year and have been using it since. Together with gtuber (by the same author) I can use clapper to watch YouTube and Twitch as well.

1 Like

Genuinely very useful. Thanks!

only on sid, stable is still on 4.3.5

Correct, but are you running Debian stable on your Reform?

that’s the idea, sid has far too much chance of b0rking something when it updates

Cool! How did you install it? What workaround were needed?

still working on it. for the moment ive managed to strip systemd out of sid.