如何在 mac 上将视屏转成 gif 图片

在 github 和其他一些博客中经常见到有人贴上了动态的操作视频,于是自己也想整一下。参照了简书博主KFAaron的文章 Mac上怎么把mov文件转成gif文件,并解决了遇到的问题做了如下记录。

步骤一: 打开 QuickTime

本人使用的是中文版。

  1. 右上角文件
  • 新建影片录制(第一个)
  • 在下方录制红点旁选择你的手机
  • 点击录制
  • 录制完成后保存(mov 和 m4v都行)

步骤二: 下载 gifify和相关依赖

这个步骤的前提是你已经安装了 homebrew 和 *** node.js*** 环境,此处不做阐述。

1. 安装 FFmpeg

    brew install ffmpeg --with-libass --with-fontconfigbrew install ffmpeg --with-libass --with-fontconfig

2. 安装convert

brew install imagemagick --with-fontconfig

3. 安装giflossy

之前参照别人的方法,估计是我的步骤问题,出现了gifsicle needs lossy 的问题,发现直接用 brew 安装可以解决

brew install giflossy  

4. 安装 giffy

npm install -g gifify

5. 检查是否正确安装

gifify -h

如果正确,应该有如下打印

  Usage: gifify [options] [file]


  Options:

    -V, --version           output the version number
    --colors <n>            Number of colors, up to 255, defaults to 80 (default: 80)
    --compress <n>          Compression (quality) level, from 0 (no compression) to 100, defaults to 40 (default: 40)
    --from <position>       Start position, hh:mm:ss or seconds, defaults to 0
    --fps <n>               Frames Per Second, defaults to 10 (default: 10)
    -o, --output <file>     Output file, defaults to stdout
    --resize <W:H>          Resize output, use -1 when specifying only width or height. `350:100`, `400:-1`, `-1:200`
    --reverse               Reverses movie
    --speed <n>             Movie speed, defaults to 1 (default: 1)
    --subtitles <filepath>  Subtitle filepath to burn to the GIF
    --text <string>         Add some text at the bottom of the movie
    --to <position>         End position, hh:mm:ss or seconds, defaults to end of movie
    --no-loop               Will show every frame once without looping (default: true)
    -h, --help              output usage information

使用方法:

  1. cd 到需要转换的视屏目录
  2. 执行如下代码:
gifify test.m4v -o test2.gif
  1. 等待一会儿就好了
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容