gifgen高质量 GIF 编码

联合创作 · 2023-09-29 23:17

gifgen 是高质量的 GIF 编码,可输出更细腻的 GIF 图像。

使用 ffmpeg 对 GIF 进行编码可能很糟糕,因为 GIF 仅限于 256 种颜色的调色板,而 ffmpeg 仅使用通用调色板来覆盖各种颜色。

gifgen 通过进行 2-pass 编码产生更好的结果, 第一遍基于每帧的所有像素生成自定义调色板, 第二遍再使用此调色板,而不是与 ffmpeg 捆绑的默认调色板对 GIF 进行编码。

ffmpeg 默认 Gif 效果

gifgen:

用法

$ gifgen -h gifgen 1.2.0 Usage: gifgen [options] [input] Options: -o Output file [input.gif] -f Frames per second [10] -s Optimize for static background -v Display verbose output from ffmpeg -w Scale output with horizontal resolution -b Begin the clip at a given timestamp (in seconds) -d Duration in seconds of the resulting gif, can be combined with at Examples: $ gifgen video.mp4 $ gifgen -o demo.gif SCM_1457.mp4 $ gifgen -sf 15 screencap.mov $ gifgen -sf 15 -w 320 screencap.mov Begin at 3.5 seconds into the video, make the gif using the next 5.5 seconds $ gifgen -b 3.5 -d 5.5 screencap.mov 

安装

苹果系统

brew install lukechilds/tap/gifgen

Linux

克隆此 repo ,并将 gifgen 复制/符号链接到您的 PATH 或直接使用 ./gifgen 运行脚本, 需要安装 ffmpeg。

 

 

浏览 7
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报