Skip to content

Instantly share code, notes, and snippets.

@mplinuxgeek
Created May 21, 2022 07:58
Show Gist options
  • Save mplinuxgeek/19f3bc6dcffb0614c57ebc2e0cc2fc8a to your computer and use it in GitHub Desktop.
Save mplinuxgeek/19f3bc6dcffb0614c57ebc2e0cc2fc8a to your computer and use it in GitHub Desktop.
/usr/bin/video_stats
#!/bin/bash
shopt -s globstar nullglob dotglob
echo "Filename,Duration,Bitrate,Size (GB),Width,Height"
for f in **/*; do
if [ ! -d "$f" ]; then
mediainfo_general=$(mediainfo --Output="General;%Duration/String3%,%OverallBitRate/String%" "$f")
mediainfo_video=$(mediainfo --Output="Video;%Width%,%Height%" "$f")
file_size=$(ls -s --block-size=G "$f" | awk '{print $1}' | sed 's/[^0-9]*//g' )
echo "\"$f\",${mediainfo_general},${file_size},${mediainfo_video}"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment