mpv-player / mpv-player/mpv

libmpv: Severe screen corruption when rendering video via mpv_render_context_render to virtual x-server

Open
#14,577 16 comments 0 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
This is the first version in which the problem can be reproduced.
Found by bisecting. The problem also happens in master (3ab989e554)
mpv --version
mpv bad1-dirty Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects
 built on Jul 18 2024 13:05:23
libplacebo version: v6.338.2
FFmpeg version: 6.1.1
FFmpeg library versions:
   libavutil       58.29.100
   libavcodec      60.31.102
   libavformat     60.16.100
   libswscale      7.5.100
   libavfilter     9.12.100
   libswresample   4.12.100
Other Information
  • Linux version:
    Fedora Linux

  • Kernel Version:
    6.9.8-200.fc40.x86_64

  • GPU Model:
    Intel Corporation AlderLake-S GT1

  • Mesa/GPU Driver Version:
    mesa-libGLU-9.0.3-4.fc40.x86_64
    mesa-libGLU-devel-9.0.3-4.fc40.x86_64
    mesa-filesystem-24.1.2-8.fc40.x86_64
    mesa-va-drivers-24.1.2-8.fc40.x86_64
    mesa-libglapi-24.1.2-8.fc40.x86_64
    mesa-dri-drivers-24.1.2-8.fc40.x86_64
    mesa-libgbm-24.1.2-8.fc40.x86_64
    mesa-libEGL-24.1.2-8.fc40.x86_64
    mesa-libgbm-devel-24.1.2-8.fc40.x86_64
    mesa-libGL-24.1.2-8.fc40.x86_64
    mesa-libGL-devel-24.1.2-8.fc40.x86_64
    mesa-libEGL-devel-24.1.2-8.fc40.x86_64
    mesa-libOpenCL-24.1.2-8.fc40.x86_64
    mesa-vulkan-drivers-24.1.2-8.fc40.x86_64
    mesa-libxatracker-24.1.2-8.fc40.x86_64
    mesa-libOSMesa-24.1.2-8.fc40.x86_64

  • Window Manager and Version:
    mate marco

  • Source mpv:
    from git

  • Introduced in version:
    c172a650c4
    not possible to reproduce in 3e612c07f4

Reproduction Steps

The problem can be reproduced using xpra
-start xpra in seamless mode, e.g., starting a terminal which runs
on a remote computer. Under the hood this starts an Xserver
with Xdummy or Xvfb. The problem occurs with both.
-in this terminal start a program that uses mpv-lib
For instance https://github.com/v0idv0id/MPVideoCube.git
Or (more difficult to compile:
https://github.com/deeptho/neumodvb

Sometimes the video displayed in the programs
looks ok, but sometimes video is heavily corrupted.
Investigation shows

  1. If the programs are run under virtualgl on the remote computer, all is fine
  2. If the programs are run directly, they sometimes show the expected output: for video cube this means (mostly) artefact free video displayed on a cube. For neumodvb, this means a live tv channel showing artefact free video. However, sometimes the video is completely black, or heavily corrupted: the video contains vertical/horizontal lines, or only small parts of it appear on screeen, or it looks heavily pixellated. See also https://github.com/Xpra-org/xpra/issues/4300 for examples
  3. If screen corruption occurs, it continues to occur until a new video is displayed. If no corruption occurs at the start, then the video remains good for ever.
Expected Behavior

Non-corrupted video

Actual Behavior

Corrupted video.

Additional info:

  1. If an overlay is drawn on top of the video (neumodvb), after mpv renders it, that overlay looks fine. Both programs also run fine natively, not under xpra
  2. If in neumodvb I save the video rendered by mpv-lib, that video is also corrupted, but the overlay is not, suggesting strongly that mpv is causing the corruption
  3. The mpv command line client does not show corruption when playing videos
  4. The ONLY difference between the last good and first working mpv version seems to be
    a difference in default interpolation code, but that may just "trigger" the problem, rather than being the cause.
  5. Once the video displayed is corrupted, the corruption stays of the same type, although resizing. the window has some effect on the details of the corruption. So to reproduce the problem, multiple trials may be needed.

Please see the sreenshots here: https://github.com/Xpra-org/xpra/issues/4300

I cannot attach log files, as there are none in this use case. Or is it possible to start one
in libmpv?

Log File

xxx.log

Sample Files

withosd
aaa

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

Start by reproducing the corruption through xpra with Xdummy or Xvfb and the MPVideoCube libmpv example. Compare the first bad commit c172a650c4 with the last good commit 3e612c07f4, focusing on rendering through mpv_render_context_render and the interpolation change. Done means video remains free of corruption in the reported virtual X-server setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
computer-graphics
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.