Created
February 24, 2016 11:16
-
-
Save nicnocquee/51a52f1fb99c983d3c38 to your computer and use it in GitHub Desktop.
Get twitter video from url then convert to gif. Usage: ./get_twitter_video_to_gif <url> <filename>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #/bin/sh | |
| curl -s -L -G "$1" > tmp | |
| url=`grep -o 'https:\/\/pbs\.twimg\.com\/tweet_video\/.*\.mp4' tmp` | |
| echo $url | |
| curl -s -G $url > $2.mp4 | |
| palette="palette.png" | |
| filters="fps=10,scale=320:-1:flags=lanczos" | |
| ffmpeg -v warning -i $2.mp4 -vf "$filters,palettegen" -y $palette | |
| ffmpeg -v warning -i $2.mp4 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2.gif | |
| rm -f tmp | |
| rm -f $palette | |
| rm -f $2.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment