[FFmpeg-devel] [PATCH] WebP native muxer bugfix: frames should have alpha blending off

Urvang Joshi urvang at google.com
Thu May 28 00:10:05 CEST 2015

All the frames that the native muxer gets are fully reconstructed
frames, and they should not be alpha-blended with the previous frames.

As per the WebP container spec
ANMF chunk should specify blending method = do not blend (and disposal
method = do not dispose).

However, the native muxer was wrongly setting blending method = use
alpha blending.
This bug can be reproduced by converting a source with transparency
(e.g. animated GIF with transparency) to an animated WebP, and viewing
it with vwebp.
 libavformat/webpenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/webpenc.c b/libavformat/webpenc.c
index 69270c6..1455cc7 100644
--- a/libavformat/webpenc.c
+++ b/libavformat/webpenc.c
@@ -137,7 +137,7 @@ static int flush(AVFormatContext *s, int trailer, int64_t pts)
                 avio_wl24(s->pb, pts - w->last_pkt.pts);
             } else
                 avio_wl24(s->pb, w->last_pkt.duration);
-            avio_w8(s->pb, 0);
+            avio_w8(s->pb, 2);  // Do not dispose and do not blend.
         avio_write(s->pb, w->last_pkt.data + skip, w->last_pkt.size - skip);

More information about the ffmpeg-devel mailing list