Skip to content

Instantly share code, notes, and snippets.

@florianbussmann
Last active May 21, 2023 21:28
Show Gist options
  • Save florianbussmann/1df81d32a59e5b29da105a7543d63e01 to your computer and use it in GitHub Desktop.
Save florianbussmann/1df81d32a59e5b29da105a7543d63e01 to your computer and use it in GitHub Desktop.
Clean videos by duration threshold
find . -type f -name *.mp4 -size -10M -print0 | xargs -d '\n' -0 sh -c '
for file do
echo "$file"
duration=`/volume1/@appstore/ffmpeg/bin/ffprobe -i "$file" -show_entries format=duration -v quiet -of csv="p=0"`
echo $duration
if [ "${duration%.*}" -lt 10 ]; then
echo "Lower than threshold"
rm -v "$file"
fi
done'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment