Skip to content

Instantly share code, notes, and snippets.

@jakubfiala
Created July 25, 2018 06:56
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 jakubfiala/e7a140998a17838c4775a9f7b1b6f255 to your computer and use it in GitHub Desktop.
Save jakubfiala/e7a140998a17838c4775a9f7b1b6f255 to your computer and use it in GitHub Desktop.
A script to loop an mp4 video similarly to Instagram's boomerang
#!/usr/bin/env bash
set -o errexit
set -o nounset
if [[ "$#" -ne 2 ]]; then
echo "Usage: ./boomerang.sh src_file out_file"
fi
SRC=$1
OUT=$2
REV_SRC="${SRC/.mp4/.rev.mp4}"
LIST="part_list.txt"
touch $LIST
ffmpeg -i $SRC -vf reverse $REV_SRC
echo "file '$SRC'" >> $LIST
echo "file '$REV_SRC'" >> $LIST
ffmpeg -f concat -safe 0 -i $LIST -c copy $OUT
rm $REV_SRC $LIST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment