WebP image format was introduced by Google in 2010 and it’s is based on lossy and lossless intra-frame coding of the VP8.
Google claims WebP images using lossless compressed are 26% smaller in file size compared to PNGs, and files with lossy compression are 25-34% smaller in size compared to JPEG images at equivalent perceived quality.
WebP format is opened by almost all browsers – Firefox, Microsoft Edge, etc.
How to Encode Images in WebP Format?
First of all check that your whether ffmpeg supports WebP image format encoding or not:
ffmpeg -codecs | findstr libwebp
…
DEVILS webp WebP (encoders: libwebp_anim libwebp )
If no then i recommend to take full ffmpeg binaries for Windows
Alternatively you can configure ffmpeg sources with ‘–enable-libwebp’ and compile it.
Note:
- ffmpeg libwebp only supports YUV420 for lossy
- Compression quality is controlled by ‘-compression_level’, the range 0-6, where 0 is best quality (low compression ratio) and 6 is the worst quality (high compression ratio)
- if you know ahead a type of image you can configure corresponding preset (‘-preset’):
‘none’ – don’t use preset
‘default’ – general type of image
‘picture’ – digital picture, like portrait
‘photo’ outdoor photograph, with natural lighting
‘drawing’ hand or line drawing, with high-contrast details
‘icon’ small-sized colorful images
‘text’ – documents
Example:
Encode the first frame (‘ -frames 1’) of yuv-sequence in WebP Image format:
ffmpeg -s 1920×1080 -i crowdrun1080p50fps.yuv -c:v libwebp -frames 1 -compression_level 6 -y test.webp
compression ratio relationship for crowdrun1080p sequence
compression_level | compression ratio |
6 | 9 |
5 | 8.7 |
3,4 | 8.3 |
2,1 | 7.7 |
0 | 7.4 |
Example:
Re-encode png-file in lossless mode to WebP image format:
ffmpeg -i flashes.png -c:v libwebp -lossless 1 -y flashes.webp
compression ratio ~3:1
Example with known picture type (outdoor photo)
ffmpeg -s 1920×1080 -i crowdrun1080p50fps.yuv -c:v libwebp -frames 1 -compression_level 4 -preset photo -y test.webp
How to Encode Sequences in WebP Format?
To encode for example the first 50 frames of input sequence crowdrun1080p50fps.yuv use ‘-c:v libwebp_anim‘
ffmpeg -s 1920×1080 -i crowdrun1080p50fps.yuv -c:v libwebp_anim -frames 50 -compression_level 4 -preset photo -y test50.webp
Notes:
ffplay cant’ play WebP animation format, although most of browsers play
ffmpeg is not configured to provide correct frame rate for WebP animation, it sets 25fps.
23+ years’ programming and theoretical experience in the computer science fields such as video compression, media streaming and artificial intelligence (co-author of several papers and patents).
the author is looking for new job, my resume
Can I simply say what a reduction to seek out somebody who really knows what theyre talking about on the internet. You definitely know methods to convey an issue to light and make it important. Extra individuals need to read this and understand this side of the story. I cant consider youre no more popular since you positively have the gift.
Awsome post and right to the point. I am not sure if this is really the best place to ask but do you guys have any ideea where to get some professional writers? Thx 🙂
I take pleasure in, cause I discovered exactly what I used to be having a look for. You’ve ended my 4 day lengthy hunt! God Bless you man. Have a nice day. Bye
I’m not that much of a online reader to be honest but your sites really nice, keep it up! I’ll go ahead and bookmark your website to come back later. Many thanks
Some genuinely quality content on this internet site, saved to bookmarks.
I have been examinating out some of your posts and i can claim pretty clever stuff. I will make sure to bookmark your website.
I believe this web site holds some real excellent information for everyone. “The foundation of every state is the education of its youth.” by Diogenes.
Your home is valueble for me. Thanks!…
wonderful points altogether, you just gained a brand new reader. What would you suggest about your post that you made some days ago? Any positive?
Loving the information on this site, you have done great job on the articles.
I was looking through some of your blog posts on this site and I think this website is really instructive! Retain putting up.
You have brought up a very superb points, regards for the post.
Yay google is my queen aided me to find this great website ! .
Its like you read my mind! You appear to grasp a lot approximately this, like you wrote the e book in it or something. I think that you can do with some to force the message home a bit, however instead of that, that is fantastic blog. An excellent read. I will certainly be back.
It is perfect time to make a few plans for the future and it is time to be happy. I’ve read this post and if I may I wish to counsel you few interesting issues or suggestions. Perhaps you could write subsequent articles referring to this article. I desire to learn more things approximately it!
This is really interesting, You’re a very skilled blogger. I have joined your rss feed and look forward to seeking more of your wonderful post. Also, I have shared your site in my social networks!
Hi, just required you to know I he added your site to my Google bookmarks due to your layout. But seriously, I believe your internet site has 1 in the freshest theme I??ve came across. It extremely helps make reading your blog significantly easier.
Dear videonerd.website admin, Thanks for the well-presented post!
Dear videonerd.website owner, Thanks for the well written post!
I am not real great with English but I find this rattling leisurely to understand.
Hello videonerd.website administrator, Good to see your posts!