Opened 4 years ago

Last modified 4 years ago

#8744 new defect

Transparency problem when capturing a window with gdigrab

Reported by: sacereda Owned by:
Priority: normal Component: avdevice
Version: git-master Keywords: gdigrab alpha
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

When capturing a windows explorer window with gdigrab, the effect is like a black layer layer with some transparency in front of the content and the result is not the same as the source.

This problem doesn't occur when capturing Desktop (instead of title=XXX).

How to reproduce:

% Open a windows explorer window (win+r Documents enter)
% ffmpeg.exe -f gdigrab -i "title=Documents"
ffmpeg version 4.2.3 (also occur in 4.0 version)
built with gcc 9.3.1 (GCC) 20200523

Attachments (4)

ffmpeg-20200617-212928.log (9.5 KB ) - added by sacereda 4 years ago.
Output log
gdigrab-transparency.JPG (119.5 KB ) - added by sacereda 4 years ago.
screenshot comparing ffplay output and source window
ffmpeg-20200618-163657.log (8.1 KB ) - added by sacereda 4 years ago.
Output log
copy-rawvideo.bmp (915.4 KB ) - added by sacereda 4 years ago.
bmp file from -vcodec copy -f rawvideo

Download all attachments as: .zip

Change History (11)

by sacereda, 4 years ago

Attachment: ffmpeg-20200617-212928.log added

Output log

by sacereda, 4 years ago

Attachment: gdigrab-transparency.JPG added

screenshot comparing ffplay output and source window

comment:1 by Carl Eugen Hoyos, 4 years ago

Keywords: alpha added; transparency removed
Version: 4.2unspecified

Please test current FFmpeg git head, the only version supported on this bug tracker.

comment:2 by sacereda, 4 years ago

Same result with git-2020-06-17-0b3bd00, attaching log.

by sacereda, 4 years ago

Attachment: ffmpeg-20200618-163657.log added

Output log

comment:3 by Carl Eugen Hoyos, 4 years ago

Version: unspecifiedgit-master

Please test the following command line and attach the output file here:

$ ffmpeg -f gdigrab -i "title=Documents" -v:frames 1 -vcodec copy -f rawvideo out.bmp

Last edited 4 years ago by Carl Eugen Hoyos (previous) (diff)

comment:4 by sacereda, 4 years ago

With '-f rawvideo' the filesize keeps growing and doesn't seem to end (I cancelled when reached 6GB).

Do you want me to upload the bmp file without the rawvideo option?

comment:5 by Carl Eugen Hoyos, 4 years ago

Sorry, I copied your command line, please do the following:

$ ffmpeg -f gdigrab -i "title=Documents" -vframes 1 -vcodec copy -f rawvideo out.bmp

by sacereda, 4 years ago

Attachment: copy-rawvideo.bmp added

bmp file from -vcodec copy -f rawvideo

comment:6 by Carl Eugen Hoyos, 4 years ago

You did provide ffmpeg -i console output for the issue you reported but you did not provide a command line that allows to reproduce the issue you reported.
Are you reporting an issue that is only reproducible with ffplay, not with ffmpeg?

comment:7 by sacereda, 4 years ago

Hi,

If I open the attached copy-rawvideo.bmp file with xnview or similar, most of pixels have alpha component to zero. Format is detected as BGRA, but some parts of the window are "covered" (alpha 0) and doesn't reproduce the original content (check gdigrab-transparency.jpg)

You can reproduce it both with ffplay and ffmpeg:

% ffplay -f gdigrab -i "title=Documents"

% ffmpeg -f gdigrab -i "title=Documents" -vframes 1 output.png

In our software (using ffmpeg 4.0), we handle alpha channel and the behaviour is the same as in ffplay.

Let me know if you need further info, or if I can help in any way.

Note: See TracTickets for help on using tickets.