Skip to content

mpv crash with v4l2 camera output #17215

Open
Open

Description

@ndren

mpv Information

mpv v0.41.0 Copyright © 2000-2025 mpv/MPlayer/mplayer2 projects
 built on Dec 22 2025 14:58:51
libplacebo version: v7.351.0
FFmpeg version: n8.0.1
FFmpeg library versions:
   libavcodec      62.11.100
   libavdevice     62.1.100
   libavfilter     11.4.100
   libavformat     62.3.100
   libavutil       60.8.100
   libswresample   6.1.100
   libswscale      9.1.100

Other Information

- Linux version:Arch Linux
- Kernel Version: Linux arch 6.12.63-1-lts #1 SMP PREEMPT_DYNAMIC Thu, 18 Dec 2025 14:48:15 +0000 x86_64 GNU/Linux
- GPU Model: 06:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Renoir [Radeon Vega Series / Radeon Vega Mobile Series] [1002:1636] (rev d1)
- Mesa/GPU Driver Version: 1:25.3.2-1
- Window Manager and Version: sway 1.11
- Source of mpv: Arch package
- Latest known working version: N/A
- Issue started after the following happened: Can also repro in previous versions (0.39 I think)

Reproduction Steps

  1. mpv --no-config /dev/video0 /dev/video0
  2. Press > or run playlist-next
    Get segmentation fault.

Expected Behavior

No such crash.

Actual Behavior

Crash somewhere inside ffmpeg code (not familiar with the internals, wanted to track it here in case buffer misuse is inside mpv, can't repro via ffmpeg directly)

Log File

output.txt

bt.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.

Activity

  1. added theissue type on Jan 1, 2026
  2. kasper93 commented on Aug 9, 2026

    @kasper93
    Member

    For reference: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/21358, https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/21621

    Not a mpv bug, need upstream fix to not orphan AVPackets.

  3. jeffscottward commented on Sep 22, 2026

    @jeffscottward

    Possibly related V4L2 shutdown crash on ARM64/Asahi

    Historical diagnostics from September 21, 2026 may show another manifestation of the V4L2 packet-lifetime issue linked above. The immediate crash site differs, so I have not established that it is the same bug.

    A webcam overlay crashed during controller-requested shutdown (SIGTERM) in three runs: twice with gpu-next/Asahi Vulkan, and once with gpu-next after adding --gpu-api=opengl. All three coredumps report SIGSEGV / SEGV_MAPERR. The OpenGL run logged:

    VO: [gpu-next] 640x720 nv12
    [ffmpeg/demuxer] video4linux2,v4l2: Some buffers are still owned by the caller on close.
    Exiting... (Quit)
    

    Historical launch command, with only the IPC socket pathname normalized:

    mpv av://v4l2:/dev/video0 \
      --profile=low-latency --untimed --no-cache \
      --demuxer-lavf-o=video_size=1280x720,framerate=30 \
      '--vf=lavfi=[crop=ih*8/9:ih]' \
      --title=WebcamOverlay --wayland-app-id=WebcamOverlay-medium \
      --no-border --no-audio --no-osc --osd-level=0 \
      --input-ipc-server="$XDG_RUNTIME_DIR/webcam.sock"

    For the OpenGL comparison, --gpu-api=opengl was added. No --no-config reproduction was performed.

    Both Vulkan stacks start with:

    libvulkan_asahi.so + 0x302d6c
    libvulkan_asahi.so + 0x12bbc8
    libplacebo.so.360 + 0xa2834
    pl_tex_upload   (libplacebo.so.360 + 0x712b0)
    pl_upload_plane (libplacebo.so.360 + 0x83454)
    mpv + 0x15f158
    

    The OpenGL stack starts with:

    memcpy (libc.so.6 + 0x9ddd8)
    libgallium-26.2.3-arch1.1.so + 0x10dcdc4
    libplacebo.so.360 + 0x8e474
    libplacebo.so.360 + 0x74298
    pl_tex_upload   (libplacebo.so.360 + 0x712b0)
    pl_upload_plane (libplacebo.so.360 + 0x83454)
    mpv + 0x15f158
    

    Both backend paths continue through libplacebo's frame queue and pl_queue_update. Unnamed frames were unresolved in systemd's traces; stack location alone does not establish a libplacebo/Mesa defect.

    Environment: Arch Linux ARM/Asahi, aarch64. Package history and the current matching versions show mpv 1:0.41.0-6, FFmpeg 2:9.0.1-4, libplacebo 7.360.1-6, mesa and vulkan-asahi 1:26.2.3-1. No intervening updates to those packages are recorded after the incident. mpv --version reports v0.41.0, libplacebo v7.360.1 and FFmpeg n9.0.1.

    Changing the overlay renderer to --vo=gpu --gpu-api=opengl avoided new coredumps in two subsequent recording/stop cycles, including a 17.856-second recording that decoded successfully. This is a limited workaround observation, not a demonstrated root-cause fix.

    These are recovered historical diagnostics, not a fresh latest/master reproduction. A full --gpu-debug crash log and fully symbolized backtrace are unavailable in the recovered evidence. I am adding the ARM/Asahi, shutdown and cross-backend observations as possibly related evidence for the existing FFmpeg investigation, not asserting a confirmed duplicate or requesting a separate GPU-driver bug.

    Filed by GPT-6 Astra via Oh My Pi.

  4. kasper93 commented on Sep 22, 2026

    @kasper93
    Member

    The root cause is already documented and reported upstream, see my comment above. No need to reiterate it again. Feel free to propose fixes upstream for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions