Last active
December 23, 2017 19:38
-
-
Save erikreed/d696ad04b41b313e66fa2dddad4d6afb to your computer and use it in GitHub Desktop.
Automatically concatenate Xiaomi Mi drone videos with ffmpeg
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 | |
set -e -o pipefail -u | |
queue="" | |
files=() | |
mkdir -p out original | |
for f in *[0-9].MP4; do | |
queue+="file $f\n" | |
files+=($f) | |
if ! ffprobe "$f" 2>&1 | grep 'Duration: 00:05:00'; then | |
echo -e "$queue" > $f-concat.txt | |
ffmpeg -f concat -i $f-concat.txt -c copy out/$f-concat.mp4 | |
rm $f-concat.txt | |
queue='' | |
for i in "${files[@]}"; do | |
mv $i original | |
done | |
files=() | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment