Created
January 3, 2020 11:56
-
-
Save alfredwesterveld/720eb1069584c0c1c5c2175798df156f to your computer and use it in GitHub Desktop.
timeline to video
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/bash | |
# https://stackoverflow.com/questions/965053/extract-filename-and-extension-in-bash | |
filename=$(basename -- "$1") # $1 is full name | |
extension="${filename##*.}" | |
filename="${filename%.*}" | |
# trace to gif via https://github.com/pmdartus/snapline | |
echo "Converting $1 to $filename.gif ..." | |
snapline $1 -f 30 -o "$filename.gif" | |
# convert gif to mp4 | |
echo "Converting $filename.gif to $filename.mp4 ..." | |
ffmpeg -i "$filename.gif" "$filename.mp4" | |
# Add time in millisecond to video | |
# For mac make sure you have compiled dependencies | |
# https://github.com/homebrew-ffmpeg/homebrew-ffmpeg | |
# $ brew uninstall ffmpeg --force | |
# $ brew tap homebrew-ffmpeg/ffmpeg | |
# $ brew install homebrew-ffmpeg/ffmpeg/ffmpeg | |
echo "Adding timestamp to video in $filename-timestamp.mp4 ..." | |
ffmpeg -i "$filename.mp4" -vf "drawtext = text='%{pts\:hms}'" "$filename-timestamp.mp4" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment