Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alfredwesterveld/720eb1069584c0c1c5c2175798df156f to your computer and use it in GitHub Desktop.
Save alfredwesterveld/720eb1069584c0c1c5c2175798df156f to your computer and use it in GitHub Desktop.
timeline to video
#!/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