[FFmpeg-devel] WebP muxer: support packet containing animated WebP

Michael Niedermayer michaelni at gmx.at
Fri May 22 01:02:00 CEST 2015


On Thu, May 21, 2015 at 03:08:57PM -0700, Urvang Joshi wrote:
> On Wed, May 20, 2015 at 5:43 PM, Michael Niedermayer <michaelni at gmx.at>
> wrote:
> 
> > On Wed, May 20, 2015 at 11:52:17PM +0000, Urvang Joshi wrote:
> > > On Wed, May 20, 2015 at 12:39 PM Michael Niedermayer <michaelni at gmx.at>
> > > wrote:
> > >
> > > > On Wed, May 20, 2015 at 01:56:17AM +0000, Urvang Joshi wrote:
> > > > > This is 1st out of 3 patches.
> > > > > Attached.
> > > >
> > > > >  webpenc.c |   63
> > > > +++++++++++++++++++++++++++++++++++++++++++++-----------------
> > > > >  1 file changed, 46 insertions(+), 17 deletions(-)
> > > > > ee0eae792572bbcce5b6ce0e982e1347f0241418
> > > > 1.WebP-muxer-support-a-packet-containing-animated-WebP.patch
> > > > > From a47778d6b0514097668881c9d2f5ecbfce5970a3 Mon Sep 17 00:00:00
> > 2001
> > > > > From: Urvang Joshi <urvang at google.com>
> > > > > Date: Tue, 19 May 2015 17:39:54 -0700
> > > > > Subject: [PATCH] WebP muxer: support a packet containing animated
> > WebP.
> > > > >
> > > > > This is the 1st patch in preparation for using WebPAnimEncoder API
> > for
> > > > encoding
> > > > > and muxing WebP images.
> > > >
> > > > this breaks the code
> > > >
> > > >
> > > > ./ffmpeg -i lena.pnm  test.webp
> > > > vwebp test.webp
> > > > "Input file doesn't appear to be WebP format."
> > > >
> > >
> > > Thanks for catching! Here's an updated patch which works for static
> > images
> > > too.
> > >
> > >
> > >
> > >
> > > >
> > > > [...]
> > > >
> > > > --
> > > > Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> > > >
> > > > In a rich man's house there is no place to spit but his face.
> > > > -- Diogenes of Sinope
> > > > _______________________________________________
> > > > ffmpeg-devel mailing list
> > > > ffmpeg-devel at ffmpeg.org
> > > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > > >
> >
> > >  webpenc.c |   69
> > ++++++++++++++++++++++++++++++++++++++++++++++++--------------
> > >  1 file changed, 54 insertions(+), 15 deletions(-)
> > > e288e8a4e46c4837a37b1191a64f709391e634f2
> > 1.WebP-muxer-support-a-packet-containing-animated-WebP.patch
> > > From ebca78a25a96bc172cc4de58f488b912ba20e220 Mon Sep 17 00:00:00 2001
> > > From: Urvang Joshi <urvang at google.com>
> > > Date: Tue, 19 May 2015 17:39:54 -0700
> > > Subject: [PATCH] WebP muxer: support a packet containing animated WebP.
> > >
> > > This is the 1st patch in preparation for using WebPAnimEncoder API for
> > encoding
> > > and muxing WebP images.
> > > ---
> > >  libavformat/webpenc.c | 69
> > ++++++++++++++++++++++++++++++++++++++++-----------
> > >  1 file changed, 54 insertions(+), 15 deletions(-)
> > >
> > > diff --git a/libavformat/webpenc.c b/libavformat/webpenc.c
> > > index ee110de..8a5a5ce 100644
> > > --- a/libavformat/webpenc.c
> > > +++ b/libavformat/webpenc.c
> > > @@ -29,6 +29,8 @@ typedef struct WebpContext{
> > >      int frame_count;
> > >      AVPacket last_pkt;
> > >      int loop;
> > > +    int wrote_webp_header;
> > > +    int using_webp_anim_encoder;
> > >  } WebpContext;
> > >
> > >  static int webp_write_header(AVFormatContext *s)
> > > @@ -46,8 +48,24 @@ static int webp_write_header(AVFormatContext *s)
> > >      }
> > >      avpriv_set_pts_info(st, 24, 1, 1000);
> > >
> > > -    avio_write(s->pb, "RIFF\0\0\0\0WEBP", 12);
> > > +    return 0;
> > > +}
> > > +
> > > +static int is_animated_webp_packet(AVPacket *pkt)
> > > +{
> > > +    if (pkt->size) {
> > > +        int skip = 0;
> > > +        unsigned flags = 0;
> > > +
> > > +        if (AV_RL32(pkt->data) == AV_RL32("RIFF"))
> > > +            skip = 12;
> > > +        if (AV_RL32(pkt->data + skip) == AV_RL32("VP8X")) {
> > > +            flags |= pkt->data[skip + 4 + 4];
> > > +        }
> >
> > the array size should be checked before reading from the array
> >
> 
> Done, and similar checks added in flush() too for good measure.
> 
> 
> 
> 
> >
> > [...]
> >
> > --
> > Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> >
> > The bravest are surely those who have the clearest vision
> > of what is before them, glory and danger alike, and yet
> > notwithstanding go out to meet it. -- Thucydides
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> >

>  webpenc.c |   79 ++++++++++++++++++++++++++++++++++++++++++++++++++------------
>  1 file changed, 64 insertions(+), 15 deletions(-)
> 4f807070e1018cb8240736fe4c747f703f1d921a  1.WebP-muxer-support-a-packet-containing-animated-WebP.patch
> From 600f148158c57783b766fd398928b13217abf476 Mon Sep 17 00:00:00 2001
> From: Urvang Joshi <urvang at google.com>
> Date: Tue, 19 May 2015 17:39:54 -0700
> Subject: [PATCH] WebP muxer: support a packet containing animated WebP.

applied

thanks

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150522/ab8b53a1/attachment.asc>


More information about the ffmpeg-devel mailing list