Skip to content

Instantly share code, notes, and snippets.

@arirusso
Last active December 22, 2015 13:29
Show Gist options
  • Select an option

  • Save arirusso/6479443 to your computer and use it in GitHub Desktop.

Select an option

Save arirusso/6479443 to your computer and use it in GitHub Desktop.
Create a quicktime movie that combines a looping animated gif with an mp3. The resulting movie will be the same length as the audio file.
#!/bin/sh
#
# Create a quicktime movie that combines a looping animated gif with an mp3. The resulting movie will
# be the same length as the audio file.
#
if [ $(( $# - $OPTIND )) -lt 4 ]; then
echo "Usage: $0 input.gif input.mp3 output.mov [framerate] [resolution]"
exit 1
fi
mkdir /tmp/gifmp3
convert $1 /tmp/gifmp3/frame%05d.png
ffmpeg -i $2 -f image2 -loop 1 -i /tmp/gifmp3/frame%05d.png -r $4 -s $5 -c:v libx264 -crf 18 -tune stillimage -preset medium -shortest $3
rm -rf /tmp/gifmp3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment