mpv-player / mpv-player/mpv

NVIDIA Hardware acceleration fails, freezes on playing video

Open
#16,189 21 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

os:linux
Dominant language
C
Stars
37k
Forks
3.5k
Avg merge
1d 10h
Merged PRs (30d)
22

Description

mpv Information
mpv v0.40.0-dirty Copyright © 2000-2025 mpv/MPlayer/mplayer2 projects
 built on Apr  4 2025 07:28:54
libplacebo version: v7.349.0
FFmpeg version: n7.1
FFmpeg library versions:
   libavcodec      61.19.100
   libavdevice     61.3.100
   libavfilter     10.4.100
   libavformat     61.7.100
   libavutil       59.39.100
   libswresample   5.3.100
   libswscale      8.3.100
Other Information
- Linux version: EndeavourOS (Archlinux)
- Kernel Version: 6.13.8-zen1-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Sun, 23 Mar 2025 17:17:17 +0000 x86_64 GNU/Linux
- GPU Model: NVIDIA Corporation GP102 [TITAN X] [10de:1b00] (rev a1)
- Mesa/GPU Driver Version: 4.6.0 NVIDIA 570.133.07
- Window Manager and Version: KDE Plasma 6.3.4
- Source of mpv: pacman distribution
- Latest known working version: v0.38.0
- Issue started after the following happened: Upgrading to MPV version 0.40.0

Downgrading from cuda 12.8 to 12.0 has not helped. Downgrading mpv to v0.38.0 should solve the issue; downgrading to v0.39.0 falls back to different rendering after the following message:
`[ffmpeg] AVHWDeviceContext: cu->cuCtxCreate(&hwctx->cuda_ctx, desired_flags, hwctx->internal->cuda_device) failed -> CUDA_ERROR_OUT_OF_MEMORY: out of memory
[ffmpeg] AVHWDeviceContext: Device creation failure: VK_ERROR_INITIALIZATION_FAILED`

Additionally: I am using the latest binary release, as I have failed to build the git master with mpv-build previously, though I'll try again.
--vo=gpu-next --hwdec=nvdec appears to work despite the same `CUDA_ERROR_OUT_OF_MEMORY` occurring, though --vo=gpu-next --hwdec=auto crashes with `free(): double free detected in tcache 2` and core dumped.
With config --no-config --hwdec=auto --vo=gpu, depending on the video MPV either crashes with crash dump, or hard freezes, requiring SIGKILL.
When hard freezing, it displays the first frame of the video.
Reproduction Steps

Issue occurs only with hardware decoding; --hwdec=no --vo=gpu works fine.
1st case: Launch any video (tested with h264, vp9, likely all) with the arguments --no-config --vo=gpu --hwdec=nvdec --gpu-debug --log-file=output.txt

Alternatively:
2nd case: Launch any video with the arguments --no-config --vo=gpu-next --hwdec=auto

Expected Behavior

The video plays.

Actual Behavior

1st case: MPV fails to display any video, but doesn't freeze and completes the log upon exiting (attached).
2nd case: Crash, last printout free(): double free detected in tcache 2 (backtrace attached)

The issue may be caused by old GPU architecture/hardware capability, as my TITAN Xp has the old Pascal architecture – still actively supported. The TITAN Xp cannot decode AV1 video, but in the past it fell back to other decoding just fine.

Log File

Log file for the first case: output.txt
Backtrace for the second case: gdb.txt

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the two cases with the provided --no-config, --vo=gpu, --hwdec=nvdec and --vo=gpu-next --hwdec=auto arguments. Start by comparing the attached output.txt and gdb.txt with behavior on mpv 0.38.0 and 0.40.0. Done means hardware-decoded video plays without freezing, crashing, or triggering the reported double-free.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, linux
Domain
cli, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.