Opened 3 years ago

Closed 3 years ago

#4164 closed defect (fixed)

x11grab (xcb) with show_region gives (partial) static image

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

Description

Summary of the bug:

Specifying show_region when using xcb-based screen grab causes the region to become static (and recorded as such). Without show_region, the region is not static and is captured as normal.

Example output here: http://youtu.be/QZdEPZmWNG8

How to reproduce:

% ffmpeg -f x11grab -s 320x240 -show_region 1 -i :0.0+100,100 -f mp4 capture.mkv
ffmpeg version 2.5 Copyright (c) 2000-2014 the FFmpeg developers
  built on Dec  6 2014 15:13:09 with gcc 4.9.1 (Debian 4.9.1-19)
  configuration: --prefix=/home/daniel/ffmpeg_build --extra-cflags=-I/home/daniel/ffmpeg_build/include --extra-ldflags=-L/home/daniel/ffmpeg_build/lib --bindir=/home/daniel/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-libxcb --enable-libxcb-shm --enable-libxcb-shape --enable-libpulse
  libavutil      54. 15.100 / 54. 15.100
  libavcodec     56. 13.100 / 56. 13.100
  libavformat    56. 15.102 / 56. 15.102
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  2.103 /  5.  2.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100

Attachments (1)

capture.mkv (287.8 KB) - added by DiJuMx 3 years ago.
Example Output Video

Download all attachments as: .zip

Change History (7)

comment:1 Changed 3 years ago by cehoyos

  • Keywords x11grab freeze static removed

Please test current FFmpeg git head and please provide the command line that allows to reproduce the issue together with the complete, uncut console output to make this a valid ticket.

Changed 3 years ago by DiJuMx

Example Output Video

comment:2 Changed 3 years ago by DiJuMx

Command and output for current git head, result is in attachment "Example Output Video"

Command:

$ ffmpeg -f x11grab -s 320x240 -show_region 1 -i :0.0+100,100 -t 10 -f mp4 capture.mkv -y

Output:

ffmpeg version N-68264-gc149f67e9b5b Copyright (c) 2000-2014 the FFmpeg developers
  built on Dec  6 2014 17:37:52 with gcc 4.9.1 (Debian 4.9.1-19)
  configuration: --prefix=/home/daniel/ffmpeg_build --extra-cflags=-I/home/daniel/ffmpeg_build/include --extra-ldflags=-L/home/daniel/ffmpeg_build/lib --bindir=/home/daniel/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-libxcb --enable-libxcb-shm --enable-libxcb-shape --enable-libpulse
  libavutil      54. 15.100 / 54. 15.100
  libavcodec     56. 14.100 / 56. 14.100
  libavformat    56. 15.102 / 56. 15.102
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  2.103 /  5.  2.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, x11grab, from ':0.0+100,100':
  Duration: N/A, start: 1417887553.610080, bitrate: N/A
    Stream #0:0: Video: rawvideo (BGRA / 0x41524742), bgra, 320x240, 29.97 fps, 29.97 tbr, 1000k tbn, 29.97 tbc
No pixel format specified, yuv444p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x39e5cc0] using cpu capabilities: MMX2 SSE2Fast LZCNT
[libx264 @ 0x39e5cc0] profile High 4:4:4 Predictive, level 1.3, 4:4:4 8-bit
[libx264 @ 0x39e5cc0] 264 - core 142 r2431 a5831aa - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - 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=9 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, mp4, to 'capture.mkv':
  Metadata:
    encoder         : Lavf56.15.102
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv444p, 320x240, q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc56.14.100 libx264
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame=  300 fps= 30 q=-1.0 Lsize=     288kB time=00:00:09.94 bitrate= 237.1kbits/s dup=1 drop=0    
video:284kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.246728%
[libx264 @ 0x39e5cc0] frame I:2     Avg QP:24.41  size: 13812
[libx264 @ 0x39e5cc0] frame P:200   Avg QP:27.00  size:  1196
[libx264 @ 0x39e5cc0] frame B:98    Avg QP:33.57  size:   241
[libx264 @ 0x39e5cc0] consecutive B-frames: 46.3% 28.0%  7.0% 18.7%
[libx264 @ 0x39e5cc0] mb I  I16..4: 24.3%  1.3% 74.3%
[libx264 @ 0x39e5cc0] mb P  I16..4:  0.6%  0.4%  3.5%  P16..4:  5.0%  3.1%  1.9%  0.0%  0.0%    skip:85.5%
[libx264 @ 0x39e5cc0] mb B  I16..4:  0.1%  0.2%  0.3%  B16..8:  6.8%  2.2%  0.8%  direct: 0.3%  skip:89.4%  L0:38.6% L1:58.6% BI: 2.9%
[libx264 @ 0x39e5cc0] 8x8 transform intra:9.6% inter:11.0%
[libx264 @ 0x39e5cc0] coded y,u,v intra: 61.9% 2.8% 4.9% inter: 3.1% 0.1% 0.2%
[libx264 @ 0x39e5cc0] i16 v,h,dc,p:  7% 88%  4%  1%
[libx264 @ 0x39e5cc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 27% 61%  1%  0%  0%  0%  0%  0%
[libx264 @ 0x39e5cc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 28% 21%  2%  4%  3%  5%  4%  4%
[libx264 @ 0x39e5cc0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x39e5cc0] ref P L0: 65.0% 10.2% 17.3%  7.5%
[libx264 @ 0x39e5cc0] ref B L0: 89.6%  9.4%  1.0%
[libx264 @ 0x39e5cc0] ref B L1: 99.2%  0.8%
[libx264 @ 0x39e5cc0] kb/s:232.08
Last edited 3 years ago by DiJuMx (previous) (diff)

comment:3 Changed 3 years ago by cehoyos

I tested the following with xcb and the output file is not static:

$ ffmpeg -f x11grab -show_region 1 -i :0 -qscale 2 out.avi
ffmpeg version N-68239-ga0d0799 Copyright (c) 2000-2014 the FFmpeg developers
  built on Dec  6 2014 00:41:32 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      54. 15.100 / 54. 15.100
  libavcodec     56. 14.100 / 56. 14.100
  libavformat    56. 15.102 / 56. 15.102
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  2.103 /  5.  2.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, x11grab, from ':0':
  Duration: N/A, start: 1417895763.578158, bitrate: N/A
    Stream #0:0: Video: rawvideo (BGRA / 0x41524742), bgra, 640x480, 29.97 fps, 29.97 tbr, 1000k tbn, 29.97 tbc
Please use -q:a or -q:v, -qscale is ambiguous
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf56.15.102
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 640x480, q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc56.14.100 mpeg4
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
frame=   18 fps=0.0 q=2.0 size=     529kB time=00:00:01.10 bitrate=3934.5kbits/s dup=0 drop=14
frame=   33 fps= 33 q=2.0 size=     868kB time=00:00:01.60 bitrate=4437.8kbits/s dup=0 drop=14
frame=   48 fps= 32 q=2.0 size=    1165kB time=00:00:02.10 bitrate=4541.6kbits/s dup=0 drop=14
frame=   64 fps= 31 q=2.0 size=    1504kB time=00:00:02.63 bitrate=4675.4kbits/s dup=0 drop=14
frame=   79 fps= 31 q=2.0 size=    1802kB time=00:00:03.13 bitrate=4707.0kbits/s dup=0 drop=14
frame=   94 fps= 31 q=2.0 size=    2144kB time=00:00:03.63 bitrate=4828.6kbits/s dup=0 drop=14
frame=  109 fps= 31 q=2.0 size=    2645kB time=00:00:04.13 bitrate=5236.1kbits/s dup=0 drop=14
frame=  124 fps= 31 q=2.0 size=    2952kB time=00:00:04.63 bitrate=5214.0kbits/s dup=0 drop=14
frame=  140 fps= 31 q=2.0 size=    3254kB time=00:00:05.17 bitrate=5154.8kbits/s dup=0 drop=14
frame=  155 fps= 30 q=2.0 size=    3560kB time=00:00:05.67 bitrate=5141.7kbits/s dup=0 drop=14
frame=  170 fps= 30 q=2.0 size=    4067kB time=00:00:06.17 bitrate=5397.0kbits/s dup=0 drop=14
frame=  176 fps= 25 q=2.0 size=    4221kB time=00:00:07.44 bitrate=4647.0kbits/s dup=0 drop=14
frame=  194 fps= 26 q=2.0 size=    4728kB time=00:00:08.04 bitrate=4816.1kbits/s dup=0 drop=46
frame=  210 fps= 26 q=2.0 size=    5077kB time=00:00:08.57 bitrate=4849.7kbits/s dup=0 drop=46
frame=  222 fps= 26 q=2.0 Lsize=    5401kB time=00:00:08.97 bitrate=4929.7kbits/s dup=0 drop=46
video:5389kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.223046%

I don't have a Debian installation to test.

comment:4 Changed 3 years ago by DiJuMx

Yes, I just tried it, and it doesn't appear static. Could you try with the offset, so:

ffmpeg -f x11grab -show_region 1 -i :0.0+50,50 -qscale 2 out.avi

If the top-left corner of the capture region is "+x,y", the non-static portion of the capture seems to start at "+(2*x),(2*y)"

Last edited 3 years ago by DiJuMx (previous) (diff)

comment:5 Changed 3 years ago by cehoyos

  • Component changed from undetermined to avdevice
  • Reproduced by developer set
  • Status changed from new to open
  • Version changed from 2.5 to git-master

I can reproduce the issue with the following command:

$ ffmpeg -f x11grab -show_region 1 -i :0+50,50 -qscale 2 out.avi

comment:6 Changed 3 years ago by cehoyos

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

Fixed by you in 0ae37e46
Thank you for the report and the fix!

Note: See TracTickets for help on using tickets.