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

Seeking started to cause green and blocky gpu glitches with FFmpeg 7.1 (using VAAPI) #15874

Open
6 tasks done
jumperes opened this issue Feb 15, 2025 · 2 comments
Open
6 tasks done

Comments

@jumperes
Copy link

jumperes commented Feb 15, 2025

mpv Information

mpv v0.39.0 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
 built on Nov 27 2024 18:31:26
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: Arch Linux (all packages installed from official repo)
- Kernel Version: `Linux arch-m 6.13.2-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 08 Feb 2025 18:54:55 +0000 x86_64 GNU/Linux`
- GPU Model: `VGA compatible controller [0300]: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller [8086:0126] (rev 09)`
- Mesa/GPU Driver Version: OpenGL version string: 3.3 (Compatibility Profile) Mesa 24.3.4-arch1.1
- Window Manager and Version: Xfce's `xfwm4 4.20.0-2`
- Source of mpv: Official Arch Linux repo
- Latest known working version: `mpv 1:0.39.0-1` together with `ffmpeg 2:7.0.2-3`, `rubberband 3.3.0-2` and `x265 3.6-1` from Arch Linux repo
- Issue started after the following happened: Arch Linux updated to ffmpeg 7.1 a few months ago.

mpv built from 834f99e did reproduce the issue as well.

Since the issue appeared with the update from ffmpeg 7.0 to 7.1 I bisected ffmpeg using git bisect start $(git merge-base release/7.{0,1}) n7.1 and it identified FFmpeg/FFmpeg@5104947 as the culprit:
[510494760cde847e4417231f10c9759d0da6cb07] lavc/vaapi_h264: Fix merging fields in DPB with missing references
I compiled ffmpeg from git checkout n7.1 && git revert 51049476 and ran mpv against it by pointing LD_LIBRARY_PATH to the shared library build artifacts.
 Doing this did not reproduce the issue. Playback had no issues during my testing so far. I can't tell if this definitely means that the problem is on ffmpeg; I chose to report this here first since I did not observe this specific issue with VLC or Firefox running in the same environment (I used intel_gpu_top from intel-gpu-tools to verify that both of these do in fact utilize video acceleration). Please tell me if this belongs on the ffmpeg bugtracker instead.

Reproduction Steps

  • play hardware-accelerated video via VA-API.
    • H.264 is the most recent supported codec on this hardware and the only one that I use hardware acceleration with so I did not test the others (mpeg2 and VC-1 according to vainfo).
  • do exact seeks using Shift+Up/Down
    • (video must be playing, not paused.)
    • seeking backwards might be more likely to trigger the issue
    • multiple relatively frequent exact seeks seem to trigger the issue most reliably. (keeping the arrow key pressed for a moment to dispatch multiple keypresses can also help to reproduce.)
    • enough video needs to be bufferd to do the seeks, so a local file is preferred.
  • when using a local file, the container format seems to matter.
    • forcing --cache often allows reproducing regardless.
    • if --cache is not enough, remuxing to mpegts should reproduce
    • with mpegts files or when using --cache inexact seeks may also trigger the issue

Expected Behavior

video seeks cause no glitches even with hardware acceleration

Actual Behavior

The video output gets corrupted with mostly green and blocky glitches. Other screen content may appear in these glitches; the example screenshots feature the heavily distorted icon of the Xfce Terminal that was used to execute mpv.

With an mkv container, the glitches usually disappear after doing an inexact seek.
With mpegts, the glitches are more persistent. At worst, cycling the video track removes them at the cost of dropping the demuxer cache, meaning data loss when viewing any live broadcast.

Three images showing the glitches (taken with mpv's internal screenshot feature using the `s` hotkey.")

Log File

output.txt

Sample Files

I was able to reproduce this with H.264 video from multiple sources like YouTube and Twitch. For this issue report I used this example from YouTube:

mpv --no-config --hwdec=vaapi --ytdl-format=137 ytdl://dQw4w9WgXcQ --cache-secs=999 --demuxer-max-bytes=256M

youtube-dl dQw4w9WgXcQ -f137 -o'%(id)s.%(format_id)s.%(ext)s'
mpv --no-config --hwdec=vaapi dQw4w9WgXcQ.137.mp4 --cache
ffmpeg -i dQw4w9WgXcQ.137.mp4 -c copy dQw4w9WgXcQ.137.ts
mpv --no-config --hwdec=vaapi dQw4w9WgXcQ.137.ts
ffmpeg -i dQw4w9WgXcQ.137.mp4 -c copy dQw4w9WgXcQ.137.mkv
mpv --no-config --hwdec=vaapi dQw4w9WgXcQ.137.mkv

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.
@Dudemanguy
Copy link
Member

Report this to ffmpeg then?

@jumperes
Copy link
Author

Ok. I filed an FFmpeg issue at https://trac.ffmpeg.org/ticket/11473

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

No branches or pull requests

2 participants