Last active
January 1, 2020 17:15
-
-
Save mageddo/9ecb847bffccfd69992c0eab9935151c to your computer and use it in GitHub Desktop.
Convert multiple videos inside dir
This file contains 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
set -e | |
export AV_LOG_FORCE_NOCOLOR=1 &&\ | |
FILES_TO_CONVERT="$(ls *.mp3)" &&\ | |
TOTAL=$(echo "$FILES_TO_CONVERT" | wc -l) &&\ | |
I=0 &&\ | |
OUT_DIR=converted && mkdir -p ${OUT_DIR} &&\ | |
(IFS=' | |
' | |
for IN in $FILES_TO_CONVERT; do | |
I=$((I + 1)) &&\ | |
OUT="${OUT_DIR}/${IN%.*}-30-fps.mp4" &&\ | |
SIZE=$(ls -lha "$IN" | awk '{ print $5}') &&\ | |
DURATION=$(ffmpeg -i "$IN" 2>&1 | grep -oP 'Duration: \K(\d+:\d+:\d+)') &&\ | |
echo -e "\n\e[96m> converting ${IN} size=$SIZE, duration=$DURATION\e[96m (\e[92m${I}\e[96m of \e[92m${TOTAL}\e[96m)\e[39m" &&\ | |
ffmpeg -v warning -hide_banner -stats -loop 1 -i IMG-20191220-WA0005.jpg -i "$IN" -c:v libx264 \ | |
-tune stillimage -c:a aac -b:a 192k -pix_fmt yuv420p \ | |
-shortest "$OUT" | |
# ffmpeg -v warning -hide_banner -stats -i "${IN}" -crf 28 -vcodec libx264 -acodec aac -strict -2 "${OUT}" | |
done) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment