0

I use the following command for my script to record the entire screen :

ffmpeg -f x11grab -y -r 24  -s 1366x768 -i :0.0 -f alsa -i default -vcodec libx264 out.avi

But after running that , out.avi doesn't contain video , just sound.

Here's the complete output of that (interrupted via Ctrl+C ) :

ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
[x11grab @ 0x56271f542e00] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, x11grab, from ':0.0':
  Duration: N/A, start: 1592158154.433194, bitrate: N/A
    Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1366x768, 24 fps, 1000k tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, alsa, from 'default':
  Duration: N/A, start: 1592158154.486958, bitrate: 1536 kb/s
    Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
  Stream #1:0 -> #0:1 (pcm_s16le (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[swscaler @ 0x56271f57d220] Warning: data is not aligned! This can lead to a speed loss
[libx264 @ 0x56271f56c8c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x56271f56c8c0] profile High 4:4:4 Predictive, level 3.2, 4:4:4 8-bit
[alsa @ 0x56271f54cd20] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf57.83.100
    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv444p(progressive), 1366x768, q=-1--1, 24 fps, 24 tbn, 24 tbc
    Metadata:
      encoder         : Lavc57.107.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: mp3 (libmp3lame) (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p
    Metadata:
      encoder         : Lavc57.107.100 libmp3lame
frame=   14 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A speed=   frame=   26 fps= 26 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A speed=   frame=   38 fps= 25 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A speed=   frame=   50 fps= 25 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A speed=   frame=   62 fps= 25 q=28.0 size=      10kB time=00:00:00.16 bitrate= 476.2kbits/frame=   74 fps= 24 q=28.0 size=      10kB time=00:00:00.67 bitrate= 118.1kbits/frame=   80 fps= 22 q=-1.0 Lsize=     516kB time=00:00:03.25 bitrate=1301.2kbits/s speed=0.906x    
video:487kB audio:16kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.520141%
[libx264 @ 0x56271f56c8c0] frame I:1     Avg QP:19.01  size:112157
[libx264 @ 0x56271f56c8c0] frame P:20    Avg QP:16.66  size: 18812
[libx264 @ 0x56271f56c8c0] frame B:59    Avg QP:21.03  size:   181
[libx264 @ 0x56271f56c8c0] consecutive B-frames:  1.2%  0.0%  3.8% 95.0%
[libx264 @ 0x56271f56c8c0] mb I  I16..4: 44.2%  0.0% 55.8%
[libx264 @ 0x56271f56c8c0] mb P  I16..4:  2.4%  0.0%  5.3%  P16..4:  2.4%  0.5%  0.4%  0.0%  0.0%    skip:89.0%
[libx264 @ 0x56271f56c8c0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  4.4%  0.0%  0.0%  direct: 0.0%  skip:95.5%  L0:39.8% L1:58.9% BI: 1.3%
[libx264 @ 0x56271f56c8c0] coded y,u,v intra: 48.6% 8.6% 8.0% inter: 0.2% 0.0% 0.0%
[libx264 @ 0x56271f56c8c0] i16 v,h,dc,p: 55% 41%  3%  1%
[libx264 @ 0x56271f56c8c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 25% 17%  2%  5%  4%  5%  4%  4%
[libx264 @ 0x56271f56c8c0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x56271f56c8c0] ref P L0: 71.9% 13.0% 12.4%  2.6%
[libx264 @ 0x56271f56c8c0] ref B L0: 77.7% 21.7%  0.6%
[libx264 @ 0x56271f56c8c0] ref B L1: 96.0%  4.0%
[libx264 @ 0x56271f56c8c0] kb/s:1197.83
Exiting normally, received signal 2.

I've also installed x264 and libx264-152 packages.

I use KDE Neon 5.19 (Ubuntu 18.04).

Thanks in advance.

2
  • Share the full log. – Gyan Jun 14 '20 at 18:00
  • @Gyan More logs added to the post. – Parsa Mousavi Jun 14 '20 at 18:12
1

Depends which app you are using to play your screencast. VLC simply failed, citing a "hardware accelerator failed to decode picture".

When changing to "X11 video output (XCB) I could see that video - with an offset due to a 2 display setup... The frames are captured but the codec seems strange: High 4:4:4 Predictive@L3. Changing the profile did not work, so it seems that that ffmeg is using XCB. FFMPEG Documentation

1
  • Why doesn't VLC set the the video output mode automatically when in Automatic mode ? However I found an alternative codec named nvenc_h264 which works fine and eliminates the need to change the output mode and also gets (en/de)coded via the video engine of the underlying GPU.So for example fps can be higher in gaming compared to h264.However thanks for your answer. – Parsa Mousavi Jun 29 '20 at 8:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.