[MPlayer-users] Converting avi files to animated gifs

The Wanderer inverseparadox at comcast.net
Sat Mar 29 00:58:18 CET 2008


Dotan Cohen wrote:

> I need to output a summary of a video as an animated gif. Ideally, I
> would have 8 equally-spaced frames from the video, and play them back
> one at a time, each for 0.25 seconds. So I'd have a 2 second
> animated gif.
> 
> This is what I have so far:
> 
> #!/bin/bash
> mplayer "$@" -vo gif89a:output="$@".gif:fps=1 -vf scale=640:480 
> -endpos 8 -really-quiet
> 
> As you can see, I'm taking eight frames from the first eight seconds
> of video. What can I use to take eight frames from $timeOfVideo/7
> time periods. Note that I'm dividing the time of the video by 7, not
> 8, so that I will have the first and last frames of the video in the
> gif.

I haven't had occasion to do something like this myself, but from what I
remember from these lists some while ago, the canonical answer here is
to use

-frames $DESIRED_TOTAL_FRAMES -sstep $DESIRED_INTERVAL_BETWEEN_FRAMES

or in your case, '-frames 8 -sstep 1' or similar. This is limited by the
precision of seeking in the input, but otherwise sounds like what you're
after. If your input video has one key frame every second, you should be
good to go.

> My second problem is shortening the duration that each frame is
> shown. Currently, each frame is shown for 1 second. How can I reduce
> that to 0.25 seconds?

Have you tried "fps=4" in the '-vo gif89a' suboptions?

-- 
    The Wanderer

    My usual .sig is on vacation while I adjust to my new computer



More information about the MPlayer-users mailing list