MPEG-4 Radeon VDPAU hwdec; Random chance of garbling/corruption
I found a bug the other week which I reported to the mesa devs. (Note, this is entirely separate to the similar-looking issue with MPEG-4 ASP videos garbling!)
The details have changed slightly since my original report to mesa: at present, mplayer and VLC do not exhibit this particular problem, only mpv.
== Steps to reproduce ==
- Have AMD APU system (E2-1800, PALM)
- Use Arch Linux, with the FOSS drivers (
7.3.0) andmesa 10.0.3 - Use
mpv 0.3.5 - View an affected MPEG-4 file (happens for all those I've tested, though those encoded with ASP are unrelated), using
vo_vdpauorvo_opengl,hwdec=vdpau, andhwdec-codecs=all
Affected files include this and this.
It might decode just fine. It might garble to all hell. It doesn't seem to depend on anything. If a file starts decoding correctly, it doesn't garble later on, and vice versa.
In my initial mesa bug report (i.e. the other month) this happened when using any player, but now only seems to happen with mpv. I'm certain that mplayer and VLC are indeed using VDPAU for hardware-decoding, because
radeon-profileclearly shows that the UVD clocks activate during playback- VLC and mplayer both exhibit the other hwdec bug (for ASP)
I'll add some verbose logs and so on in a second; and if there's anything else that would be relevant, just ask. :smile:
Maybe these files use global motion compensation, a rare feature which is not implemented by most hw decoders. As such, it would be the fault of driver vendors for wrongly advertising complete mpeg4 support.
This is also the reason why mpv doesn't do mpeg4 hw decoding by default.
PS: when comparing with other players, make sure they use exactly the same libavcodec version and the same demuxer (i.e. libavformat).
- If it's GMC not being implemented by the HW decoder, then why do the files work sometimes, (randomly) dependent on repeatedly reopening the file? (I re-emphasise that this is NOT the issue where some MPEG-4 ASP videos consistently and reproducibly fail, i.e. the other bug I reported to the freedesktop tracker)
- The files did work fine on the same hardware when using hwdec via vaapi with catalyst, so the hardware decoder itself is fine. Almost every single MPEG-4 (DivX/XviD) video that I have exhibits this "per-playback random chance of being garbled" issue with vdpau...
- (of particular interest) VLC has started exhibiting this behaviour again. I haven't rebooted since making my initial post here or updated any relevant packages, and VLC had definitely been consistently working, but now it has the same random-chance crap that mpv does. mplayer seems to "work" each time still, possibly due to differing internal libavcodec versions?
- Mplayer reports
libavformat version 55.19.104 (internal)andlibavcodec version 55.39.100 (internal) - mpv reports
libavformat 55.19.104andlibavcodec 55.39.101(not much difference...)
Maybe it's a timing dependent bug, which would probably hint on a driver (or hardware) bug, unless both mpv and vlc use the vdpau API incorrectly.
Like I say - I'm happy to give additional information and so on; but I myself have no idea what further information to give. I posted some playback and dmesg logs in the freedesktop bug report, and nothing is any different really for those from back then.
EDIT: THE ANALYSIS IN THIS POST SEEMS TO NO LONGER APPLY (OR TECHNICALLY NEVER APPLIED BEYOND COINCIDENCE), AND THE BEHAVIOUR APPEARS TO BE ESSENTIALLY RANDOM
I've updated to mesa 10.1 which has had no effect on the problem, but has caused me to notice something I hadn't before.
- when using the laptop's internal screen, whether or not the current attempt at a file garbles is random
- when connected to an external screen (HDMI), the attempt is almost guaranteed to be successful
- opening another file while the first is playing, including another instance of the same file, is almost guaranteed to be unsuccessful, while the initial instance continues unaffected
- opening a file after the first has terminated is, again, almost guaranteed to be successful
Even more interestingly:
- (still when using HDMI), with a garbled instance of a file open, close (or pause!) the initial successful instance, and open another file
- the new instance is ungarbled(!) and the garbled instance remains so
I can have two or three successful instances open this way, but more seem to just garble indiscriminately.
Status of this?
@wm4: It makes about as little sense as it ever did, if not less. The issue is still present for me, but my analysis in the most recent post of mine before this one no longer seems to be valid (assuming it ever was, beyond coincidence). It appears to actually be as I initially thought in the OP, i.e. completely random (or at least, caused by something I am unaware of).
I'm currently running linux 3.13.9 with mesa 10.1 and mpv 0.3.7 with ffmpeg 2.2.
So I'm still at a loss. Is there anyone else with this behaviour?
@aphirst you mean the video randomly blows up into green blocks?
That is exactly the issue, yes. There are full details in the mesa bug report. Someone was able to find a workaround for this one, but there's no indication on whether it will be included in a subsequent driver release, or whether they intend to work out a better solution. But the underlying issue is known at this point, something to do with allocating insufficient amounts of memory, if memory serves (ha).
In any case, I do think that this would mean that at the very least, this bug should be closed here as not our bug. I won't do it myself in case anyone disagrees, but I won't object if a maintainer does close it.
Leaving it open - might help someone else to find this.