Skip to content

Instantly share code, notes, and snippets.

@jerry73204
Created November 4, 2021 15:38
Show Gist options
  • Save jerry73204/b73b99913e377d2fe7bf67afd67a5dce to your computer and use it in GitHub Desktop.
Save jerry73204/b73b99913e377d2fe7bf67afd67a5dce to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
if [ $# -ne 1 ] ; then
echo "Usage: $0 DIRECTORY"
fi
cd "$1" &&
find . -type f -name '*.avi' -print0 |
while IFS= read -r -d $'\0' file; do
printf "%s\t" "$file"
ffmpeg -i "$file" -map 0:v:0 -c copy -f null -y /dev/null </dev/null 2>&1 | grep -Eo 'frame= *[0-9]+ *' | grep -Eo '[0-9]+' | tail -1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment