Skip to content

Instantly share code, notes, and snippets.

@RPing
Last active December 25, 2018 10:44
Show Gist options
  • Save RPing/0fd5cf524a1b551b7da23c01d083dc84 to your computer and use it in GitHub Desktop.
Save RPing/0fd5cf524a1b551b7da23c01d083dc84 to your computer and use it in GitHub Desktop.
gif to mp4 and loop it
#!/bin/sh
# sh gif2mp4.sh <gif url/local file> <loop count>
# output file will be out.mp4
ffmpeg -f gif -i $1 -pix_fmt yuv420p -vcodec libx264 tmp.mp4
for (( i = 0; i <= $2; i++ ))
do
printf "file tmp.mp4\n" >> list.txt
done
ffmpeg -f concat -i list.txt -c copy out.mp4
rm -f list.txt tmp.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment