mpv-player / mpv

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

Got `Error parsing OBU data` for playing AV1 video clip #12326

Open runlevel5 opened 1 year ago

runlevel5 commented 1 year ago

Info

$ cat /etc/fedora-release 
Fedora release 39 (Thirty Nine)
$ uname -ar
Linux shrimp-paste 6.5.0-57.fc39.ppc64le #1 SMP Mon Aug 28 11:46:04 UTC 2023 ppc64le GNU/Linux
mpv 0.36.0 Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects
 built on UNKNOWN
libplacebo version: v6.292.1
FFmpeg version: 6.0
FFmpeg library versions:
   libavutil       58.2.100
   libavcodec      60.3.100
   libavformat     60.3.100
   libswscale      7.1.100
   libavfilter     9.3.100
   libswresample   4.10.100
dnf5 info libdav1d
Updating and loading repositories:
 Fedora 39 openh264 (From Cisco) - ppc64le                                                     100% |   2.1 KiB/s |   5.1 KiB |  00m02s
 RPM Fusion for Fedora 39 - Free - Test Updates                                                100% |   8.4 KiB/s |  22.0 KiB |  00m03s
 RPM Fusion for Fedora 39 - Nonfree - NVIDIA Driver                                            100% |  17.1 KiB/s |  19.0 KiB |  00m01s
 RPM Fusion for Fedora 39 - Free                                                               100% |  96.3 KiB/s | 163.0 KiB |  00m02s
 Fedora 39 - ppc64le - Updates                                                                 100% |  13.3 KiB/s |  11.0 KiB |  00m01s
 Fedora 39 - ppc64le                                                                           100% |   1.6 MiB/s |  32.4 MiB |  00m21s
Repositories loaded.
Installed packages
Name            : libdav1d
Epoch           : 0
Version         : 1.2.1
Release         : 2.fc39
Architecture    : ppc64le
Installed size  : 785.4 KiB
Source          : dav1d-1.2.1-2.fc39.src.rpm
From repository : anaconda
Summary         : Library files for dav1d
URL             : https://code.videolan.org/videolan/dav1d
License         : BSD
Description     : Library files for dav1d, the AV1 cross-platform Decoder.
Vendor          : Fedora Project

When I play an AV1 encoded video clip with vaapi, I got following error in the mpv output:

[ffmpeg/video] libdav1d: Error parsing OBU data
Error while decoding frame!

Full log: https://gist.github.com/runlevel5/403ecaa87dc4bff9e88f6ff35c1fa16e

I am totally unsure if this is a bug or not so I resolve to ask a question instead.

sfan5 commented 1 year ago

I am totally unsure if this is a bug or not so I resolve to ask a question instead.

The required information to tell whether this is a bug is however contained inside inside the bug report template. Please fill it out.

Traneptora commented 1 year ago

We still need a log file, for example.

runlevel5 commented 1 year ago

The required information to tell whether this is a bug is however contained inside inside the bug report template. Please fill it out.

Thanks. I will follow up on that now

runlevel5 commented 1 year ago

@Traneptora @sfan5 https://gist.github.com/runlevel5/403ecaa87dc4bff9e88f6ff35c1fa16e

sfan5 commented 1 year ago

You appear to be toggling hwdec mid playback, does this still happen if you use vaapi or no hwdec from the beginning (without toggling)?

runlevel5 commented 1 year ago

You appear to be toggling hwdec mid playback, does this still happen if you use vaapi or no hwdec from the beginning (without toggling)?

I do not face this issue if I turn on hwdec from the beginning

x5f3759df commented 5 months ago

Got this on Windows 11 with mpv-git from scoop repo.

mpv v0.37.0-561-g3afcaeb7 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
 built on Mar 17 2024 00:11:00
libplacebo version: v7.349.0 (v6.338.0-118-g4fdb9c0-dirty)
FFmpeg version: N-114224-gde2fb43e7
FFmpeg library versions:
   libavutil       59.2.100
   libavcodec      61.1.101
   libavformat     61.0.100
   libswscale      8.0.100
   libavfilter     10.0.100
   libswresample   5.0.100```

I got autoprofile in my config, looks like that

[AV1]
#profile-cond=p["video-format"]=="av1"
gpu-api=d3d11
hwdec=d3d11va
interpolation=no
video-sync=desync

If I load it manually - it works just fine, but when it loaded automatically - it get same error. You mention switching hwdec on a fly and yes, I have this one, my config is by default:

vo=gpu-next
hwdec=vulkan
gpu-api=vulkan

My guess that mpv doesn't do api and hwdec switching on a fly well enough or it doesn't load autoprofile early, so this problem occurs, because manually profile works just fine. Hope this helps.

obscenelyvague commented 1 month ago

I encountered this issue on Android. Here it leads to A/V desync which eventually corrects itself after 10-15 seconds and decoding also starts working normally. Doesn't happen with every file and cannot be reproduced 100% of the time. Reproducibility is still high for files that it does happen on though. When it happens, such spam is seen from libdav1d for some period of time, eventually stops and starts swdec normally:

[15301.638][v][vd] Using software decoding.
[15301.638][v][vd] Detected 8 logical cores.
[15301.638][v][vd] Requesting 9 threads for decoding.
[15301.638][d][ffmpeg/video] libdav1d: libdav1d 1.4.2-15-g2355eeb
[15301.638][d][mkv] stream 1: resize index to 256
[15301.662][e][ffmpeg/video] libdav1d: Error parsing OBU data
[15301.662][w][vd] Error while decoding frame!
[15301.662][e][ffmpeg/video] libdav1d: Error parsing OBU data
[15301.662][w][vd] Error while decoding frame!
[15301.662][e][ffmpeg/video] libdav1d: Error parsing OBU data
[15301.662][w][vd] Error while decoding frame!
[15301.662][e][ffmpeg/video] libdav1d: Error parsing OBU data
[15301.662][w][vd] Error while decoding frame!
[15301.664][d][mkv] stream 2: resize index to 256
[15301.671][v][vd] Using software decoding.

// No more spam after this point

The way to trigger this is to make mpv kick it into av1 swdec using libdav1d from an auto profile. Something like this should trigger it if your HW doesn't have av1 hwdec

hwdec=no

[AV1]
profile-cond=p['video-format']=='av1'
# Make mpv kick it into swdec again
hwdec=auto

Reminder, it doesn't happen if you only had hwdec=auto or hwdec=no in your config file for example. Only if you do as such from a profile.

I tried not whitelisting av1 for hw decode when setting the profile but no dice.