Skip to content

Instantly share code, notes, and snippets.

@serboox
Created May 19, 2020 18:13
Show Gist options
  • Save serboox/44d6c0b75f1538912b62ab6e74d8b4bf to your computer and use it in GitHub Desktop.
Save serboox/44d6c0b75f1538912b62ab6e74d8b4bf to your computer and use it in GitHub Desktop.
Compress all *.mp4 files in the folder. Using FFmpeg.
#!/usr/bin/env bash
set +x
for file in *.mp4; do
if [[ $file == *'_new'* ]]; then
echo "----Pass file: ${file}----"
continue
fi
filename="${file%.*}"
ffmpeg -n -i "${file}" -vcodec h264 -crf 19 -filter:v fps=fps=15 -acodec aac \
"${filename}_new.mp4"
if [ $? == 0 ]; then
mv "${file}" ~/.local/share/Trash/files/
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment