很多同学在编写文章时需要使用一些Gif动画,今天给大家讲解下如何在Mac环境中制作Gif动画。

安装工具

安装brew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安装ffmpeg

brew install ffmpeg

安装gifsicle

brew install gifsicle

转化视频

ffmpeg -i google.mov -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > google.gif

参数解析:
-r 10 告诉 ffmpeg 将视频的帧率转成 10fps, 这样可以减小视频体积
-s 600×400 这是你的视频的尺寸, 600×400
–delay=10 告诉 gifsicle GIF 每帧之间的时间间隔是 100ms(也就是帧率为 10fps, 1000ms/10fps = 100ms = 10x10ms), gifsicle 使用的单位是 10ms, 不是 ms
–optimize=3 让 gifsicle 优化一下, 设置为 3 即可

录制屏幕

用Mac自带的 QuickTime Player 录制屏幕。

Comments
Write a Comment