带有x11grab的ffmpeg导致vlc播放中出现黑屏

我已经在AWS实例上安装了ffmpeg,并且试图logging一个X会话,我已经通过x11rdp连接到客户端,它是微软的远程桌面。

这里是我使用的terminal命令和它的输出:

$ ffmpeg -f x11grab -s `xdpyinfo | grep 'dimensions:'|awk '{print $2}'` -r 25 -i $DISPLAY -pix_fmt yuv420p out.mp4 ffmpeg version N-80023-gd55568d Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3) configuration: --prefix=/home/ubuntu/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ubuntu/ffmpeg_build/include --extra-ldflags=-L/home/ubuntu/ffmpeg_build/lib --bindir=/home/ubuntu/bin --enable-gpl --enable-libass --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libx265 --enable-x11grab --enable-nonfree libavutil 55. 24.100 / 55. 24.100 libavcodec 57. 42.100 / 57. 42.100 libavformat 57. 36.100 / 57. 36.100 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 45.100 / 6. 45.100 libswscale 4. 1.100 / 4. 1.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 [x11grab @ 0x315b520] XFixes not available, cannot draw the mouse. [x11grab @ 0x315b520] Stream #0: not enough frames to estimate rate; consider increasing probesize Input #0, x11grab, from ':11.0': Duration: N/A, start: 1463527353.437056, bitrate: N/A Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1920x1080, 25 fps, 1000k tbr, 1000k tbn File 'out.mp4' already exists. Overwrite ? [y/N] y [libx264 @ 0x31644e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2 [libx264 @ 0x31644e0] profile High, level 4.0 [libx264 @ 0x31644e0] 264 - core 142 r2389 956c8d8 - 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=-2 threads=6 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 [mp4 @ 0x3162e20] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead. Output #0, mp4, to 'out.mp4': Metadata: encoder : Lavf57.36.100 Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1920x1080, q=2-31, 25 fps, 12800 tbn Metadata: encoder : Lavc57.42.100 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1 Stream mapping: Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264)) Press [q] to stop, [?] for help frame= 306 fps= 63 q=-1.0 Lsize= 27kB time=00:00:12.12 bitrate= 18.2kbits/s speed=2.51x video:22kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 19.554649% [libx264 @ 0x31644e0] frame I:2 Avg QP: 7.50 size: 426 [libx264 @ 0x31644e0] frame P:77 Avg QP: 9.14 size: 77 [libx264 @ 0x31644e0] frame B:227 Avg QP:12.67 size: 69 [libx264 @ 0x31644e0] consecutive B-frames: 1.0% 0.0% 1.0% 98.0% [libx264 @ 0x31644e0] mb I I16..4: 100.0% 0.0% 0.0% [libx264 @ 0x31644e0] 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 @ 0x31644e0] 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 @ 0x31644e0] 8x8 transform intra:0.0% [libx264 @ 0x31644e0] coded y,uvDC,uvAC intra: 0.0% 0.0% 0.0% inter: 0.0% 0.0% 0.0% [libx264 @ 0x31644e0] i16 v,h,dc,p: 99% 0% 1% 0% [libx264 @ 0x31644e0] i8c dc,h,v,p: 100% 0% 0% 0% [libx264 @ 0x31644e0] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 @ 0x31644e0] kb/s:14.61 

在vlc中打开out.mp4导致黑屏。

我已经回顾了一系列的论坛post,以及可能所有的stackexchange的问题和答案,并尝试了尽可能多的解决scheme,但似乎没有任何窍门。

有趣的是, 这个问题列出了尝试以下内容:

$ xwd -root -silent -display :99.0 | xwdtopnm |pnmtojpeg > screen.jpg

那个命令也起作用了,用$DISPLAY代替:99.0