Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#163 closed defect (fixed)

x11grab input returns fully transparent image

Reported by: llogan Owned by:
Priority: minor Component: avdevice
Version: git-master Keywords: x11grab, rgb32, alpha, transparent
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

jpg output works as expected. out20110506.png attached.

$ ffmpeg -f x11grab -r 25 -s 800x600 -i :0.0 -vframes 1 out20110506.png
ffmpeg version git-N-29638-g95f163b, Copyright (c) 2000-2011 the FFmpeg developers
  built on May  6 2011 14:01:20 with gcc 4.6.0 20110415 (prerelease)
  configuration: --prefix=/usr --disable-optimizations --enable-x11grab --enable-gpl
  libavutil    51.  2. 1 / 51.  2. 1
  libavcodec   53.  3. 0 / 53.  3. 0
  libavformat  53.  0. 3 / 53.  0. 3
  libavdevice  53.  0. 0 / 53.  0. 0
  libavfilter   2.  4. 0 /  2.  4. 0
  libswscale    0. 14. 0 /  0. 14. 0
[x11grab @ 0x1aacd40] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 800 height: 600
[x11grab @ 0x1aacd40] shared memory extension found
[x11grab @ 0x1aacd40] Estimating duration from bitrate, this may be inaccurate
Input #0, x11grab, from ':0.0':
  Duration: N/A, start: 1304719812.085890, bitrate: 384000 kb/s
    Stream #0.0: Video: rawvideo, bgra, 800x600, 384000 kb/s, 25 tbr, 1000k tbn, 25 tbc
[buffer @ 0x1abb160] w:800 h:600 pixfmt:bgra
Output #0, image2, to 'out20110506.png':
  Metadata:
    encoder         : Lavf53.0.3
    Stream #0.0: Video: png, bgra, 800x600, q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
frame=    1 fps=  0 q=0.0 Lsize=      -0kB time=0.04 bitrate=  -4.4kbits/s    
video:72kB audio:0kB global headers:0kB muxing overhead -100.029685%

Attachments (3)

out20110506.png (52.7 KB) - added by llogan 6 years ago.
out20110506.jpg (51.6 KB) - added by llogan 6 years ago.
ticket163.png (162.3 KB) - added by llogan 5 years ago.

Download all attachments as: .zip

Change History (11)

Changed 6 years ago by llogan

Changed 6 years ago by llogan

comment:1 Changed 6 years ago by llogan

Tested on x86_64 Arch Linux.

comment:2 Changed 6 years ago by cehoyos

  • Priority changed from normal to minor
  • Reproduced by developer set
  • Status changed from new to open
  • Version changed from git to git-master

Work-around is to use -pix_fmt rgb24

Not a regression, afaict.

comment:3 Changed 5 years ago by reimar

FFmpeg captures with alpha channel, though RGB32 for X does not usually include alpha but instead has a constant 0.
That constant 0 ends up as "fully transparent" in the png.
If you remove the alpha channel (e.g. in GIMP decompose as RGB and then compose again) you will see the image is there.
-pix_fmt rgb24 is of course a better way to get the same effect.

comment:4 Changed 5 years ago by cehoyos

  • Analyzed by developer set
  • Component changed from undetermined to avdevice

But am I correct that x11grab should not assume a useful value for the alpha channel of bgra?

comment:5 Changed 5 years ago by michael

  • Summary changed from png output creates artifacts or blank image with x11grab input to x11grab input returns fully transparent image

comment:6 Changed 5 years ago by michael

  • Keywords rgb32 alpha transparent added; png removed

comment:7 Changed 5 years ago by cehoyos

  • Resolution set to fixed
  • Status changed from open to closed

Should be fixed.

Changed 5 years ago by llogan

comment:8 Changed 5 years ago by llogan

Thanks for the patch. It create a normal output on Arch Linux, but in an Ubuntu Oneiric 11.10 VM there are still some transparency artifacts, but I'm not sure why. Example attached as ticket163.png.

Note: See TracTickets for help on using tickets.