Skip to content

Instantly share code, notes, and snippets.

@hr3lxphr6j
Created July 17, 2019 03:48
Show Gist options
  • Save hr3lxphr6j/827060b7f0ceedad829da11694dcbccc to your computer and use it in GitHub Desktop.
Save hr3lxphr6j/827060b7f0ceedad829da11694dcbccc to your computer and use it in GitHub Desktop.
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
_main() {
path=$1
for file in $(find $path -name '*.flv' -cmin +1); do
if [[ $(wc -c "${file}" | awk '{print $1}') -lt $(expr 10 '*' 1024 '*' 1024) ]]; then
echo "INFO: video file less than 10mb, del it (${file})" && rm -rf "${file}"
continue
fi
ffmpeg -hide_banner -i "${file}" -c copy "${file/%.flv/.mp4}" && rm -rf "${file}"
done
}
main() {
oldifs=$IFS
IFS=$'\n'
_main ${1:-$(pwd)}
IFS=$oldifs
}
main $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment