-
-
Save anonymous/20993ba3cc001c784731135e0b6e89a8 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env bash | |
## mac install | |
# brew install ffmpeg --with-fontconfig --with-freetype | |
fps=30 | |
scale_w=640 | |
## estimates | |
# 121mb 3min @ 30fps for 30sec | |
# 45mb 1:25min @ 10fps for 30sec | |
youtube-dl -f bestvideo[ext=mp4]+bestaudio[ext=m4a] 'https://www.youtube.com/watch?v=OS-hNRFyFzM' -o "input.mp4" --merge-output-format mp4 | |
## draw text on video | |
# shadowcolor=0x000000EE:shadowx=2:shadowy=2:x=3:y=th, | |
#ffmpeg -y -i input.mp4 -vf drawtext="fontfile=Roboto-Bold.ttf: text='WIKILEAKS': fontcolor=white: fontsize=24: box=1: boxcolor=black@0.5: boxborderw=5: x=(w-text_w)/2: y=(h-text_h)/2" -c:a copy output.mp4 | |
## generate palette | |
ffmpeg -y -i input.mp4 -vf fps=$fps,scale=$scale_w:-1:flags=lanczos,palettegen palette.png | |
# generate gif | |
# https://trac.ffmpeg.org/wiki/FilteringGuide | |
ffmpeg -y -i input.mp4 -i palette.png -filter_complex "fps=$fps,scale=$scale_w:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment