如何在 mac 上將視屏轉(zhuǎn)成 gif 圖片

在 github 和其他一些博客中經(jīng)常見到有人貼上了動(dòng)態(tài)的操作視頻,于是自己也想整一下。參照了簡書博主KFAaron的文章 Mac上怎么把mov文件轉(zhuǎn)成gif文件,并解決了遇到的問題做了如下記錄。

步驟一: 打開 QuickTime

本人使用的是中文版。

  1. 右上角文件
  • 新建影片錄制(第一個(gè))
  • 在下方錄制紅點(diǎn)旁選擇你的手機(jī)
  • 點(diǎn)擊錄制
  • 錄制完成后保存(mov 和 m4v都行)

步驟二: 下載 gifify和相關(guān)依賴

這個(gè)步驟的前提是你已經(jīng)安裝了 homebrew 和 *** node.js*** 環(huán)境,此處不做闡述。

1. 安裝 FFmpeg

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

2. 安裝convert

brew install imagemagick --with-fontconfig

3. 安裝giflossy

之前參照別人的方法,估計(jì)是我的步驟問題,出現(xiàn)了gifsicle needs lossy 的問題,發(fā)現(xiàn)直接用 brew 安裝可以解決

brew install giflossy  

4. 安裝 giffy

npm install -g gifify

5. 檢查是否正確安裝

gifify -h

如果正確,應(yīng)該有如下打印

  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 到需要轉(zhuǎn)換的視屏目錄
  2. 執(zhí)行如下代碼:
gifify test.m4v -o test2.gif
  1. 等待一會(huì)兒就好了
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容