红联Linux门户
Linux帮助

Linux录制gif文件

发布时间:2016-10-11 09:13:53来源:blog.csdn.net/peng_cao作者:pengcao89
前言
在分享一些知识点的时候,往往是一图胜前言,但是图片只是静态的,也有其局限性;这就想到了动态图片—gif,这里介绍下Linux环境下录制gif文件的方法。
 
安装
这里使用Ubuntu 16.04,Unity界面,使用byzanz录制gif文件
sudo apt-get install byzanz 
 
使用
在使用看看byzanz的用法
Usage:
byzanz-record [OPTION…] record your current desktop session
Help Options:
-?, –help Show help options
–help-all Show all help options
–help-gtk Show GTK+ Options
Application Options:
-d, –duration=SECS Duration of animation (default: 10 seconds)
-e, –exec=COMMAND Command to execute and time
–delay=SECS Delay before start (default: 1 second)
-c, –cursor Record mouse cursor
-a, –audio Record audio
-x, –x=PIXEL X coordinate of rectangle to record
-y, –y=PIXEL Y coordinate of rectangle to record
-w, –width=PIXEL Width of recording rectangle
-h, –height=PIXEL Height of recording rectangle
-v, –verbose Be verbose
–display=DISPLAY X display to use
byzanz-record -d 10 -x 10 -y 10 -w 600 -h 500 test_gif.gif
其中
-d 10 录制时间长度为10秒,默认也是10秒
-x 10 录制区域的横坐标
-y 10 录制区域的纵坐标
-w 600 录制区域的宽度
-h 500 录制区域的高度
test_gif.gif 录制后的文件名
这样就可以录制屏幕操作为gif文件了
这样有个问题就算,我需要手动的,使用实实在在的参数数字来指定要录制的区域,但,往往我们又很难知道。所以,这里就打算把整个屏幕区域录制下来,使用xrandr来查看当前屏幕的分辨率,并指定参数给byzanz
xx@xx:~ $xrandr
Screen 0: minimum 8 x 8, current 1600 x 900, maximum 32767 x 32767
HDMI1 disconnected (normal left inverted right x axis y axis)
VGA1 connected primary 1600x900+0+0 (normal left inverted right x axis y axis) 434mm x 236mm
1600x900 60.00*+
1280x1024 75.02 60.02
1280x720 60.00
1024x768 75.08 70.07 60.00
832x624 74.55
800x600 72.19 75.00 60.32 56.25
640x480 75.00 72.81 66.67 60.00
720x400 70.08
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
这样就可以指定录制区域为整个屏幕,就不会漏了
byzanz-record -d 40  -w 1600 -h 900 my_gif.gif
 
效果
Linux录制gif文件
 
本文永久更新地址:http://www.linuxdiyf.com/linux/24917.html