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.

Revisions

  1. RPing revised this gist Dec 25, 2018. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion gif2mp4.sh
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,12 @@
    #!/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 in {1..$2}; do printf "file out.mp4\n" >> list.txt; done
    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
  2. RPing created this gist Dec 25, 2018.
    6 changes: 6 additions & 0 deletions gif2mp4.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    #!/bin/sh

    ffmpeg -f gif -i $1 -pix_fmt yuv420p -vcodec libx264 tmp.mp4
    for i in {1..$2}; do printf "file out.mp4\n" >> list.txt; done
    ffmpeg -f concat -i list.txt -c copy out.mp4
    rm -f list.txt tmp.mp4