Last active
January 19, 2019 15:26
-
-
Save hoangdh/e11f8226cbf720e0bde7d0a95f17695a to your computer and use it in GitHub Desktop.
Loop videos to 1 minute.
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 | |
mkdir -p output/ | |
ls *.mp4 | while read -r l; | |
do | |
sec=$(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "$l") | |
round_sec=${sec%.*} | |
if [[ $round_sec -lt 60 ]]; then | |
loop=$(expr 60 / $round_sec) | |
round_loop=$(expr ${loop%.*} + 2) | |
# echo $l $round_loop $round_sec | |
echo "ffmpeg -stream_loop ${round_loop} -i "${l}" -c copy output/${round_loop}_${l}" >> run.sh | |
fi | |
done | |
bash run.sh | |
rm -rf run.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment