Skip to content

Instantly share code, notes, and snippets.

@dreampiggy
Created March 6, 2017 05:31
Show Gist options
  • Star 30 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save dreampiggy/52c658253de3ba22fd3dec4d3f3182ab to your computer and use it in GitHub Desktop.
Save dreampiggy/52c658253de3ba22fd3dec4d3f3182ab to your computer and use it in GitHub Desktop.
ffmpeg MOV to Animated WebP
ffmpeg -i input.mov -vcodec libwebp -lossless 1 -q:60 -preset default -loop 0 -an -vsync 0 output.webp
@paq85
Copy link

paq85 commented Apr 26, 2018

Thanks.

@arthurRuf
Copy link

arthurRuf commented Dec 4, 2018

Saved my live. Thank you very much

@FlorianHendrickx1
Copy link

Hey,

I have tried your method several times with a gazillion different adaptations to the settings...
Any idea what i'm doing wrong, for some reason, my new frames are rendered over the old ones...

I uploaded an example here: https://drive.google.com/open?id=1ICZ-CJ9Ug_Y4fCsmJjsEd_QHho1qXKoC

Found someone else with this problem, but it didn't get resolved:https://stackoverflow.com/questions/38864497/transparent-animated-webp-not-clearing-frames

Thanks!

@didi789
Copy link

didi789 commented Jun 4, 2019

@TahirHafeez
Copy link

The following command works in my case. You can have lossless or lossy options if you want. I removed -q:60
ffmpeg -i input.mp4 -vcodec libwebp -preset default -loop 0 -an -vsync 0 output.webp

@pchelnikovav
Copy link

@FlorianHendrickx1 I couldn't find an FFMPEG solution for the same task either. So, as a workaround, I decided to render .mov as a png-sequence with alpha channel and then pass it to the img2webp converter (https://developers.google.com/speed/webp/docs/img2webp).
For me it works like a charm.
Hope it helps.

@vijkmr
Copy link

vijkmr commented May 25, 2020

@dreampiggy, How can i set a export video resolution?

example the video i have is 800px height and i need to 480px webp file.

Copy link

ghost commented May 26, 2020

@vijkmr somehow like that I guess:

ffmpeg -i video.mp4 ... -vf scale=320:240 output.webp

@vijkmr
Copy link

vijkmr commented May 26, 2020

Thanks @scpketer, i tried this and it worked

ffmpeg -i input.mov -vcodec libwebp -lossless 1 -q:60 -preset default -loop 0 -an -vsync 0 -s 320:240 output.webp

@setanarut
Copy link

@ht55ght55
Copy link

-q:60 should be -q 60

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment