尝试将屏幕捕获到用无损 x264 编码的视频文件中:
vic@vic-X202E ~/Desktop » ffmpeg -f x11grab -r 15 -s 1366x768 -i :0.0 -sameq -vcodec libx264 -preset:v ultrafast test.mkv
ffmpeg version 0.8.4-6:0.8.4-0ubuntu0.12.10.1, Copyright (c) 2000-2012 the Libav developers
built on Nov 6 2012 16:51:11 with gcc 4.7.2
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
[x11grab @ 0xc2bf60] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1366 height: 768
[x11grab @ 0xc2bf60] shared memory extension found
[x11grab @ 0xc2bf60] Estimating duration from bitrate, this may be inaccurate
Input #0, x11grab, from ':0.0':
Duration: N/A, start: 1357648973.267658, bitrate: 503562 kb/s
Stream #0.0: Video: rawvideo, bgra, 1366x768, 503562 kb/s, 15 tbr, 1000k tbn, 15 tbc
Unrecognized option 'preset:v'
Failed to set value 'ultrafast' for option 'preset:v'
再试一次:
vic@vic-X202E ~/Desktop » ffmpeg -f x11grab -r 15 -s 1366x768 -i :0.0 -sameq -vcodec libx264 -preset ultrafast test.mkv
ffmpeg version 0.8.4-6:0.8.4-0ubuntu0.12.10.1, Copyright (c) 2000-2012 the Libav developers
built on Nov 6 2012 16:51:11 with gcc 4.7.2
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
[x11grab @ 0x2482f60] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1366 height: 768
[x11grab @ 0x2482f60] shared memory extension found
[x11grab @ 0x2482f60] Estimating duration from bitrate, this may be inaccurate
Input #0, x11grab, from ':0.0':
Duration: N/A, start: 1357648985.325860, bitrate: 503562 kb/s
Stream #0.0: Video: rawvideo, bgra, 1366x768, 503562 kb/s, 15 tbr, 1000k tbn, 15 tbc
Unrecognized option 'preset'
Failed to set value 'ultrafast' for option 'preset'
vic@vic-X202E ~/Desktop »
有什么问题吗?使用 Kubuntu 12.10。
答案1
请不要使用该same_quant
选项。它并没有实现你所想的那样。
现在,为了实现无损压缩,您需要指定一个质量稳定的 0 与-crf 0
。
avconv -f x11grab -r 15 -s 1366x768 -i :0.0 \
-c:v libx264 -preset ultrafast -crf 0 \
test.mkv
查看x264 编码指南获得更多选项。如果您没有 x264,则需要libavcodec-extra
。
请注意,FFmpeg 和 Libav 应该以相同的方式处理此命令。你的系统问题是你的 FFmpeg 版本太旧了。你应该自己编译或下载从主页静态构建. 两者都包含 x264。
答案2
尝试使用avconv
代替ffmpeg
。(Ubuntu 中这两个分支之间的关系似乎是复杂问题)。
ffmpeg
在我的 12.10 系统上,我拥有和的可执行文件,但只有(在)avconv
的预设文件。avconv
/usr/share/avconv
尝试:
avconv -f x11grab -r 15 -s 1366x768 -i :0.0 -same_quant -codec:v libx264 -pre:v ultrafast test.mkv