[MPlayer-users] Converting avi files to animated gifs

Dotan Cohen dotancohen at gmail.com
Sat Mar 29 03:31:34 CET 2008


On 29/03/2008, The Wanderer <inverseparadox at comcast.net> wrote:
> 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.

Thanks. Any time I try either the -frames or the -sstep flags, I get
these errors:
mplayer: could not connect to socket
mplayer: No such file or directory

>  > 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?
>

Apparently I need to use sstep before I can do this, as without sstep
I am getting 4 fps from the input file as well as the output.

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


More information about the MPlayer-users mailing list