change animation delay using webpmux

110 views
Skip to first unread message

Greg Miernicki

unread,
Oct 18, 2016, 10:19:27 AM10/18/16
to WebP Discussion
I've read the manpage about this tool (webpmux), but still can't figure out how to format a simple command to change merely the frame delay globally on an animated webp image.

I have a webp image with 60 frames... and I would like to make the delay 25ms between each and every frame.

Is there a simple way to do this with webpmux or any other tool?

//G


James Zern

unread,
Oct 19, 2016, 12:12:15 AM10/19/16
to WebP Discussion
Hi,
It might be possible with webpmux, but not at all straightforward when working with an existing animated webp. You'd need to extract all the frames with -get, and using the offsets & dispose methods from -info, remux them with 'frame0 +25+x+y+d frame1 +25+x+y+d ...'. Newer versions of imagemagick have webp support, but I don't believe animation will work. ffmpeg can create webp animation files (when built with libwebp support), but I don't think a copy would work.

Greg Miernicki

unread,
Oct 20, 2016, 10:00:58 AM10/20/16
to WebP Discussion
That makes sense, however, I am not sure I completely understand the command line syntax of webpmux to accomplish that which you speak of. Let's pretend that I had a 3 frame animated webp file. Could you suggest the entire command line syntax I would use to use to alter the frame delay to 25ms?

Saurabh Khanduja

unread,
Oct 20, 2016, 10:07:57 AM10/20/16
to webp-d...@webmproject.org

--
You received this message because you are subscribed to the Google Groups "WebP Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webp-discuss+unsubscribe@webmproject.org.
To post to this group, send email to webp-d...@webmproject.org.
Visit this group at https://groups.google.com/a/webmproject.org/group/webp-discuss/.
For more options, visit https://groups.google.com/a/webmproject.org/d/optout.



--
Thanks & Regards,
Saurabh Khanduja

Greg Miernicki

unread,
Oct 20, 2016, 10:16:23 AM10/20/16
to webp-d...@webmproject.org
Thanks, but I already did a SO search of webpmux and that's why I decided to ask on this list ;)

The main things I don't know are... can I pipe the output of one webpmux command (get) to another (set) to perform the entire operation in a single command? Also, is there any wildcard syntax that will target all frames instead of specifying each and every one of them individually?

I thought this list would have some webpmux experts on it that would be willing to spend 60s writing a command that I could use to satisfy the example/test case I noted earlier that I can expand upon for my other purposes.

On Thu, Oct 20, 2016 at 9:07 AM Saurabh Khanduja <sau...@roposo.com> wrote:

On 20 October 2016 at 19:30, Greg Miernicki <tri...@gmail.com> wrote:
That makes sense, however, I am not sure I completely understand the command line syntax of webpmux to accomplish that which you speak of. Let's pretend that I had a 3 frame animated webp file. Could you suggest the entire command line syntax I would use to use to alter the frame delay to 25ms?


On Tuesday, October 18, 2016 at 11:12:15 PM UTC-5, James Zern wrote:
Hi,

On Tuesday, October 18, 2016 at 7:19:27 AM UTC-7, Greg Miernicki wrote:
I've read the manpage about this tool (webpmux), but still can't figure out how to format a simple command to change merely the frame delay globally on an animated webp image.

I have a webp image with 60 frames... and I would like to make the delay 25ms between each and every frame.

Is there a simple way to do this with webpmux or any other tool?

It might be possible with webpmux, but not at all straightforward when working with an existing animated webp. You'd need to extract all the frames with -get, and using the offsets & dispose methods from -info, remux them with 'frame0 +25+x+y+d frame1 +25+x+y+d ...'. Newer versions of imagemagick have webp support, but I don't believe animation will work. ffmpeg can create webp animation files (when built with libwebp support), but I don't think a copy would work.

--
You received this message because you are subscribed to the Google Groups "WebP Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webp-discuss...@webmproject.org.



--
Thanks & Regards,
Saurabh Khanduja

--
You received this message because you are subscribed to a topic in the Google Groups "WebP Discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/a/webmproject.org/d/topic/webp-discuss/brrvBIo4u5A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to webp-discuss...@webmproject.org.

James Zern

unread,
Oct 21, 2016, 3:03:49 AM10/21/16
to WebP Discussion
Hi,


On Thursday, October 20, 2016 at 7:00:58 AM UTC-7, Greg Miernicki wrote:
That makes sense, however, I am not sure I completely understand the command line syntax of webpmux to accomplish that which you speak of. Let's pretend that I had a 3 frame animated webp file. Could you suggest the entire command line syntax I would use to use to alter the frame delay to 25ms?

I didn't give the actual syntax much thought either to be honest. Pardon my sh/awk/perl:

$ mkdir frames
# dump the frames from an existing file
# ...
# No.: width height alpha x_offset y_offset duration   dispose blend image_size  compression
# ...
#   2:   357   226    no       32       20      100       none   yes      18012    lossless
# ...
$ webpmux -info input.webp \
  | awk '/^\s*[0-9]/ {print $1}' |tr -d ':'  \
  | xargs -I{} ./examples/webpmux  -get frame {} input.webp -o frames/frame{}.webp
# remux with a new duration; Note: this ignores the existing background color
$ webpmux $(webpmux -info input.webp \
  | perl -an \
    -e '/^\s*(\d+)/ and print "-frame frames/frame$1.webp +25+$F[4]+$F[5]+".($F[7] eq "none" ? 0 : 1).($F[8] eq "yes" ? "+b" : "-b")."\n";') \
  -o new.webp
 
Given how cumbersome that is we should probably consider a -remux that operates on -info style input.

Greg Miernicki

unread,
Oct 25, 2016, 12:50:20 PM10/25/16
to WebP Discussion
Thank you for the suggested code. I agree with what you said in how cumbersome the minor task I am trying to accomplish here seems to be with the current form of webpmux. If I am working on an image with 120 frames, I don't even want to think of what the command would look like. 

Please consider how a very similar trivial task is easily accomplished when operating on a GIF image file using gifsicle (it sets the delays of frames 0 and 1 to 50, and frames 2 and 3 to 100) :

gifsicle -b a.gif -d50 "#0" "#1" -d100 "#2" "#3"


Gifsicle man page:

//G

Pascal Massimino

unread,
Nov 8, 2016, 1:18:01 AM11/8/16
to WebP Discussion
Hi,

On Tue, Oct 25, 2016 at 9:50 AM, Greg Miernicki <tri...@gmail.com> wrote:
Thank you for the suggested code. I agree with what you said in how cumbersome the minor task I am trying to accomplish here seems to be with the current form of webpmux. If I am working on an image with 120 frames, I don't even want to think of what the command would look like. 

Please consider how a very similar trivial task is easily accomplished when operating on a GIF image file using gifsicle (it sets the delays of frames 0 and 1 to 50, and frames 2 and 3 to 100) :

gifsicle -b a.gif -d50 "#0" "#1" -d100 "#2" "#3"
Thanks for the suggestion. I have a stub patch here [1]. It sets a constant duration for all frames.
To get a finer control over the durations, i was thinking of the options:

 webpmux -set duration 100,1,6 -set duration 150,10,40 ... in.webp -o out.webp

to set duration of frames [1..6] to '100', frames [10..40] to '150', etc.
(with some reasonable default for start/end).

Seems like this syntax would cover most use-cases, but suggestions are welcome!

skal/

 

--
You received this message because you are subscribed to the Google Groups "WebP Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to webp-discuss+unsubscribe@webmproject.org.

Pascal Massimino

unread,
Nov 9, 2016, 2:39:16 PM11/9/16
to WebP Discussion
Hi,

On Tue, Nov 8, 2016 at 7:17 AM, Pascal Massimino <pascal.m...@gmail.com> wrote:
Hi,

On Tue, Oct 25, 2016 at 9:50 AM, Greg Miernicki <tri...@gmail.com> wrote:
Thank you for the suggested code. I agree with what you said in how cumbersome the minor task I am trying to accomplish here seems to be with the current form of webpmux. If I am working on an image with 120 frames, I don't even want to think of what the command would look like. 

Please consider how a very similar trivial task is easily accomplished when operating on a GIF image file using gifsicle (it sets the delays of frames 0 and 1 to 50, and frames 2 and 3 to 100) :

gifsicle -b a.gif -d50 "#0" "#1" -d100 "#2" "#3"
Thanks for the suggestion. I have a stub patch here [1]. It sets a constant duration for all frames.
To get a finer control over the durations, i was thinking of the options:

 webpmux -set duration 100,1,6 -set duration 150,10,40 ... in.webp -o out.webp

to set duration of frames [1..6] to '100', frames [10..40] to '150', etc.
(with some reasonable default for start/end).

Seems like this syntax would cover most use-cases, but suggestions are welcome!

The patch [1] has been merged. Note that the syntax changed a bit (the '-set' we needlessly redundant).
It's now just '-duration duration[,start[,end]'. For instance the example above would be now:

 webpmux -duration 50,1,2 -duration 100,3,4 in.webp -o out.webp

Note! In webpmux, frames are indexed starting from '1', not '0'.

In fact, for the 'end' parameter the value '0' has the special meaning 'last-frame'.
Hence, to change the whole animation's duration to -say- 50, you would use 'webpmux -duration 50,1,0 ...'.
Or just 'webpmux -duration 50 ...' actually, considering the default values for start/end.

Thanks for raising awareness to the missing feature!

Greg Miernicki

unread,
Nov 9, 2016, 3:38:27 PM11/9/16
to WebP Discussion
I've been following along and can't wait to see this powerful new feature reach a stable libwebpmux near me! Thank you!
Hi,

To unsubscribe from this group and stop receiving emails from it, send an email to webp-discuss...@webmproject.org.
Reply all
Reply to author
Forward
0 new messages