V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
deepkolos
V2EX  ›  分享创造

方便修改动画 webp 的小工具

  •  
  •   deepkolos ·
    deepkolos · 2019-08-17 14:48:31 +08:00 · 2052 次点击
    这是一个创建于 1706 天前的主题,其中的信息可能已经有所发展或是发生改变。

    AWebp

    animated webp 小工具, 对 libwebp 的简单封装, 提供对 animated webp 相关的常用批处理功能(笨方法)

    > npm i -g awebp
    > awebp -h
    
      -h --help                                                      显示帮助
      -d --dispose [method] [file] [outFile]                         dispose-method: 0 for NONE or 1 for BACKGROUND
      -q --quality [quality] [file] [outFile]                        Specify the compression between 0 and 100
      -e --extract-frame [file] [outDir]                             提取所有帧出来
      -c --compose [frameDir] [outFile] [frameOpt] [loop] [bgColor]          从多个图片合成 animated webp, frameOpt 与 webpmux 一致
      -i --info [file]                                               统计 duration
      -f --fps [fps] [file] [outFile]                                修改 duration, fps 更好描述
      -l --loop [loop] [file] [outFile]                              修改 loop, 0 为无限循环
      -b --bg-color [bgColor] [file] [outFile]                       修改 webp 背景颜色, A,R,G,B
    
    Examples:
      awebp -d 0 ./test/test.webp                                    // 设置 webp 每帧的 dispose method 为 0
      awebp -q 60 ./test/test.webp                                   // 设置动图 webp 压缩率, 提取帧->转 png->重新拼接 webp
      awebp -e ./test/test.webp frames                               // 提取所有帧出来到 frames 文件夹
      awebp -c frames out.webp +34+0+0+1+b 1 255,255,255,255         // 从 frames 文件夹合成 webp
      awebp -i ./test/test.webp                                      // 统计出 animated webp duration
      awebp -f 60 ./test/test.webp                                   // 修改 animated webp duration (60fps ~= 17)
      awebp -l 3 ./test/test.webp                                    // 修改 webp 的循环次数为 3 次
      awebp -b 0,0,0,0 ./test/test.webp                              // 修改 webp 背景颜色
    

    使用场景

    1. ffmpeg 转换出来的 webp 重叠问题, 需要设置 dispose-method 为 BACKGROUND
    2. animated webp 压缩
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2405 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 16:11 · PVG 00:11 · LAX 09:11 · JFK 12:11
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.