Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a small animation formatted as a GIF image file which I would like to convert to a video. Is that possible?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Using a Nautilus Script


Overview

You can easily convert GIF files to videos by using the imagemagick suite and avconv. To make the process easier I have written a small Nautilus script that takes your GIF file and the desired framerate as its input and outputs an MP4 file.

Code

#!/bin/bash

# NAME          gif2mp4 0.1
# AUTHOR        Glutanimate (c) 2013 (http://askubuntu.com/users/81372/glutanimate)
# LICENSE       GNU GPL v3 (http://www.gnu.org/licenses/gpl.html)
# DESCRIPTION   Converts GIF files of a specific framerate to MP4 video files.
# DEPENDENCIES  zenity,imagemagick,avconv

TMPDIR=$(mktemp -d)
FPS=$(zenity --width 200 --height 100 --entry --title "gif2mp4" --text="Please enter the frame rate.")
VIDDIR=$(dirname $1)

if [ -z "$FPS" ]
  then
      exit
fi

notify-send -i video-x-generic.png "gif2mp4" "Converting $(basename "$1") ..."

convert "$1" $TMPDIR/frame%02d.png
avconv -r $FPS -i $TMPDIR/frame%02d.png -qscale 4 "$VIDDIR/$(basename "$1" .gif).mp4"

notify-send -i video-x-generic.png "gif2mp4" "$(basename "$1") converted"

rm -rf $TMPDIR

Installation instructions

Please see here for more information on how to install this script: How can I install a Nautilus script?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.