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

Video artifacting + MPV crashes itself and GPU driver when seeking #15366

Open
6 tasks done
JohhanSam opened this issue Nov 23, 2024 · 10 comments
Open
6 tasks done

Video artifacting + MPV crashes itself and GPU driver when seeking #15366

JohhanSam opened this issue Nov 23, 2024 · 10 comments
Labels

Comments

@JohhanSam
Copy link
Contributor

mpv Information

mpv 0.39.0 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
built on Sep 28 2024 01:31:20
libplacebo version: v7.349.0 (v7.349.0-13-ga018ab0-dirty)
FFmpeg version: N-117212-g01c47dd23
FFmpeg library versions:
libavcodec      61.20.100
libavdevice     61.4.100
libavfilter     10.5.100
libavformat     61.8.100
libavutil       59.40.100
libswresample   5.4.100
libswscale      8.4.100

Other Information

- Windows version: 11 23H2
- GPU model, driver and version: Vega 8 - adrenalin 23.11.1
- Source of mpv: shinchiro
- Latest known working version: x
- Issue started after the following happened: x

Reproduction Steps

Play the video with hwdec enabled:

  • Video will start full of artifacts, fixes itself after keyframe/scene change
  • When doing multiple seeks it crashes the MPV and GPU driver

Something important to note is that it only happens with files that came from the same source as the one in sample files. Other videos work no problem.

Expected Behavior

Disable hwdec if not working properly to not crash

Actual Behavior

Artifacts
Seeking crashes MPV and GPU driver

Log File

logforhwdec.txt

Sample Files

https://drive.google.com/file/d/1tJ-3c-WdNyIcddAgL4fZ2lcUymQdVtza/view?usp=sharing

I carefully read all instruction and confirm that I did the following:

  • I tested with the latest mpv version to validate that the issue is not already fixed.
  • I provided all required information including system and mpv version.
  • I produced the log file with the exact same set of files, parameters, and conditions used in "Reproduction Steps", with the addition of --log-file=output.txt.
  • I produced the log file while the behaviors described in "Actual Behavior" were actively observed.
  • I attached the full, untruncated log file.
  • I attached the backtrace in the case of a crash.
@llyyr
Copy link
Contributor

llyyr commented Nov 23, 2024

[ 10.607][e][vo/gpu/d3d11] Failed to create SRV: The GPU device instance has been suspended. Use GetDeviceRemovedReason to determine the appropriate action. (0x887a0005)

Does it also happen with vo=gpu-next?

@JohhanSam
Copy link
Contributor Author

JohhanSam commented Nov 23, 2024

[ 10.607][e][vo/gpu/d3d11] Failed to create SRV: The GPU device instance has been suspended. Use GetDeviceRemovedReason to determine the appropriate action. (0x887a0005)

Does it also happen with vo=gpu-next?
log-next.txt

It does. Log for gpu-next: log-next.txt

@llyyr
Copy link
Contributor

llyyr commented Nov 23, 2024

[ 28.251][e][vo/gpu-next/libplacebo] Device lost!

[ 28.251][e][vo/gpu-next/libplacebo] ID3D11Device_CreateShaderResourceView(p->dev, tex_p->res, &srvdesc, &tex_p->srv): The GPU will not respond to more commands, most likely because of an invalid command passed by the calling application. (DXGI_ERROR_DEVICE_HUNG, 0x887a0006) (../../../../../src_packages/libplacebo/src/d3d11/gpu_tex.c:73)

Most likely an issue with the driver, report to amd.

@kasper93
Copy link
Contributor

kasper93 commented Nov 23, 2024

Does --hwdec=auto-copy also crashes? It's likely your hardware decoder / driver is crashing during decoding of this file, we cannot really do much about it. The d3d11va decoder is pretty much stable in ffmpeg, so I doubt there is any issue there. Also try finding newer GPU driver adrenalin 23.11.1 is last year, unless you meant 24... in which case did it work with previous drivers? Vega 8 is pretty old, so probably not well tested anymore.

@JohhanSam
Copy link
Contributor Author

Does --hwdec=auto-copy also crashes? It's likely your hardware decoder / driver is crashing during decoding of this file, we cannot really do much about it. The d3d11va decoder is pretty much stable in ffmpeg, so I doubt there is any issue there. Also try finding newer GPU driver adrenalin 23.11.1 is last year, unless you meant 24... in which case did it work with previous drivers? Vega 8 is pretty old, so probably not well tested anymore.

I did try copy-back, same result sadly. As for the drivers, currently testing every version top to bottom. (still no working one sadly)
Reported to AMD using the newest one.

Vulkan works normally, will test OpenGL bit later.

@kasper93
Copy link
Contributor

Actually I can also reproduce the artifacting issue.

@Jules-A
Copy link

Jules-A commented Nov 23, 2024

On my 6700XT I have issue with that file even without using HWDec... No artifacts but it has issues seeking, causing the video to keep repeating the same frames instead over and over instead of going to the correct position and the MPV OSD gets stuck and doesn't move. It also causes ~60% CPU usage on my 5700X which is pretty crazy. It also can't seek to 0.

Media info reports this: Frame rate : 1 151.189 FPS What on earth???

@JohhanSam
Copy link
Contributor Author

JohhanSam commented Nov 23, 2024

Media info reports this: Frame rate : 1 151.189 FPS What on earth???

The clip was made with just ffmpegs copy and -ss -t, now that you mentioned it, I did a few tests, and when cutting different times, it always produces different framerate value for the source I'm using, always around 2x+ in FPS value reported by mediainfo. Started uploading the full source file, will take a bit. (50mins)

Also just in case gonna mention that all the issues ive mentioned happen on both the clip and full source.

@JohhanSam
Copy link
Contributor Author

Full source here: source

@kasper93
Copy link
Contributor

I got a lot of VVL errors when decoding this sample. @cyanreg not sure if you are interested in those.

Mostly two of them.

VUID-vkCmdBeginVideoCodingKHR-slotIndex-07239

[   0.318][e][vo/gpu-next/libplacebo] vk Validation Error: [ VUID-vkCmdBeginVideoCodingKHR-slotIndex-07239 ] Object 0: handle = 0x9638f80000000036, type = VK_OBJECT_TYPE_VIDEO_SESSION_KHR; | MessageID = 0xc36d9e29 | vkCmdBeginVideoCodingKHR():  DPB slot index 3 is not active in VkVideoSessionKHR 0x9638f80000000036[].
[   0.318][e][vo/gpu-next/libplacebo] The Vulkan spec states: If the slotIndex member of any element of pBeginInfo->pReferenceSlots is not negative, then it must specify the index of a DPB slot that is in the active state in pBeginInfo->videoSession at the time the command is executed on the device (https://vulkan.lunarg.com/doc/view/1.3.296.0/windows/1.3-extensions/vkspec.html#VUID-vkCmdBeginVideoCodingKHR-slotIndex-07239)
[   0.318][e][vo/gpu-next/libplacebo]     using VkVideoSessionKHR: anon (0x9638f80000000036)
[   0.320][e][vo/gpu-next/libplacebo]   Backtrace:
[   0.324][e][vo/gpu-next/libplacebo]     #0  0x7ffb5784537c in vk_dbg_utils_cb+0x25c F:\dev\libplacebo\src\vulkan\context.c:520+0x9
[   0.370][e][vo/gpu-next/libplacebo]     #1  0x7ffb265c6a63 in DebugReport::DebugLogMsg+0xc93 C:\j\msdk0\build\Vulkan-ValidationLayers\repo\layers\error_message\logging.cpp:252+0x12
[   0.370][e][vo/gpu-next/libplacebo]     #2  0x7ffb265c8631 in DebugReport::LogMsg+0xdc1 C:\j\msdk0\build\Vulkan-ValidationLayers\repo\layers\error_message\logging.cpp:662+0x25
[   0.371][e][vo/gpu-next/libplacebo]     #3  0x7ffb26011674 in ValidationObject::LogError+0x34 C:\j\msdk0\build\Vulkan-ValidationLayers\repo\layers\vulkan\generated\chassis.h:2375+0x2d
[   0.373][e][vo/gpu-next/libplacebo]     #4  0x7ffb261a004d in <lambda_f5d4dd00dddd4e0b5adc258a05218c48>::operator()+0x17d C:\j\msdk0\build\Vulkan-ValidationLayers\repo\layers\core_checks\cc_video.cpp:3564+0x99
[   0.375][e][vo/gpu-next/libplacebo]     #5  0x7ffb261131e3 in CommandBufferSubmitState::Validate+0x583 C:\j\msdk0\build\Vulkan-ValidationLayers\repo\layers\core_checks\cc_queue.cpp:95+0x33
[   0.376][e][vo/gpu-next/libplacebo]     #6  0x7ffb261154d6 in CoreChecks::ValidateQueueSubmit2+0x6b6 C:\j\msdk0\build\Vulkan-ValidationLayers\repo\layers\core_checks\cc_queue.cpp:341+0x47
[   0.379][e][vo/gpu-next/libplacebo]     #7  0x7ffb26249336 in vulkan_layer_chassis::QueueSubmit2+0x146 C:\j\msdk0\build\Vulkan-ValidationLayers\repo\layers\vulkan\generated\chassis.cpp:7912+0x22
[   0.389][e][vo/gpu-next/libplacebo]     #8  0x7ffb2c1f6527 in ff_vk_exec_submit+0xe7 E:\dev\ffmpeg\libavutil\vulkan.c:862+0x17
[   0.389][e][vo/gpu-next/libplacebo]     #9  0x7ffb2c1fef85 in ff_vk_decode_frame+0x965 E:\dev\ffmpeg\libavcodec\vulkan_decode.c:540+0xa
[   0.389][e][vo/gpu-next/libplacebo]     #10 0x7ffb2c20be72 in vk_h264_end_frame+0x2a2 E:\dev\ffmpeg\libavcodec\vulkan_h264.c:541+0x1f
[   0.390][e][vo/gpu-next/libplacebo]     #11 0x7ffb2b9adf26 in ff_h264_field_end+0x86 E:\dev\ffmpeg\libavcodec\h264_picture.c:207+0x5
[   0.390][e][vo/gpu-next/libplacebo]     #12 0x7ffb2b9ca55c in h264_decode_frame+0x113c E:\dev\ffmpeg\libavcodec\h264dec.c:1086+0x14
[   0.390][e][vo/gpu-next/libplacebo]     #13 0x7ffb2b816a2e in ff_decode_receive_frame_internal+0x2ee E:\dev\ffmpeg\libavcodec\decode.c:649+0x201
[   0.390][e][vo/gpu-next/libplacebo]     #14 0x7ffb2b817156 in decode_receive_frame_internal+0x26 E:\dev\ffmpeg\libavcodec\decode.c:666+0xa
[   0.391][e][vo/gpu-next/libplacebo]     #15 0x7ffb2b817111 in avcodec_send_packet+0xd1 E:\dev\ffmpeg\libavcodec\decode.c:753+0x4
[   0.403][e][vo/gpu-next/libplacebo]     #16 0x7ff6bf3b18af in send_packet+0x10f E:\dev\mpv\video\decode\vd_lavc.c:1149+0x14

VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07266

[   0.717][e][vo/gpu-next/libplacebo] vk Validation Error: [ VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07266 ] Object 0: handle = 0x9638f80000000036, type = VK_OBJECT_TYPE_VIDEO_SESSION_KHR; | MessageID = 0x8831fd30 | vkCmdDecodeVideoKHR():  DPB slot index 2 of VkVideoSessionKHR 0x9638f80000000036[] does not currently contain a frame with the specified video picture resource: VkImage 0x8cc1d80000000045[], layer 2, offset (x = 0, y = 0), extent (width = 1920, height = 1088).
[   0.717][e][vo/gpu-next/libplacebo] The Vulkan spec states: If the bound video session was created with the video codec operation VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR and an active reference picture corresponding to any element of pDecodeInfo->pReferenceSlots represents a frame, then the DPB slot index of the bound video session specified by the slotIndex member of that element must be currently associated with a frame picture matching the video picture resource specified by the pPictureResource member of the same element at the time the command is executed on the device (https://vulkan.lunarg.com/doc/view/1.3.296.0/windows/1.3-extensions/vkspec.html#VUID-vkCmdDecodeVideoKHR-pDecodeInfo-07266)
[   0.717][e][vo/gpu-next/libplacebo]     using VkVideoSessionKHR: anon (0x9638f80000000036)
[   0.718][e][vo/gpu-next/libplacebo]   Backtrace:
[   0.721][e][vo/gpu-next/libplacebo]     #0  0x7ffb5784537c in vk_dbg_utils_cb+0x25c F:\dev\libplacebo\src\vulkan\context.c:520+0x9
[   0.752][e][vo/gpu-next/libplacebo]     #1  0x7ffb265c6a63 in DebugReport::DebugLogMsg+0xc93 C:\j\msdk0\build\Vulkan-ValidationLayers\repo\layers\error_message\logging.cpp:252+0x12
[   0.752][e][vo/gpu-next/libplacebo]     #2  0x7ffb265c8631 in DebugReport::LogMsg+0xdc1 C:\j\msdk0\build\Vulkan-ValidationLayers\repo\layers\error_message\logging.cpp:662+0x25
[   0.753][e][vo/gpu-next/libplacebo]     #3  0x7ffb26011674 in ValidationObject::LogError+0x34 C:\j\msdk0\build\Vulkan-ValidationLayers\repo\layers\vulkan\generated\chassis.h:2375+0x2d
[   0.754][e][vo/gpu-next/libplacebo]     #4  0x7ffb261a4a9c in <lambda_5f5e83fedf318e4c076710e415cfaed4>::operator()+0x1ac C:\j\msdk0\build\Vulkan-ValidationLayers\repo\layers\core_checks\cc_video.cpp:4073+0x168
[   0.755][e][vo/gpu-next/libplacebo]     #5  0x7ffb261adf3b in std::_Func_impl_no_alloc<<lambda_14ac4a9a74c961eb3f4f6e7b24ace81d>,bool,ValidationStateTracker const &,vvl::VideoSession const *,vvl::VideoSessionDeviceState &,bool>::_Do_call+0xab C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\functional:822+0x80
[   0.756][e][vo/gpu-next/libplacebo]     #6  0x7ffb261131e3 in CommandBufferSubmitState::Validate+0x583 C:\j\msdk0\build\Vulkan-ValidationLayers\repo\layers\core_checks\cc_queue.cpp:95+0x33
[   0.757][e][vo/gpu-next/libplacebo]     #7  0x7ffb261154d6 in CoreChecks::ValidateQueueSubmit2+0x6b6 C:\j\msdk0\build\Vulkan-ValidationLayers\repo\layers\core_checks\cc_queue.cpp:341+0x47
[   0.760][e][vo/gpu-next/libplacebo]     #8  0x7ffb26249336 in vulkan_layer_chassis::QueueSubmit2+0x146 C:\j\msdk0\build\Vulkan-ValidationLayers\repo\layers\vulkan\generated\chassis.cpp:7912+0x22
[   0.767][e][vo/gpu-next/libplacebo]     #9  0x7ffb2c1f6527 in ff_vk_exec_submit+0xe7 E:\dev\ffmpeg\libavutil\vulkan.c:862+0x17
[   0.768][e][vo/gpu-next/libplacebo]     #10 0x7ffb2c1fef85 in ff_vk_decode_frame+0x965 E:\dev\ffmpeg\libavcodec\vulkan_decode.c:540+0xa
[   0.768][e][vo/gpu-next/libplacebo]     #11 0x7ffb2c20be72 in vk_h264_end_frame+0x2a2 E:\dev\ffmpeg\libavcodec\vulkan_h264.c:541+0x1f
[   0.768][e][vo/gpu-next/libplacebo]     #12 0x7ffb2b9adf26 in ff_h264_field_end+0x86 E:\dev\ffmpeg\libavcodec\h264_picture.c:207+0x5
[   0.769][e][vo/gpu-next/libplacebo]     #13 0x7ffb2b9ca55c in h264_decode_frame+0x113c E:\dev\ffmpeg\libavcodec\h264dec.c:1086+0x14
[   0.769][e][vo/gpu-next/libplacebo]     #14 0x7ffb2b816a2e in ff_decode_receive_frame_internal+0x2ee E:\dev\ffmpeg\libavcodec\decode.c:649+0x201
[   0.769][e][vo/gpu-next/libplacebo]     #15 0x7ffb2b817156 in decode_receive_frame_internal+0x26 E:\dev\ffmpeg\libavcodec\decode.c:666+0xa
[   0.769][e][vo/gpu-next/libplacebo]     #16 0x7ffb2b817111 in avcodec_send_packet+0xd1 E:\dev\ffmpeg\libavcodec\decode.c:753+0x4
[   0.778][e][vo/gpu-next/libplacebo]     #17 0x7ff6bf3b18af in send_packet+0x10f E:\dev\mpv\video\decode\vd_lavc.c:1149+0x14

And eventually it ends:

[   2.198][e][ffmpeg] vk: Unable to submit command buffer: VK_ERROR_VALIDATION_FAILED_EXT
[   2.198][e][ffmpeg/video] h264: hardware accelerator failed to decode picture
[   2.198][w][vd] Error while decoding frame (hardware decoding)!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants