ffcast: 巨小巧的屏幕录制工具
时间:2009-11-24
来源:互联网
功能简介:
*调用ffmpeg录制所选屏幕区域 *支持ffmpeg所支持的所有编码格式 *选择录制区域的方式有多种: >a) 全屏(-a选项) >b) 鼠标点选; 支持选择多个窗口(-n选项) >c) 命令行指定窗口ID; 支持选择多个窗口(-i选项) >d) 鼠标拖拽选择, 就如同`scrot -s'(-s选项) >e) 命令行自由指定选区 (-j选项) *对于选区方式b)和c), 可选择考虑或者忽略窗口边框(-B/-b选项) *默认采用无损x264编码,输出视频体积相当小巧 *可选所有ffmpeg预置的x264 presets, 使得视频质量控制更简便 *CLI |
另外从scrot的main.c中提取/修改了xrectsel.c, 以实现鼠标拖拽选择矩形区域的功能
安装后在/usr/bin/下会增加两个文件: ffcast 和 xrectsel
欢迎使用, 试验, 报错, 索要新功能
欢迎提供patch以及money
编辑:
____重要更新: xrectsel.c代码重写, 修正了-s选项高CPU使用的现象 (如果你还没发现的话, 不妨htop一下)
编辑:
____更新: xrectsel现在采用十字形鼠标(XC_crosshair), 既有提示作用, 选择也更加准确.
编辑(11.29)
感谢糊涂同学对ffcast几次更新的汇总! 请跳转浏览器至:
http://www.linuxsir.org/bbs/post2050835-26.html |
首先, 以下是现在 ffcast 会安装的几个文件
/usr/bin/ffcast /usr/bin/xrectsel /usr/share/ffcast/doc/ffcast.conf /usr/share/man/man1/ffcast.1.gz |
如何使用和编辑配置文件:
mkdir "${XDG_CONFIG_HOME:-$HOME/.config}/ffcast" cp /usr/share/ffcast/doc/ffcast.conf "${XDG_CONFIG_HOME:-$HOME/.config}/ffcast/ffcast.conf" vim "${XDG_CONFIG_HOME:-$HOME/.config}/ffcast/ffcast.conf" |
另外 ffcast 现在有 man page 了, 不过不是非常完整. easycat还说读不懂 555。。
其余更新我懒得写了, 使用 --help 和 man page 应该足够了
如果你想详细了解更新的进度, 可以在 $srcdir/ffcast 使用 git log 查看
还有, 如果你有什么疑问, 请把问题描述出来, 不然我会满脑子都是问号的
作者: lolilolicon 发布时间: 2009-11-24
作者: adaml 发布时间: 2009-11-24
作者: Havanna 发布时间: 2009-11-24
作者: Havanna 发布时间: 2009-11-24
但这样的坏处是升级必然会取代这些设定.
如果要使用配置文件我能想到的最方便的方法就是source ~/$FFCASTCONF, 然而...我认为 source 比较容易带来安全上的问题...
我想听听大家的意见如何
新消息:
刚刚加了新选项, -t,--duration : 用来限制录制的最大时长. 这样就不必每次都按[q]才可以结束了.
作者: lolilolicon 发布时间: 2009-11-24
需要libgif?
作者: Havanna 发布时间: 2009-11-24
作者: carbonjiao 发布时间: 2009-11-24
作者: Havanna
请问,输出到图片gif为何不行呢?
需要libgif? |
11:36 < canti> hi there. why this fails? http://dpaste.com/124352/ 11:41 < theholydu> canti, i think it sorta 11:41 < theholyduck> prints out why it fails 11:41 < theholyduck> and what to do about it 11:41 < theholyduck> oh wait, you tried that 11:41 < canti> yah.. 11:42 < theholyduck> gif output sucks though :P 11:42 < canti> i also tried putting elsewhere in the commandline -pix_fmt rgb24 ... 11:43 < canti> i agree gif sucks, but somebody wants it xD 11:43 <@Dark_Shikari> ffmpeg's gif output sucks more 11:43 <@Dark_Shikari> try imagemagick maybe 11:44 <@bcoudurier> what's wrong with it ? 11:44 <@Dark_Shikari> I recall that it isn't very optimized iirc... 11:44 <@Dark_Shikari> I don't think it does global palettes 11:44 <@Dark_Shikari> optimized global palettes that is 11:44 <@Dark_Shikari> wait, it doesn't even do optimized palettes period 11:44 < canti> Dark_Shikari: possible to fix my command line? 11:44 <@Dark_Shikari> there's even a great comment that says 11:45 <@Dark_Shikari> "better than nothing gif encoder" 11:45 <@bcoudurier> ah 11:46 < canti> Does it do gif from x11grab? the import command? <-- <@Dark_Shikari> try imagemagick maybe 11:46 <@Dark_Shikari> why not record the video once 11:46 <@Dark_Shikari> and then convert it to gif later? 11:46 <@Dark_Shikari> or use ffmpeg to write a series of, say, pngs 11:47 <@Dark_Shikari> and then convert those to an animated gif with imagemagick later 11:49 < canti> Dark_Shikari: but that will be huge with pngs, and takes one more extra step with converting later. i'm using this in a screencast script, gif is just an output option i thought it/ffmpeg should support. ... ... 11:56 <@bcoudurie> canti, -vcodec rawvideo -pix_fmt rgb24 11:56 < canti> bcoudurier: let me try 11:58 < canti> bcoudurier: it works. but it's HUGE!!! 26M for 5 sec 11:59 <@bcoudurier> yes, lzw compression is missing 11:59 <@bcoudurier> it's "better than nothing" 11:59 < Haxar> or you could just pipe it ![]() 11:59 <@bcoudurier> anyway I'm off 12:00 < canti> Haxar: i was thinking about this, but well... |
下面的命令使用ImageMagick的convert把ffmpeg编码的raw格式转成压缩格式的gif
$ ffmpeg -r 15 -s 640x480 -an -f x11grab -i ${DISPLAY}+0+0 -vcodec rawvideo -pix_fmt rgb24 -f gif -t 5 - | convert gif:- cast.gif
编辑:
最新的脚本支持使用-c gif或-f gif输出gif文件, 但由于ffmpeg貌似只支持未压缩的gif输出, 文件会很大. 参看git log:
fixed :: gif output now is supported, but is uncompressed, which \ means it will be HUGE, possible solutions: * pipe it to convert gif:- output.gif; this requires ImageMagick; * find a way to tell ffmpeg how to do compressed gif; * do not use gif format; formatting :: rearranged, overall formatting looks clearer. |
ffcast -s -t 5 -c gif -f gif -o - --debug | convert gif:- cast.gif |
作者: lolilolicon 发布时间: 2009-11-24
作者: omegao 发布时间: 2009-11-24
ffcast -s -r 3 -f gif -o - --debug | convert gif:- 1.gif
就是颜色失真还是真厉害。。。:(
thanks
作者: Havanna 发布时间: 2009-11-24
作者: sfbi 发布时间: 2009-11-25
好消息是, 这个问题已经修正. 请看首贴~
另外对于大家的支持和鼓励, 在下非常感谢.
Havanna: nice catch.
编辑:
gif output now loops forever :: ffmpeg :: -loop_output 0
作者: lolilolicon 发布时间: 2009-11-25
本机是ffcast 20091124-1,aur上面的是ffcast 20091123-1。
作者: jqxl0205 发布时间: 2009-11-25
你明天用aur编译就变成1125喽
作者: hurricanek 发布时间: 2009-11-25
作者: jqxl0205
我这边安装的版本号怎么比aur上面的大呀!
本机是ffcast 20091124-1,aur上面的是ffcast 20091123-1。 |
作者: /usr/bin/makepkg
... ...
(1242行) newpkgver=$(date +%Y%m%d) ... ... (1290行) sed -i "s/^pkgver=[^ ]*/pkgver=$newpkgver/" "$BUILDFILE" (1291行) sed -i "s/^pkgrel=[^ ]*/pkgrel=1/" "$BUILDFILE" |
作者: lolilolicon 发布时间: 2009-11-25
出现上面的提示后,我要怎么用鼠标来选择一个区域呢?我是说可以在任意的界面上来选择一个区域吗?是用鼠标左键吧,如果开始录制后会有提示吗?我出现的问题是在上面的界面一直就不动了,按键的话会说(EE)xrectsel returned wrong Data:
我的系统:archlinux,fluxbox,urxvt
作者: crazyrain 发布时间: 2009-11-25
选区跟scrot -s一样操作, 按下左键后拖拽然后释放:
ffcast -s -o cast.mkv ==> Select area to be captured by dragging the mouse ==> Capture geometry: 514x316+376+205 ==> Capture started, press [q] to finish ==> Output filename: cast.mkv
ffcast -s -o cast.mkv ==> Select area to be captured by dragging the mouse xrectsel: Keyboard pressed, aborting (EE) xrectsel returned wrong Data:
xrectsel 615x516+425+158
作者: lolilolicon 发布时间: 2009-11-25
欢迎大家提供patch. 尤其是EXAMPLE那段
谢谢
作者: lolilolicon 发布时间: 2009-11-26
(A) 添加 -j,--xjustcap <geometry> 选项: 这个选项让用户可以直接在命令行准确指定任意屏幕区域进行录制, 而不需要手动选区. 目前支持的 geometry 格式有: 1) 两点选区: 用两个对角点的 (x,y) 坐标指定矩形区域. 例子: ffcast -j '20%,30% 960,600' -o cast.mkv 是的, 20% == 20% * 1280 == 256 (1280是我屏幕的横向分辨率) 2) 长x宽+位+置: 例子: ffcast -j '848x640+4-6 southwest' -o cast.mp4 将指定一个 848x640 大小的区域, 它的左边界距离屏幕左边缘 4 像素(+4), 它的下边界高于屏幕下缘 6 像素(-6) 其中 southwest 是 gravity, 它的作用相当于将这个 848x640 的区域初始位置固定在屏幕左下角, 尔后 +4-6 将这个选区向相应的方向(+为向下或向右, -则相反)移动指定像素(4,6) 正如你的预料, gravity 可以是 northwest(默认), north, northeast, east, southeast, south, southwest, west, center 九个方向 (B) 修改旧选项: -S 现在变成 -w, 这样更符合逻辑(-s,-w,-j) ; -m 更改为 -M, 因为你通常不会用到它. (C) 修正了一些小bug. |
另外对于 -j 选项应该支持的 geometry 格式, 大家有什么好主意/要求, 不妨直说
作者: lolilolicon 发布时间: 2009-11-26
作者: Havanna 发布时间: 2009-11-27
使用--debug运行ffcast, 把你录的compiz视频再录制一次, 发到网上(例如omploader.com). 然后贴出命令行的输出和视频链接.
我猜测开启(3D) composition的桌面可能会引起问题; 也有可能跟驱动有一定关系.
PS: ffcast的ffmpeg命令行目前还没有仔细研究, 最近的更新更多集中在 选区/选择窗口/选择屏幕 这些问题上.
编辑: Havanna, 升级到最新的ffcast, 用--debug运行ffcast, 查看输出中的`(DD) ffmpeg: commind line: ffmpeg .*' 然后在终端直接运行这个命令, 不过在 输出文件前加上 -sameq 选项. 我不确定, 试一下看看结果. (我没有安装compiz自己不方便试验)
编辑2:
作者: Nixie [email protected]
Wait, after talking in #compiz I chose Force synchronization between X and GLX in the Compiz settings and it has all but wiped out the problems!
|
作者: lolilolicon 发布时间: 2009-11-27
本人的glxgears好像记得500fps左右
$ ffmpeg -r 15 -v 1 -s 1366x744 -an -f x11grab -i :0+0,23 -vcodec libx264 -vpre main -vpre lossless_slow -crf 0 -sameq "ffcast.avi" FFmpeg version 0.5, Copyright (c) 2000-2009 Fabrice Bellard, et al. configuration: --prefix=/usr --enable-gpl --enable-libmp3lame --enable-libvorbis --enable-libfaac --enable-libfaad --enable-libxvid --enable-libx264 --enable-libtheora --enable-postproc --enable-shared --enable-pthreads --enable-x11grab --enable-swscale libavutil 49.15. 0 / 49.15. 0 libavcodec 52.20. 0 / 52.20. 0 libavformat 52.31. 0 / 52.31. 0 libavdevice 52. 1. 0 / 52. 1. 0 libswscale 0. 7. 1 / 0. 7. 1 libpostproc 51. 2. 0 / 51. 2. 0 built on Apr 18 2009 20:24:32, gcc: 4.3.3 [x11grab @ 0x1ef1a60]device: :0+0,23 -> display: :0 x: 0 y: 23 width: 1366 height: 744 [x11grab @ 0x1ef1a60]shared memory extension found Input #0, x11grab, from ':0+0,23': Duration: N/A, start: 1259289672.278709, bitrate: 487825 kb/s Stream #0.0: Video: rawvideo, rgb32, 1366x744, 487825 kb/s, 15 tbr, 1000k tbn, 15 tbc Output #0, avi, to 'ffcast.avi': Stream #0.0: Video: libx264, yuv420p, 1366x744, q=10-51, 200 kb/s, 90k tbn, 15 tbc Stream mapping: Stream #0.0 -> #0.0 [libx264 @ 0x1f00a60]using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64 [libx264 @ 0x1f00a60]profile High 4:4:4 Predictive, level 3.2 Press [q] to stop encoding frame= 129 fps= 7 q=-1.0 Lsize= 2344kB time=18.13 bitrate=1059.1kbits/s video:2332kB audio:0kB global headers:0kB muxing overhead 0.511944% [libx264 @ 0x1f00a60]slice I:2 Avg QP: 0.00 size:184468 [libx264 @ 0x1f00a60]slice P:127 Avg QP: 0.00 size: 15887 [libx264 @ 0x1f00a60]mb I I16..4: 67.8% 5.2% 27.0% [libx264 @ 0x1f00a60]mb P I16..4: 3.0% 0.9% 1.3% P16..4: 0.5% 0.1% 0.2% 0.1% 0.1% skip:93.8% [libx264 @ 0x1f00a60]8x8 transform intra:14.6% inter:24.9% [libx264 @ 0x1f00a60]ref P L0 82.2% 17.8% [libx264 @ 0x1f00a60]kb/s:2220.1
作者: Havanna 发布时间: 2009-11-27
增加了配置文件, 虽然还是觉得没有多大必要(选项很少)
关于配置文件, 需要注意的几点:
1. 只能且必须使用单引号: 比如 SELMODE='XWININFO' 是可以的, 但 SELMODE=“XWININFO” 却是不行的, 它将被忽略 2. 如果要在单引号内使用单引号, 你必须使用'"'"' 3. 用户配置文件的位置: $XDG_CONFIG_HOME/ffcast/ffcast.conf, 也就是 $HOME/.config/ffcast/ffcast.conf 4. 示例配置文件在/usr/share/ffcast/doc/ffcast.conf |
更新了Makefile和man page.
作者: lolilolicon 发布时间: 2009-11-29
好些特殊符号的说
作者: easycat 发布时间: 2009-11-29
显示格式有问题?
(这个man page不是用工具写的, 只自己看了一下别的man page, 学了一点格式符号, 写了一个小脚本生成一个man page然后再自己手动添油加醋的.. 所以不能保证没有问题...)
不过我这边的显示是正确的:
或者你是指内容本身有难懂的地方吗?
那样的话就把具体哪里难懂贴上来, 我再去修改
谢谢
作者: lolilolicon 发布时间: 2009-11-29
功能简介: 引用:*调用ffmpeg录制所选屏幕区域 *支持ffmpeg所支持的所有编码格式 *选择录制区域的方式有多种: >a) 全屏(-a选项) >b) 鼠标点选; 支持选择多个窗口(-n选项) >c) 命令行指定窗口ID; 支持选择多个窗口(-i选项) >d) 鼠标拖拽选择, 就如同`scrot -s'(-s选项) >e) 命令行自由指定选区 (-j选项) *对于选区方式b)和c), 可选择考虑或者忽略窗口边框(-B/-b选项) *默认采用无损x264编码,输出视频体积相当小巧 *可选所有ffmpeg预置的x264 presets, 使得视频质量控制更简便 *CLI 我在Michal Witkowski原来的小脚本的基础上, 增加/调整了相当数量的代码 另外从scrot的main.c中提取/修改了xrectsel.c, 以实现鼠标拖拽选择矩形区域的功能 安装后在/usr/bin/下会增加两个文件: ffcast 和 xrectsel 欢迎使用, 试验, 报错, 索要新功能 欢迎提供patch以及money 09-11-28, 22:45 更新: (A)增加了配置文件, 虽然还是觉得没有多大必要(选项很少) 关于配置文件, 需要注意的几点: 引用:1. 只能且必须使用单引号: 比如 SELMODE='XWININFO' 是可以的, 但 SELMODE=“XWININFO” 却是不行的, 它将被忽略 2. 如果要在单引号内使用单引号, 你必须使用'"'"' 3. 用户配置文件的位置: $XDG_CONFIG_HOME/ffcast/ffcast.conf, 也就是 $HOME/.config/ffcast/ffcast.conf 4. 示例配置文件在/usr/share/ffcast/doc/ffcast.conf (B)去除了-g -G两个选项, 你可以使用 -f '' -c '' 获得以前-g选项的行为 (C)更新了Makefile和man page. xx-xx-xx更新: xrectsel现在采用十字形鼠标(XC_crosshair), 既有提示作用, 选择也更加准确. 09-11-26, 15:30 更新: (A) 添加 -j,--xjustcap <geometry> 选项: 这个选项让用户可以直接在命令行准确指定任意屏幕区域进行录制, 而不需要手动选区. 目前支持的 geometry 格式有: 1) 两点选区: 用两个对角点的 (x,y) 坐标指定矩形区域. 例子: ffcast -j '20%,30% 960,600' -o cast.mkv 是的, 20% == 20% * 1280 == 256 (1280是我屏幕的横向分辨率) 2) 长x宽+位+置: 例子: ffcast -j '848x640+4-6 southwest' -o cast.mp4 将指定一个 848x640 大小的区域, 它的左边界距离屏幕左边缘 4 像素(+4), 它的下边界高于屏幕下缘 6 像素(-6) 其中 southwest 是 gravity, 它的作用相当于将这个 848x640 的区域初始位置固定在屏幕左下角, 尔后 +4-6 将这个选区向相应的方向(+为向下或向右, -则相反)移动指定像素(4,6) 正如你的预料, gravity 可以是 northwest(默认), north, northeast, east, southeast, south, southwest, west, center 九个方向 (B) 修改旧选项: -S 现在变成 -w, 这样更符合逻辑(-s,-w,-j) ; -m 更改为 -M, 因为你通常不会用到它. (C) 修正了一些小bug. 09-11-25, 21:07 更新: 添加了manpage 09-11-24, 19:11 更新: xrectsel.c代码重写。大家有没有注意到 -s 选项引起高CPU使用的现象? 没发现的拿htop瞄一眼然后拍大腿~好消息是, 这个问题已经修正 09-11-24, 00:54 更新: 刚刚加了新选项, -t,--duration : 用来限制录制的最大时长. 这样就不必每次都按[q]才可以结束了. |
作者: 糊涂 发布时间: 2009-11-29
历史记录全部可以在这里找到:
http://github.com/lolilolicon/ffcast/commits/master/
或者更简单, 更新, cd 到 $srcdir/ffcast, git log :-)
基本上, 如果你发现什么问题, 你应该首先更新, 如果问题还是没有解决, 就在这里发贴, 把你的 --debug 命令输出发上来, 描述问题(最好发一个视频 sample )
另外就是 ffcast 录制视频本身是靠的 ffmpeg, 如果问题出在 ffmpeg 自身的 bug, ffcast 是无能为力的
每次都在首楼更新会很麻烦 。。。 其实我比较懒啦。。
作者: lolilolicon 发布时间: 2009-11-29
作者: 糊涂 发布时间: 2009-11-29
楼主有空整个基于imagemagic的convert impot display等脚本出来吧
作者: Havanna 发布时间: 2010-04-15
作者: qiang_liu8183 发布时间: 2010-04-15
現在,我還有另一個需求,就是當我在遠端時,使用VNC Client登入遠端的Server. 此時,我想同樣利用ffcast來錄製桌面(在VNC上看到的畫面),但無法成功,會出現下列錯誤訊息,因此想請教各位,看各位能否幫忙或提供解決的方向,謝謝!!
alex@taipei:~/lolilolicon-ffcast-a2d2c42$ ffcast --debug -b -o cast.mkv(DD) Checking display :2.0 with `xrectsel :2.0 checkdpy'
xrectsel: Valid display_name :2.0
ls: cannot access /usr/share/ffmpeg: No such file or directory
(DD) VCODEC: -vcodec libx264 -vpre main -vpre lossless_slow -crf 0
(DD) FORMAT: -f h264
(DD) geometry: root: 1024x768
==> Click to select 1 window(s) to be captured
-> Selecting 1 of 1 window(s)
(DD) geometry: (0,0) (0,0)
(DD) geometry: mod 2: 1024x768
(DD) geometry: in screen:1024x768+0+0
==> Capture geometry: 1024x768+0+0
(DD) ffmpeg: command line:
ffmpeg -r 15 -v 1 -s 1024x768 -an -f x11grab -i :2.0+0,0 -vcodec libx264 -vpre main -vpre lossless_slow -crf 0 -f h264 -sameq "cast.mkv"
==> Capture started, press [q] to finish
FFmpeg version SVN-r23008, Copyright (c) 2000-2010 the FFmpeg developers
built on May 3 2010 11:42:42 with gcc 4.4.1
configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab
libavutil 50.15. 0 / 50.15. 0
libavcodec 52.66. 0 / 52.66. 0
libavformat 52.62. 0 / 52.62. 0
libavdevice 52. 2. 0 / 52. 2. 0
libswscale 0.10. 0 / 0.10. 0
libpostproc 51. 2. 0 / 51. 2. 0
[x11grab @ 0x8ec1420]device: :2.0+0,0 -> display: :2.0 x: 0 y: 0 width: 1024 height: 768
Xlib: extension "Generic Event Extension" missing on display ":2.0".
[x11grab @ 0x8ec1420]shared memory extension found
/usr/bin/ffcast: line 485: 21069 Segmentation fault (core dumped) ffmpeg -r ${FPS} -v 1 -s ${LEN_X}x${LEN_Y} -an -f x11grab -i ${CAPDPY}+${POS_X},${POS_Y} ${VCODEC} ${FORMAT} ${CASTSPAN} -sameq "${OUTPUT}" 2> "${DEBUG}"
(EE) ffmpeg: failed, try running with --debug
==> Output filename: cast.mkv
alex@taipei:~/lolilolicon-ffcast-a2d2c42$
作者: alex188 发布时间: 2010-05-03
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28