Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#3760 closed enhancement (fixed)

support for animated webp images

Reported by: triune Owned by:
Priority: wish Component: avformat
Version: git-master Keywords: webp
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Currently, exporting to webp will only render a single frame. Would like to have the capability to transcode videos into webp animations similar to animated gif. The 24bit RGB space in webp should make better quality animated images.

Change History (8)

comment:1 Changed 5 years ago by cehoyos

  • Keywords animated removed

Do you have a sample?

comment:2 Changed 5 years ago by Timothy_Gu

cehoyos: you can make one with https://developers.google.com/speed/webp/docs/gif2webp or similar

comment:3 Changed 5 years ago by triune

$ ffmpeg -i spinner4.mp4 spinner4.webp
ffmpeg version N-64303-g3f42434 Copyright (c) 2000-2014 the FFmpeg developers

built on Jun 29 2014 10:23:15 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration: --enable-libvpx --enable-libopus --enable-gpl --enable-libx264 --extra-libs=-ldl --enable-libmp3lame --enable-x11grab --enable-libwebp
libavutil 52. 90.101 / 52. 90.101
libavcodec 55. 68.100 / 55. 68.100
libavformat 55. 44.100 / 55. 44.100
libavdevice 55. 13.101 / 55. 13.101
libavfilter 4. 9.100 / 4. 9.100
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 19.100 / 0. 19.100
libpostproc 52. 3.100 / 52. 3.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'spinner4.mp4':

Metadata:

major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf54.20.4

Duration: 00:00:02.68, start: 0.000000, bitrate: 5482 kb/s

Stream #0:0(und): Video: mpeg4 (Advanced Simple Profile) (mp4v / 0x7634706D), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 5477 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc (default)
Metadata:

handler_name : VideoHandler?

[image2 @ 0x356ae40] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead.
Output #0, image2, to 'spinner4.webp':

Metadata:

major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf55.44.100
Stream #0:0(und): Video: webp (libwebp), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc (default)
Metadata:

handler_name : VideoHandler?
encoder : Lavc55.68.100 libwebp

Stream mapping:

Stream #0:0 -> #0:0 (mpeg4 (native) -> webp (libwebp))

Press [q] to stop, ? for help
[image2 @ 0x356ae40] Could not get frame filename number 2 from pattern 'spinner4.webp' (either set updatefirst or use a pattern like %03d within the filename pattern)
av_interleaved_write_frame(): Invalid argument
frame= 2 fps=0.0 q=-1.0 Lsize=N/A time=00:00:00.08 bitrate=N/A
video:85kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

comment:4 Changed 5 years ago by Timothy_Gu

It is also reported on Google+ by a user: https://plus.google.com/112767041460502214504/posts/UjTgbCBgL2A

comment:5 Changed 5 years ago by cehoyos

  • Priority changed from normal to wish

comment:6 Changed 5 years ago by triune

Response from Google :

James Zern <jzern@google.com>
to webp-discuss, me

Hi,

On Sunday, July 6, 2014 2:30:08 PM UTC-7, tri...@gmail.com wrote:
It seems that when you convert video to gif and then gif to webp, you lose many of the benefits of the webp format itself since you are downsampling to a 256 color palette initially. What I would like to do is go straight from video to animated webp via ffmpeg. However, this doesn't seem to be possible at the moment. I've opened a ticket on their end : https://trac.ffmpeg.org/ticket/3760 but would like to know if a patch on the libwebp end would enable this feature in ffmpeg or not.

This work would be fully in ffmpeg, libwebp currently only handles single frames. In gif2webp for instance we use libwebp for compression and libwebpmux for the final assembly. A simple video frame encoder could do the same in ffmpeg, apng/gif conversion may be a bit more difficult to get right.

comment:7 Changed 4 years ago by jamal

  • Component changed from undetermined to avformat
  • Resolution set to fixed
  • Status changed from new to closed
  • Version changed from unspecified to git-master

A custom webp muxer has been added in 6d64a14e6deae319e8d21b23072e0a73f8cfd9c1 that can create animated WebP images.

Note: See TracTickets for help on using tickets.