Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decode error when seeking in H.264 videos #343

Open
Kam1k4dze opened this issue Dec 9, 2024 · 16 comments
Open

Decode error when seeking in H.264 videos #343

Kam1k4dze opened this issue Dec 9, 2024 · 16 comments

Comments

@Kam1k4dze
Copy link

Kam1k4dze commented Dec 9, 2024

When looping is enabled and video starts playing again, a decoding error occurs. It can happen on the first loop or on later ones.
image
Example video with issue: https://leonardo.osnova.io/be20671e-af21-5324-b36a-78597022c012/-/format/mp4/
image
Media resource https://leonardo.osnova.io/be20671e-af21-5324-b36a-78597022c012/-/format/mp4/ could not be decoded, error: Error Code: NS_ERROR_DOM_MEDIA_FATAL_ERR (0x806e0005)
I'm using the git version of nvidia-vaapi-driver
Driver: 565.77-1
GPU: RTX 3060

@elFarto
Copy link
Owner

elFarto commented Dec 10, 2024

I'm not seeing the same issue here. I have just pushed a few more fixes to master, could you retest?

@Kam1k4dze
Copy link
Author

Nothing has changed. If I reproduce it inside MPV with hwdec=VAAPI and the --loop flag. I also get errors:

$ mpv --loop Downloads/ieM4Vz7Z.mp4
● Video  --vid=1  (h264 498x498 14.2857 fps) [default]
Using hardware decoding (vaapi).
VO: [gpu-next] 498x498 vaapi[nv12]
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!

Also, when I play without the --loop flag and go to some timestamp:

mpv cat.mp4 
● Video  --vid=1  (h264 568x480 25 fps) [default]
● Audio  --aid=1  (aac 2ch 44100 Hz 237 kbps) [default]
Using hardware decoding (vaapi).
AO: [pipewire] 44100Hz stereo 2ch floatp
VO: [gpu-next] 568x480 vaapi[nv12]
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
Attempting next decoding method after failure of h264-vaapi.

This also happens when I try to watch Twitch VODs in Firefox.

@elFarto
Copy link
Owner

elFarto commented Dec 10, 2024

Can you run mpv again with NVD_LOG=1 set?

@Kam1k4dze
Copy link
Author

arch% NVD_LOG=1 mpv --loop Downloads/ieM4Vz7Z.mp4
● Video  --vid=1  (h264 498x498 14.2857 fps) [default]
      3770.201644889 [7024-7036] ../src/vabackend.c:2185       __vaDriverInit_1_0 Initialising NVIDIA VA-API Driver
      3770.201653318 [7024-7036] ../src/vabackend.c:2193       __vaDriverInit_1_0 Got DRM FD: 1 28
      3770.201659063 [7024-7036] ../src/vabackend.c:2205       __vaDriverInit_1_0 Now have 0 (0 max) instances
      3770.201661844 [7024-7036] ../src/vabackend.c:2232       __vaDriverInit_1_0 Selecting Direct backend
      3770.241186862 [7024-7036] ../src/direct/nv-driver.c: 292            init_nvdriver Initing nvdriver...
      3770.241213878 [7024-7036] ../src/direct/nv-driver.c: 310            init_nvdriver NVIDIA kernel driver version: 565.77, major version: 565, minor version: 77
      3770.241218689 [7024-7036] ../src/direct/nv-driver.c: 317            init_nvdriver Got dev info: 100 1 2 6
      3770.348738773 [7024-7036] ../src/vabackend.c:1441      nvQueryImageFormats In nvQueryImageFormats
      3770.464795330 [7024-7036] ../src/vabackend.c: 670           nvCreateConfig got profile: 0 with 0 attributes
      3770.464807884 [7024-7036] ../src/vabackend.c:1797 nvQuerySurfaceAttributes with 1 (8) (nil) 0
      3770.464811392 [7024-7036] ../src/vabackend.c:1797 nvQuerySurfaceAttributes with 1 (8) 0x72dcb3080500 8
      3770.470460210 [7024-7036] ../src/vabackend.c:1864 nvQuerySurfaceAttributes Returning constraints: width: 48 - 4080, height: 16 - 4080
      3770.470477070 [7024-7036] ../src/vabackend.c: 953        nvCreateSurfaces2 Creating surface 128x128, format 1 (0x72dcb307c1e0)
      3770.470482369 [7024-7036] ../src/vabackend.c:1535            nvDeriveImage In nvDeriveImage
      3770.470487154 [7024-7036] ../src/vabackend.c: 953        nvCreateSurfaces2 Creating surface 128x128, format 1 (0x72dcb307ccf0)
      3770.470490393 [7024-7036] ../src/vabackend.c:1535            nvDeriveImage In nvDeriveImage
      3770.470503399 [7024-7036] ../src/direct/direct-export-buf.c: 190 direct_allocateBackingImage Allocating BackingImages: 0x72dcb3081c20 128x128
      3770.477836478 [7024-7036] ../src/vabackend.c: 987        nvDestroySurfaces Destroying surface -1 (0x72dcb307ccf0)
      3770.477970475 [7024-7036] ../src/vabackend.c: 953        nvCreateSurfaces2 Creating surface 128x128, format 100 (0x72dcb307efa0)
      3770.477977432 [7024-7036] ../src/vabackend.c:1535            nvDeriveImage In nvDeriveImage
      3770.477986705 [7024-7036] ../src/direct/direct-export-buf.c: 190 direct_allocateBackingImage Allocating BackingImages: 0x72dcb307ee80 128x128
      3770.479401920 [7024-7036] ../src/vabackend.c: 987        nvDestroySurfaces Destroying surface -1 (0x72dcb307efa0)
      3770.479510233 [7024-7036] ../src/vabackend.c: 953        nvCreateSurfaces2 Creating surface 128x128, format 1000 (0x72dcb307cca0)
      3770.479516256 [7024-7036] ../src/vabackend.c:1535            nvDeriveImage In nvDeriveImage
      3770.479523948 [7024-7036] ../src/direct/direct-export-buf.c: 190 direct_allocateBackingImage Allocating BackingImages: 0x72dcb307e1d0 128x128
      3770.480930045 [7024-7036] ../src/vabackend.c: 987        nvDestroySurfaces Destroying surface -1 (0x72dcb307cca0)
      3770.481042108 [7024-7036] ../src/vabackend.c: 953        nvCreateSurfaces2 Creating surface 128x128, format 4 (0x72dcb307cc40)
      3770.481047828 [7024-7036] ../src/vabackend.c:1535            nvDeriveImage In nvDeriveImage
      3770.481055565 [7024-7036] ../src/direct/direct-export-buf.c: 190 direct_allocateBackingImage Allocating BackingImages: 0x72dcb307ef60 128x128
      3770.490328871 [7024-7036] ../src/vabackend.c: 987        nvDestroySurfaces Destroying surface -1 (0x72dcb307cc40)
      3770.490493835 [7024-7036] ../src/vabackend.c: 953        nvCreateSurfaces2 Creating surface 2x2, format 1 (0x72dcb307e200)
      3770.490500247 [7024-7036] ../src/vabackend.c:1535            nvDeriveImage In nvDeriveImage
      3770.490511053 [7024-7036] ../src/vabackend.c:1477            nvCreateImage created image id: 8
      3770.490516926 [7024-7036] ../src/vabackend.c:1650               nvPutImage In nvPutImage
      3770.490522322 [7024-7036] ../src/direct/direct-export-buf.c: 190 direct_allocateBackingImage Allocating BackingImages: 0x72dcb307e580 2x2
      3770.492115776 [7024-7036] ../src/vabackend.c: 987        nvDestroySurfaces Destroying surface -1 (0x72dcb307e200)
      3770.492226237 [7024-7036] ../src/vabackend.c: 953        nvCreateSurfaces2 Creating surface 2x2, format 1 (0x72dcb2d73aa0)
      3770.492232072 [7024-7036] ../src/vabackend.c:1535            nvDeriveImage In nvDeriveImage
      3770.492240465 [7024-7036] ../src/vabackend.c:1477            nvCreateImage created image id: 11
      3770.492245729 [7024-7036] ../src/vabackend.c:1650               nvPutImage In nvPutImage
      3770.492251085 [7024-7036] ../src/direct/direct-export-buf.c: 190 direct_allocateBackingImage Allocating BackingImages: 0x72dcb000cac0 2x2
      3770.493690716 [7024-7036] ../src/vabackend.c: 987        nvDestroySurfaces Destroying surface -1 (0x72dcb2d73aa0)
      3770.493805390 [7024-7036] ../src/vabackend.c: 953        nvCreateSurfaces2 Creating surface 2x2, format 1 (0x72dcb3081340)
      3770.493811169 [7024-7036] ../src/vabackend.c:1535            nvDeriveImage In nvDeriveImage
      3770.493819968 [7024-7036] ../src/vabackend.c:1477            nvCreateImage created image id: 14
      3770.493825141 [7024-7036] ../src/vabackend.c:1650               nvPutImage In nvPutImage
      3770.493830587 [7024-7036] ../src/direct/direct-export-buf.c: 190 direct_allocateBackingImage Allocating BackingImages: 0x72dcb2d75a00 2x2
      3770.495367733 [7024-7036] ../src/vabackend.c: 987        nvDestroySurfaces Destroying surface -1 (0x72dcb3081340)
      3770.495477216 [7024-7036] ../src/vabackend.c: 953        nvCreateSurfaces2 Creating surface 2x2, format 1 (0x72dcb3081340)
      3770.495482838 [7024-7036] ../src/vabackend.c:1535            nvDeriveImage In nvDeriveImage
      3770.495491946 [7024-7036] ../src/vabackend.c:1477            nvCreateImage created image id: 17
      3770.495497652 [7024-7036] ../src/vabackend.c:1650               nvPutImage In nvPutImage
      3770.495503512 [7024-7036] ../src/direct/direct-export-buf.c: 190 direct_allocateBackingImage Allocating BackingImages: 0x72dcb040c5c0 2x2
      3770.496971569 [7024-7036] ../src/vabackend.c: 987        nvDestroySurfaces Destroying surface -1 (0x72dcb3081340)
      3770.497080797 [7024-7036] ../src/vabackend.c: 987        nvDestroySurfaces Destroying surface -1 (0x72dcb307c1e0)
      3770.497087290 [7024-7036] ../src/vabackend.c: 670           nvCreateConfig got profile: -1 with 0 attributes
      3770.497090390 [7024-7036] ../src/vabackend.c: 675           nvCreateConfig Profile not supported: -1
      3770.615855966 [7024-7024] ../src/vabackend.c: 670           nvCreateConfig got profile: 13 with 0 attributes
      3770.615867812 [7024-7024] ../src/vabackend.c:1797 nvQuerySurfaceAttributes with 4 (8) (nil) 0
      3770.615871208 [7024-7024] ../src/vabackend.c:1797 nvQuerySurfaceAttributes with 4 (8) 0x72dcc8001d80 8
      3770.622023530 [7024-7024] ../src/vabackend.c:1864 nvQuerySurfaceAttributes Returning constraints: width: 48 - 4096, height: 16 - 4096
      3770.622035544 [7024-7024] ../src/vabackend.c:1797 nvQuerySurfaceAttributes with 4 (8) (nil) 25232
      3770.622038912 [7024-7024] ../src/vabackend.c:1797 nvQuerySurfaceAttributes with 4 (8) 0x72dcc8001d80 8
      3770.628208776 [7024-7024] ../src/vabackend.c:1864 nvQuerySurfaceAttributes Returning constraints: width: 48 - 4096, height: 16 - 4096
      3770.628226687 [7024-7024] ../src/vabackend.c: 953        nvCreateSurfaces2 Creating surface 512x512, format 1 (0x6290f3629c30)
      3770.628231700 [7024-7024] ../src/vabackend.c:1535            nvDeriveImage In nvDeriveImage
      3770.742438374 [7024-7024] ../src/vabackend.c: 670           nvCreateConfig got profile: 13 with 0 attributes
      3770.742450047 [7024-7024] ../src/vabackend.c:1797 nvQuerySurfaceAttributes with 4 (8) (nil) 0
      3770.742453234 [7024-7024] ../src/vabackend.c:1797 nvQuerySurfaceAttributes with 4 (8) 0x72dcc8001d80 8
      3770.748409472 [7024-7024] ../src/vabackend.c:1864 nvQuerySurfaceAttributes Returning constraints: width: 48 - 4096, height: 16 - 4096
      3770.748420837 [7024-7024] ../src/vabackend.c:1017          nvCreateContext creating context with 0 render targets, 1 surfaces, at 512x512
      3770.748424178 [7024-7024] ../src/vabackend.c:1043          nvCreateContext 0/1 surfaces have been passed to vaCreateContext, this might cause errors. Setting surface count to 32
      3770.759991374 [7024-7076] ../src/vabackend.c: 412          resolveSurfaces [RT] Resolve thread for 0x6290f3c6b860 started
Using hardware decoding (vaapi).
      3770.760412176 [7024-7076] ../src/direct/direct-export-buf.c: 190 direct_allocateBackingImage Allocating BackingImages: 0x72dc640012a0 512x512
      3770.771156155 [7024-7024] ../src/vabackend.c: 953        nvCreateSurfaces2 Creating surface 512x512, format 1 (0x6290f3ca8fe0)
VO: [gpu-next] 498x498 vaapi[nv12]
      3770.771515208 [7024-7076] ../src/direct/direct-export-buf.c: 190 direct_allocateBackingImage Allocating BackingImages: 0x72dc640036d0 512x512
      3770.801860725 [7024-7024] ../src/vabackend.c: 953        nvCreateSurfaces2 Creating surface 512x512, format 1 (0x6290f3cd27f0)
      3770.802209703 [7024-7076] ../src/direct/direct-export-buf.c: 190 direct_allocateBackingImage Allocating BackingImages: 0x72dc64005ba0 512x512
V: 00:00:00 / 00:00:02 (0%)      3770.821599136 [7024-7024] ../src/vabackend.c: 953        nvCreateSurfaces2 Creating surface 512x512, format 1 (0x6290f3cabd60)
      3770.821968965 [7024-7076] ../src/direct/direct-export-buf.c: 190 direct_allocateBackingImage Allocating BackingImages: 0x72dc64008070 512x512
V: 00:00:00 / 00:00:02 (3%)      3770.891956096 [7024-7024] ../src/vabackend.c: 953        nvCreateSurfaces2 Creating surface 512x512, format 1 (0x6290f3cabee0)
      3770.892634580 [7024-7076] ../src/direct/direct-export-buf.c: 190 direct_allocateBackingImage Allocating BackingImages: 0x72dc6400a4a0 512x512
V: 00:00:00 / 00:00:02 (5%)      3770.961932929 [7024-7024] ../src/vabackend.c: 953        nvCreateSurfaces2 Creating surface 512x512, format 1 (0x6290f3cac120)
      3770.962634700 [7024-7076] ../src/direct/direct-export-buf.c: 190 direct_allocateBackingImage Allocating BackingImages: 0x72dc6400c8d0 512x512
V: 00:00:00 / 00:00:02 (8%)      3771.031865392 [7024-7024] ../src/vabackend.c: 953        nvCreateSurfaces2 Creating surface 512x512, format 1 (0x6290f3d1b3a0)
      3771.032613123 [7024-7076] ../src/direct/direct-export-buf.c: 190 direct_allocateBackingImage Allocating BackingImages: 0x72dc6400eda0 512x512
V: 00:00:00 / 00:00:02 (0%)      3773.392009081 [7024-7024] ../src/vabackend.c:1116         nvDestroyContext Destroying context: 22
      3773.392025879 [7024-7024] ../src/vabackend.c: 321           destroyContext Signaling resolve thread to exit
      3773.392033087 [7024-7024] ../src/vabackend.c: 327           destroyContext Waiting for resolve thread to exit
      3773.392041826 [7024-7076] ../src/vabackend.c: 454          resolveSurfaces [RT] Resolve thread for 0x6290f3c6b860 exiting
      3773.392087470 [7024-7024] ../src/vabackend.c: 329           destroyContext pthread_timedjoin_np finished with 0
      3773.629211081 [7024-7024] ../src/vabackend.c: 670           nvCreateConfig got profile: 13 with 0 attributes
      3773.629224910 [7024-7024] ../src/vabackend.c:1797 nvQuerySurfaceAttributes with 4 (8) (nil) 0
      3773.629228798 [7024-7024] ../src/vabackend.c:1797 nvQuerySurfaceAttributes with 4 (8) 0x6290f3636cc0 8
      3773.635386827 [7024-7024] ../src/vabackend.c:1864 nvQuerySurfaceAttributes Returning constraints: width: 48 - 4096, height: 16 - 4096
      3773.635400399 [7024-7024] ../src/vabackend.c:1797 nvQuerySurfaceAttributes with 4 (8) (nil) 25232
      3773.635403699 [7024-7024] ../src/vabackend.c:1797 nvQuerySurfaceAttributes with 4 (8) 0x6290f3636cc0 8
      3773.642118393 [7024-7024] ../src/vabackend.c:1864 nvQuerySurfaceAttributes Returning constraints: width: 48 - 4096, height: 16 - 4096
      3773.758574592 [7024-7024] ../src/vabackend.c: 670           nvCreateConfig got profile: 13 with 0 attributes
      3773.758588042 [7024-7024] ../src/vabackend.c:1797 nvQuerySurfaceAttributes with 4 (8) (nil) 0
      3773.758591454 [7024-7024] ../src/vabackend.c:1797 nvQuerySurfaceAttributes with 4 (8) 0x6290f3636cc0 8
      3773.764665118 [7024-7024] ../src/vabackend.c:1864 nvQuerySurfaceAttributes Returning constraints: width: 48 - 4096, height: 16 - 4096
      3773.764678471 [7024-7024] ../src/vabackend.c:1017          nvCreateContext creating context with 0 render targets, 6 surfaces, at 512x512
      3773.775521714 [7024-7081] ../src/vabackend.c: 412          resolveSurfaces [RT] Resolve thread for 0x6290f3d5f200 started
(...) V: 00:00:00 / 00:00:02 (0%)      3773.776123716 [7024-7081] ../src/direct/direct-export-buf.c: 190 direct_allocateBackingImage Allocating BackingImages: 0x72dc64001270 512x512
      3773.777835977 [7024-7081] ../src/direct/direct-export-buf.c: 190 direct_allocateBackingImage Allocating BackingImages: 0x72dc6400f540 512x512
      3773.789434665 [7024-7081] ../src/direct/direct-export-buf.c: 190 direct_allocateBackingImage Allocating BackingImages: 0x72dc640036d0 512x512
V: 00:00:00 / 00:00:02 (0%)      3773.812589745 [7024-7081] ../src/direct/direct-export-buf.c: 190 direct_allocateBackingImage Allocating BackingImages: 0x72dc6400c8d0 512x512
V: 00:00:00 / 00:00:02 (3%)      3773.884147920 [7024-7081] ../src/direct/direct-export-buf.c: 190 direct_allocateBackingImage Allocating BackingImages: 0x72dc6400a4a0 512x512
V: 00:00:00 / 00:00:02 (5%)      3773.954347088 [7024-7081] ../src/direct/direct-export-buf.c: 190 direct_allocateBackingImage Allocating BackingImages: 0x72dc64009e90 512x512
V: 00:00:00 / 00:00:02 (8%)      3774.023033664 [7024-7024] ../src/vabackend.c:1340             nvEndPicture cuvidDecodePicture failed: 1
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
V: 00:00:00 / 00:00:02 (27%)      3774.510072998 [7024-7024] ../src/vabackend.c:1340             nvEndPicture cuvidDecodePicture failed: 1
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
V: 00:00:01 / 00:00:02 (46%)      3774.999209373 [7024-7024] ../src/vabackend.c:1340             nvEndPicture cuvidDecodePicture failed: 1
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
V: 00:00:01 / 00:00:02 (65%)      3775.489441385 [7024-7024] ../src/vabackend.c:1340             nvEndPicture cuvidDecodePicture failed: 1
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
V: 00:00:02 / 00:00:02 (84%)      3775.979540943 [7024-7024] ../src/vabackend.c:1340             nvEndPicture cuvidDecodePicture failed: 1
[ffmpeg/video] h264: Failed to end picture decode issue: 23 (internal decoding error).
[ffmpeg/video] h264: hardware accelerator failed to decode picture
Error while decoding frame (hardware decoding)!
V: 00:00:00 / 00:00:02 (0%)      3776.379638515 [7024-7024] ../src/vabackend.c:1116         nvDestroyContext Destroying context: 179
      3776.379654744 [7024-7024] ../src/vabackend.c: 321           destroyContext Signaling resolve thread to exit
      3776.379664169 [7024-7024] ../src/vabackend.c: 327           destroyContext Waiting for resolve thread to exit
      3776.379710543 [7024-7081] ../src/vabackend.c: 454          resolveSurfaces [RT] Resolve thread for 0x6290f3d5f200 exiting
      3776.379756861 [7024-7024] ../src/vabackend.c: 329           destroyContext pthread_timedjoin_np finished with 0
      3776.658113941 [7024-7024] ../src/vabackend.c: 670           nvCreateConfig got profile: 13 with 0 attributes
      3776.658127134 [7024-7024] ../src/vabackend.c:1797 nvQuerySurfaceAttributes with 4 (8) (nil) 0
      3776.658131090 [7024-7024] ../src/vabackend.c:1797 nvQuerySurfaceAttributes with 4 (8) 0x6290f3c6ab80 8
      3776.664362117 [7024-7024] ../src/vabackend.c:1864 nvQuerySurfaceAttributes Returning constraints: width: 48 - 4096, height: 16 - 4096
      3776.664375166 [7024-7024] ../src/vabackend.c:1797 nvQuerySurfaceAttributes with 4 (8) (nil) 25232
      3776.664378354 [7024-7024] ../src/vabackend.c:1797 nvQuerySurfaceAttributes with 4 (8) 0x6290f3c6ab80 8
      3776.670718473 [7024-7024] ../src/vabackend.c:1864 nvQuerySurfaceAttributes Returning constraints: width: 48 - 4096, height: 16 - 4096
      3776.791084260 [7024-7024] ../src/vabackend.c: 670           nvCreateConfig got profile: 13 with 0 attributes
      3776.791096742 [7024-7024] ../src/vabackend.c:1797 nvQuerySurfaceAttributes with 4 (8) (nil) 0
      3776.791100132 [7024-7024] ../src/vabackend.c:1797 nvQuerySurfaceAttributes with 4 (8) 0x6290f3636cc0 8
      3776.797349785 [7024-7024] ../src/vabackend.c:1864 nvQuerySurfaceAttributes Returning constraints: width: 48 - 4096, height: 16 - 4096
      3776.797363280 [7024-7024] ../src/vabackend.c:1017          nvCreateContext creating context with 0 render targets, 0 surfaces, at 512x512
      3776.797366653 [7024-7024] ../src/vabackend.c:1043          nvCreateContext 0/1 surfaces have been passed to vaCreateContext, this might cause errors. Setting surface count to 32
      3776.809302634 [7024-7086] ../src/vabackend.c: 412          resolveSurfaces [RT] Resolve thread for 0x6290f3d17240 started
(...) V: 00:00:00 / 00:00:02 (0%)      3776.809794782 [7024-7086] ../src/direct/direct-export-buf.c: 190 direct_allocateBackingImage Allocating BackingImages: 0x72dc64002ca0 512x512
      3776.811700780 [7024-7086] ../src/direct/direct-export-buf.c: 190 direct_allocateBackingImage Allocating BackingImages: 0x72dc64009c60 512x512
(Paused) V: 00:00:00 / 00:00:02 (0%)

@thesword53
Copy link
Contributor

thesword53 commented Dec 10, 2024

I also sometime observe decode errors on Twitch when an ad is starting.

Edit:
I tested several videos and only H.264 ones seem to fail (I tested with VC1, H.264, HEVC, VP8 and VP9 codecs). Seeking H.264 videos decoded with VAAPI on MPV triggers the error.

@elFarto
Copy link
Owner

elFarto commented Dec 11, 2024

I can't seem to reproduce this, either with the linked video in the initial post or any of my test clips. Could you upload a file somewhere that causes the issue for you?

@Kam1k4dze
Copy link
Author

Kam1k4dze commented Dec 11, 2024

https://drive.google.com/drive/folders/1YHhL5Vve5rcoEhi-Bu7W_IxW8ubyYwpo?usp=sharing
This only happens with H.264 files, and not consistently. good.mp4 works about 90% of the time, but sometimes fails, and I'm not sure why. After re-encoding it to bad.mp4, I thought it had started failing all the time, but no, it behaves the same as good.mp4, only failing about 90% of the time and working only 10% of the time.

@elFarto
Copy link
Owner

elFarto commented Dec 11, 2024

I can't get any decode errors using that bad.mp4 file. I can get some very bad visual artefacts but it never errors. This might just be due to our different GPUs (your 3060 vs my 1060) treating bad data differently.

I'll keep poking around and see if I can find anything.

@thesword53
Copy link
Contributor

I can't get any decode errors using that bad.mp4 file. I can get some very bad visual artefacts but it never errors. This might just be due to our different GPUs (your 3060 vs my 1060) treating bad data differently.

I'll keep poking around and see if I can find anything.

What version of Nvidia driver are you using ?

@elFarto
Copy link
Owner

elFarto commented Dec 12, 2024

I'm running 565.77.

@Kam1k4dze
Copy link
Author

I'm using 565.77 nvidia-open driver

@thesword53
Copy link
Contributor

I'm also using the 565.77 proprietary driver without GSP.
I can reproduce the error on both GTX 1060 Mobile and RTX 2080 SUPER.

@elFarto
Copy link
Owner

elFarto commented Dec 12, 2024

Maybe you could try running firefox with MOZ_LOG="PlatformDecoderModule:5 Dmabuf:5" NVD_LOG=1 set and see if that sheds any light on the matter.

@Kam1k4dze
Copy link
Author

MOZ_LOG="PlatformDecoderModule:5 Dmabuf:5" NVD_LOG=1 firefox "https://leonardo.osnova.io/be20671e-af21-5324-b36a-78597022c012/-/format/mp4/" &> logs.txt
logs.txt

@elFarto
Copy link
Owner

elFarto commented Dec 13, 2024

Unfortunately there's nothing in the log file that suggests where the error is. You could try raising this Firefox bug, and see if they have more insight into what could cause the issue. Given that the video decodes fine on my machine, it's likely related to how Firefox/FFMPEG handle seeking and some issue there is causing invalid data to be sent to VA-API.

@thesword53
Copy link
Contributor

I also have errors on H.264 videos when seeking in MPV with arrow keys

@Kam1k4dze Kam1k4dze changed the title Decode error when playing looped video in Firefox. Decode error when seeking in H.264 videos Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants