-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Open
Labels
Description
mpv Information
mpv v0.40.0-495-g122abdfec Copyright © 2000-2025 mpv/MPlayer/mplayer2 projects
built on Dec 16 2025 00:07:26
libplacebo version: v7.358.0 (v7.351.0-100-g3fc2736-dirty)
FFmpeg version: N-122178-g7ee5c907e
FFmpeg library versions:
libavcodec 62.23.101
libavdevice 62.2.100
libavfilter 11.10.101
libavformat 62.8.100
libavutil 60.20.100
libswresample 6.2.100
libswscale 9.3.100Other Information
- Windows version: Microsoft Windows [Version 10.0.26200.7462]
- GPU model, driver and version: Rdeon RX Vega (Driver version 25.8.1)
- Source of mpv: https://github.com/shinchiro/mpv-winbuild-cmake/releases/download/20251217/mpv-x86_64-v3-20251217-git-122abdf.7z
- Latest known working version: not sure
- Issue started after the following happened: not sure
Reproduction Steps
(1) Run mpv.com -vd h264_amf https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/1080/Big_Buck_Bunny_1080_10s_1MB.mp4 in command prompt (cmd.exe)
(2) Press 'q'
(3) Run echo %ERRORLEVEL%
Expected Behavior
mpv exits without crash. (ERRORLEVEL is 0)
Actual Behavior
The result would be -1073741819 (0xc0000005).
Log File
Sample Files
No response
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.
The cause
I tracked the issue down and found that the cause is that mpv calls av_buffer_unref() after dlclose() for amfrtdrv64.dll.
So this is not a bug of AMD driver.
The code path to dlclose() is as follows.
Called function From where
avcodec_free_context() [video/decode/vd_lavc.c:uninit_avctx()]
|
v
ff_codec_close() [libavcodec/options.c:avcodec_free_context()]
|
v
amf_decode_close() [libavcodec/avcodec.c:ff_codec_close():ffcodec(avctx->codec)->close(avctx)]
|
v
av_buffer_unref() [libavcodec/amfdec.c:amf_decode_close()]
|
v
buffer_replace() [libavutil/buffer.c:av_buffer_unref()]
|
v
hwdevice_ctx_free() [libavutil/buffer.c:buffer_replace():b->free(b->opaque, b->data)]
|
v
amf_device_uninit() [libavutil/hwcontext.c:hwdevice_ctx_free():ctxi->hw_type->device_uninit(ctx)]
|
v
dlclose() [libavutil/hwcontext_amf.c:amf_device_uninit()]
After dlclose(), at vo_thread() exit,
uninit() [video/out/vo.c:vo_thread():vo->driver->uninit()]
|
v
(inside libplacebo.dll)
|
v
mp_image_destructor() [(inside libplacebo.dll)]
|
v
av_buffer_unref() [video/mp_image.c:mp_image_destructor()]
|
v
buffer_replace() [libavutil/buffer.c:av_buffer_unref()]
|
v
amf_free_amfsurface() [libavutil/buffer.c:buffer_replace():b->free(b->opaque, b->data)]
|
v
Release() [libavutil/hwcontext_amf.c:amf_free_amfsurface()]
Here, Release() points inside amfrtdrv64.dll. Then crash.
My conclusion is:
mpv calls FFmpeg API's in a way that FFmpeg does not expect.