Opened 11 years ago

Closed 11 years ago

#3068 closed defect (fixed)

x11grab doesn't work with PseudoColor visuals

Reported by: groupboard Owned by:
Priority: normal Component: avdevice
Version: git-master Keywords: x11grab
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

If you try to grab from a PseudoColor x11 screen using x11grab, you'll just see a black screen. It works perfectly with a TrueColor visual.

Change History (5)

comment:1 by Carl Eugen Hoyos, 11 years ago

Please add your failing command line together with the complete, uncut console output to make this a valid ticket.

And since at least I have no idea what "PseudoColor" is, please add your X configuration file.

comment:2 by groupboard, 11 years ago

Just run "Xvfb :1" and it will set up a PseudoColor visual (i.e. a palettized 8-bit colour scheme rather than 24- or 32-bit RGB). At least, it does on Centos 5, but you can confirm by running "xwininfo -root". Then just run ffmpeg with "-x11grab -i :1.0" and other appropriate options and you'll get a black screen no matter what you try. Apparently it has been a bug since 2007 but nobody has reported it here yet.

http://ffmpeg.org/pipermail/ffmpeg-devel/2007-January/028361.html

Here is a sample ffmpeg command:

ffmpeg -f x11grab -s 1024x768 -r 25 -i :1.0 output2.mkv
ffmpeg version N-57300-g2f9422d Copyright (c) 2000-2013 the FFmpeg developers

built on Oct 21 2013 15:25:29 with gcc 4.1.1 (GCC) 20070105 (Red Hat 4.1.1-52)
configuration: --enable-version3 --enable-libx264 --enable-gpl --enable-postproc --enable-nonfree --enable-x11grab
libavutil 52. 47.101 / 52. 47.101
libavcodec 55. 37.102 / 55. 37.102
libavformat 55. 19.103 / 55. 19.103
libavdevice 55. 4.100 / 55. 4.100
libavfilter 3. 88.102 / 3. 88.102
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100

[x11grab @ 0x93a4d80] device: :1.0 -> display: :1.0 x: 0 y: 0 width: 1024 height: 768
[x11grab @ 0x93a4d80] shared memory extension found
Input #0, x11grab, from ':1.0':

Duration: N/A, start: 1382487455.007037, bitrate: 157286 kb/s

Stream #0:0: Video: rawvideo, pal8, 1024x768, 157286 kb/s, 25 tbr, 1000k tbn, 25 tbc

File 'output2.mkv' already exists. Overwrite ? [y/N] y
No pixel format specified, yuv444p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x93ab360] using cpu capabilities: MMX2 SSE2 SSE3 Cache64
[libx264 @ 0x93ab360] profile High 4:4:4 Predictive, level 3.1, 4:4:4 8-bit
[libx264 @ 0x93ab360] 264 - core 138 r2358 9e941d1 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=4 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, matroska, to 'output2.mkv':

Metadata:

encoder : Lavf55.19.103
Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv444p, 1024x768, q=-1--1, 1k tbn, 25 tbc

Stream mapping:

Stream #0:0 -> #0:0 (rawvideo -> libx264)

Press [q] to stop, ? for help
[swscaler @ 0x9398ea0] Warning: data is not aligned! This can lead to a speedloss
frame= 49 fps= 18 q=28.0 Lsize= 3kB time=00:00:01.88 bitrate= 14.9kbits/s
video:3kB audio:0kB subtitle:0 global headers:0kB muxing overhead 32.551098%
[libx264 @ 0x93ab360] frame I:1 Avg QP: 9.00 size: 209
[libx264 @ 0x93ab360] frame P:12 Avg QP: 9.58 size: 41
[libx264 @ 0x93ab360] frame B:36 Avg QP:12.67 size: 34
[libx264 @ 0x93ab360] consecutive B-frames: 2.0% 0.0% 0.0% 98.0%
[libx264 @ 0x93ab360] mb I I16..4: 0.0% 100.0% 0.0%
[libx264 @ 0x93ab360] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 0.0% 0.0% 0.0% 0.0% 0.0% skip:100.0%
[libx264 @ 0x93ab360] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.0% 0.0% 0.0% direct: 0.0% skip:100.0%
[libx264 @ 0x93ab360] 8x8 transform intra:100.0%
[libx264 @ 0x93ab360] coded y,u,v intra: 0.0% 0.0% 0.0% inter: 0.0% 0.0% 0.0%
[libx264 @ 0x93ab360] i16 v,h,dc,p: 0% 0% 100% 0%
[libx264 @ 0x93ab360] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 0% 0% 100% 0% 0% 0% 0% 0% 0%
[libx264 @ 0x93ab360] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x93ab360] kb/s:7.82

comment:3 by Carl Eugen Hoyos, 11 years ago

Component: undeterminedavdevice
Keywords: x11grab added
Reproduced by developer: set
Status: newopen
Version: unspecifiedgit-master

The following macro can be used to get the default palette:

Colormap color_map = DefaultColormap(dpy, screen);

I am not sure how to read the used values from the colormap (XQueryColors?)

comment:4 by Carl Eugen Hoyos, 11 years ago

Patch sent.

comment:5 by Carl Eugen Hoyos, 11 years ago

Resolution: fixed
Status: openclosed

Fixed in f60c3a7c, thank you for the report!

Note: See TracTickets for help on using tickets.