Opened 2 years ago

Closed 19 months ago

Last modified 19 months ago

#7941 closed defect (invalid)

Transparency broken when encoding animated webp

Reported by: Nirel d Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: webp alpha
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

ffmpeg -i test.gif animation.webp

How can I convert animated gif (with Alpha channel) to animated webp?

I stuck with transparent background, I can't figure out how to convert gif with transparent background to webP with transparent background, Its keep a 'trail' of the images,

ffmpeg -i test.gif animation.webp

For example, I want to convert this gif - ​https://imgur.com/tCSn2No to webP,
The output for now is - ​https://media.giphy.com/media/UqevOuKr66xO04zRBa/giphy.gif

how can I achieve that using ffmpeg?

ffmpeg version N-93933-geae251ead9 built with gcc 8.3.1

Attachments (3)

tCSn2No.gif (17.2 KB ) - added by pdr0 19 months ago.
webp_anim_lossless.webp (16.5 KB ) - added by pdr0 19 months ago.
gif2webp.webp (16.4 KB ) - added by pdr0 19 months ago.

Download all attachments as: .zip

Change History (21)

comment:1 by Nirel d, 2 years ago

Still didnt get an answer

Last edited 2 years ago by Nirel d (previous) (diff)

comment:2 by Nirel d, 2 years ago

Owner: set to Nirel d
Status: newopen

...

Last edited 2 years ago by Nirel d (previous) (diff)

comment:3 by Nirel d, 2 years ago

..

Last edited 2 years ago by Nirel d (previous) (diff)

comment:4 by Carl Eugen Hoyos, 2 years ago

Component: ffmpegundetermined
Keywords: gif alpha webp animated removed
Priority: importantnormal
Resolution: needs_more_info
Status: openclosed

To make this a valid bug report, please provide the command line you tested together with the complete, uncut console output.

comment:5 by Nirel d, 2 years ago

Priority: normalimportant
Resolution: needs_more_info
Status: closedreopened
ffmpeg -i test.gif animation.webp

ffmpeg version N-93933-geae251ead9 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8.3.1 (GCC) 20190414
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 28.100 / 56. 28.100
  libavcodec     58. 52.102 / 58. 52.102
  libavformat    58. 27.103 / 58. 27.103
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 54.101 /  7. 54.101
  libswscale      5.  4.101 /  5.  4.101
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Input #0, gif, from 'test.gif':
  Duration: 00:00:02.00, start: 0.000000, bitrate: 70 kb/s
    Stream #0:0: Video: gif, bgra, 150x150, 18.42 fps, 20 tbr, 100 tbn, 100 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (gif (native) -> webp (libwebp))
Press [q] to stop, [?] for help
Output #0, webp, to 'animation.webp':
  Metadata:
    encoder         : Lavf58.27.103
    Stream #0:0: Video: webp (libwebp), bgra, 150x150, q=2-31, 200 kb/s, 20 fps, 1k tbn, 20 tbc
    Metadata:
      encoder         : Lavc58.52.102 libwebp
[libwebp @ 000001aacbb6a9c0] Using libwebp for RGB-to-YUV conversion. You may want to consider passing in YUV instead for lossy encoding.
frame=   37 fps=0.0 q=-0.0 Lsize=      41kB time=00:00:01.80 bitrate= 187.6kbits/s speed=14.4x
video:41kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Last edited 2 years ago by Carl Eugen Hoyos (previous) (diff)

comment:6 by Carl Eugen Hoyos, 2 years ago

Priority: importantnormal

Do you think this is a regression?

comment:7 by Nirel d, 2 years ago

Not sure, as this functionality already exists for Gifs as you can see here(https://trac.ffmpeg.org/ticket/6813), but webp animation frames still overlapping

comment:8 by Nirel d, 2 years ago

Status: reopenedopen

comment:9 by Nirel d, 2 years ago

@cehoyos
Any workaround?

comment:10 by Nirel d, 2 years ago

Owner: changed from Nirel d to Carl Eugen Hoyos

......?

comment:11 by Carl Eugen Hoyos, 2 years ago

Owner: Carl Eugen Hoyos removed

by pdr0, 19 months ago

Attachment: tCSn2No.gif added

by pdr0, 19 months ago

Attachment: webp_anim_lossless.webp added

comment:12 by pdr0, 19 months ago

Resolution: worksforme
Status: openclosed

Works ok for me with this

ffmpeg -i tCSn2No.gif -loop 0 -c:v libwebp_anim -lossless 1 webp_anim_lossless.webp
Last edited 19 months ago by pdr0 (previous) (diff)

comment:13 by Carl Eugen Hoyos, 19 months ago

Keywords: webp alpha added

If there ever was an issue, it is still reproducible (depends on the playback application), using the default encoder or libwebp_anim makes no difference.

comment:14 by Carl Eugen Hoyos, 19 months ago

Resolution: worksforme
Status: closedreopened

in reply to:  13 comment:15 by pdr0, 19 months ago

Replying to cehoyos:

If there ever was an issue, it is still reproducible (depends on the playback application), using the default encoder or libwebp_anim makes no difference.

This ticket deals with encoding animated webp with transparency

What application are you using to test playback ?

This plays back in firefox, chrome properly for me

If some specific playback application does not work, is that an ffmpeg problem?

comment:16 by pdr0, 19 months ago

Resolution: worksforme
Status: reopenedclosed

Attached is the animated webp produced from gif2webp, from the official google libwebp. It plays the same way in Chrome, Firefox, there is no "trail" of images

If you examine both webp's with the official vwebp viewer , both playback the same way there too. You can hit "d" to toggle the disposal method.

I fail to see how this is a ffmpeg issue

by pdr0, 19 months ago

Attachment: gif2webp.webp added

comment:17 by Carl Eugen Hoyos, 19 months ago

Resolution: worksformeinvalid

So you are saying the format is broken?

in reply to:  17 comment:18 by pdr0, 19 months ago

Replying to cehoyos:

So you are saying the format is broken?

What player are you using? Perhaps that is broken

Eitherway it's not a ffmpeg issue

Note: See TracTickets for help on using tickets.