mpv-player / mpv-player/mpv

gdigrab captures a single frame, then closes

Open
#7,493 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I'm currently attempting to capture desktop footage in order to post-process it with mpv via vapoursynth and display it back to the screen. In order to do so, I'm using gdigrab (via ffmpeg) to capture a specific window. However, whenever I attempt it, the window shows a single frame of footage, then closes shortly after.

Important Information

Provide following Information:

  • mpv version: 0.32.0-94-ge162bcb5a0
  • Windows Version: Windows 10, latest version
  • Source of the mpv binary: Shinchiro's Windows builds for mpv, Zeranoe for ffmpeg
Reproduction steps

Run mpv av://gdigrab:title="Title of the window" or mpv av://gdigrab:desktop.

Expected behavior

mpv is expected to capture the footage from the selected application, then display it back and apply the Vapoursynth filter if applicable.

Actual behavior

mpv captures a single frame, displays it for under a second, then exits.

Log file

mpv_error_2.log.txt

Some particular lines that were of my interest:

[vd] Codec list:
[vd]     bmp - BMP (Windows and OS/2 bitmap)
[vd] Opening decoder bmp
[vd] No hardware decoding requested.
[vd] Using software decoding.
[vd] Detected 4 logical cores.
[vd] Requesting 5 threads for decoding.
[vd] Selected codec: bmp (BMP (Windows and OS/2 bitmap))
[vf] User filter list:
[vf]   (empty)
[cplayer] Starting playback...
[vd] DR failed - disabling.
[ffmpeg/demuxer] gdigrab: Failed to capture image (error 6)
[lavf] error reading packet: I/O error.
[lavf] EOF reached.
[vd] Decoder format: 1920x1080 [0:1] bgra auto/auto/auto/auto/auto CL=unknown
[vf] [in] 1920x1080 bgra rgb/bt.709/srgb/full/display SP=1.000000 CL=mpeg1/jpeg
[vf] [userdeint] 1920x1080 bgra rgb/bt.709/srgb/full/display SP=1.000000 CL=mpeg1/jpeg
[vf] [userdeint] (disabled)
[vf] [autorotate] 1920x1080 bgra rgb/bt.709/srgb/full/display SP=1.000000 CL=mpeg1/jpeg
[vf] [autorotate] (disabled)
[vf] [convert] 1920x1080 bgra rgb/bt.709/srgb/full/display SP=1.000000 CL=mpeg1/jpeg
[vf] [convert] (disabled)
[vf] [out] 1920x1080 bgra rgb/bt.709/srgb/full/display SP=1.000000 CL=mpeg1/jpeg
[vf] filter input EOF
[ffmpeg/demuxer] gdigrab: Failed to capture image (error 6)
[vf] filter output EOF
[lavf] error reading packet: I/O error.
[ffmpeg/demuxer] gdigrab: Capturing whole desktop as 1920x1080x32 at (0,0)
[lavf] Could not set AVOption user_agent='libmpv'
[lavf] Could not set AVOption tls_verify='0'
[lavf] Could not set AVOption icy='1'
[lavf] Could not set AVOption timeout='60000000'
[cplayer] Set property: shared-script-properties -> 1
[ffmpeg/demuxer] gdigrab: Stream #0: not enough frames to estimate rate; consider increasing probesize
[lavf] avformat_find_stream_info() finished after 0 bytes.

I have already tried using a large value --demuxer-lavf-probesize (in order to increase the amount of bytes probed (around 1920x1080x32x2 = 132710400 to be absolutely safe), as it might be sampling a single frame and declaring it a standalone bitmap file, but the change didn't seem to fix the issue.

Sample files

N/A

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 mpv av://gdigrab:title="Title of the window" and mpv av://gdigrab:desktop, then inspect the linked log around the gdigrab error 6 and EOF messages. Trace how mpv handles the gdigrab stream after its first frame; done means continuous capture remains open and displays successive frames.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.