使用 ffmpeg 录制屏幕录像的最轻松方法是什么?

使用 ffmpeg 录制屏幕录像的最轻松方法是什么?

我想要以 60fps 的速度捕捉屏幕截图。

我尝试过这个:

ffmpeg -f alsa -ac 2 -i pulse -c:a pcm_s16le -f x11grab -r 60 -s 1920x1080 -i :0.0 -c:v libx264 -preset ultrafast -crf 0 out.mkv 

然而,它在捕捉时引起了一些明显的抖动,而且即使没有桌面合成(康普顿),似乎也没有超过 35 fps。

音频和视频的整个部分也丢失了,导致音频和视频出现大幅度跳跃和不同步。

我在英特尔至强四核 CPU 上运行带有 Openbox 的 Archlinux。(不确定具体型号,但如果需要我可以查明)

有没有开销较小的方法?


根据评论中的要求:

ffmpeg -f x11grab -framerate 60 -video_size 1920x1080 -i :0.0 -c:v libx264rgb -crf 0 -preset ultrafast -t 10 -f null -

ffmpeg version 2.4.3 Copyright (c) 2000-2014 the FFmpeg developers
  built on Nov 28 2014 18:38:33 with gcc 4.9.2 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-shared --enable-avisynth --enable-avresample --enable-decoder=atrac3 --enable-decoder=atrac3p --enable-dxva2 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gpl --enable-gray --enable-ladspa --enable-libaacplus --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcelt --enable-libdc1394 --enable-libfaac --enable-libfdk-aac --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libutvideo --enable-libv4l2 --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-nonfree --enable-openal --enable-opencl --enable-opengl --enable-openssl --enable-runtime-cpudetect --enable-shared --enable-swresample --enable-vdpau --enable-version3 --enable-x11grab
  libavutil      54.  7.100 / 54.  7.100
  libavcodec     56.  1.100 / 56.  1.100
  libavformat    56.  4.101 / 56.  4.101
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  1.100 /  5.  1.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
[x11grab @ 0xc32f20] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1920 height: 1080
[x11grab @ 0xc32f20] shared memory extension found
Input #0, x11grab, from ':0.0':
  Duration: N/A, start: 1417394813.860186, bitrate: N/A
    Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1920x1080, -2147483 kb/s, 60 tbr, 1000k tbn, 60 tbc
No pixel format specified, rgb24 for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264rgb @ 0xc49c40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
[libx264rgb @ 0xc49c40] profile High 4:4:4 Predictive, level 4.2, 4:4:4 8-bit
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf56.4.101
    Stream #0:0: Video: h264 (libx264rgb), rgb24, 1920x1080, q=-1--1, 60 fps, 60 tbn, 60 tbc
    Metadata:
      encoder         : Lavc56.1.100 libx264rgb
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264rgb))
Press [q] to stop, [?] for help
frame=  207 fps= 23 q=-1.0 Lsize=N/A time=00:00:08.91 bitrate=N/A    
video:3932kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264rgb @ 0xc49c40] frame I:1     Avg QP: 0.00  size:644758
[libx264rgb @ 0xc49c40] frame P:206   Avg QP: 0.00  size: 16415
[libx264rgb @ 0xc49c40] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264rgb @ 0xc49c40] mb P  I16..4: 71.2%  0.0%  0.0%  P16..4:  0.2%  0.0%  0.0%  0.0%  0.0%    skip:28.6%
[libx264rgb @ 0xc49c40] coded y,u,v intra: 0.2% 0.3% 0.3% inter: 0.5% 0.5% 0.5%
[libx264rgb @ 0xc49c40] i16 v,h,dc,p: 99%  1%  0%  0%
[libx264rgb @ 0xc49c40] kb/s:3605.53

相关内容