mifi / editly

Slick, declarative command line video editing & API
MIT License
4.8k stars 313 forks source link

webm as gif format #36

Open chapmanjacobd opened 4 years ago

chapmanjacobd commented 4 years ago

It might be more useful to generate webp for the gif format. Higher quality and lower size: https://gist.github.com/dreampiggy/52c658253de3ba22fd3dec4d3f3182ab

https://insanelab.com/blog/web-development/webp-web-design-vs-jpeg-gif-png/

I think it is still safe to use the .gif file extension and modern browsers will open it just fine

https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/replace-animated-gifs-with-video

mifi commented 4 years ago

Maybe we could do this if the output file has the extension .webp

chapmanjacobd commented 4 years ago

maybe there is something that we can do to make the gif format more high quality, less dithering etc. https://stackoverflow.com/questions/42980663/ffmpeg-high-quality-animated-gif

the commonFeatures.gif is only 7.7MB but I feel for 60sec of video we could do better if it were not "gif" gif format. I think the quality right now is a good compromise between size and quality but maybe we could have another not-gif but gif-like output format.

ahh I was mistaken. WebP is only for images. What I meant was WebM.

I tried to use webm as the file extension in commonFeatures (after replacing the assets with my own) but I get this error:

~/a/editly (master|✚1…) 🌭 node cli.js examples/commonFeatures.json5
720x1280 30fps
createFrameSource linear-gradient clip 0 layer 0
createFrameSource title clip 0 layer 1
createFrameSource radial-gradient clip 1 layer 0
createFrameSource title clip 1 layer 1
  0% [webm @ 0x55b2b8d052c0] Only VP8 or VP9 or AV1 video and Vorbis or Opus audio and WebVTT subtitles are supported for WebM.
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 -- 

I don't think it's my assets because when I use .mp4 it works fine

mifi commented 4 years ago

Yea, I think there are so many output formats people could want, that if editly is to support more formats, then I think the user should be able to set output arguments themselves: #27

mifi commented 3 years ago

Have now implemented a way to set custom output args which can be used for webp. see example: https://github.com/mifi/editly/blob/master/examples/customOutputArgs.json5