Skip to content

Instantly share code, notes, and snippets.

@predictiple
Created September 1, 2015 08:39
Show Gist options
  • Save predictiple/1abae1fc3ee85b88b8b9 to your computer and use it in GitHub Desktop.
Save predictiple/1abae1fc3ee85b88b8b9 to your computer and use it in GitHub Desktop.

####Description

Extracts...

  • filename
  • framerate (average)
  • bitrate (average)
  • duration
  • last modified timestamp

... from a set of video files.

!#/bin/bash
find . -type f -iname "*.avi" -print | while read line; do
duration=$(ffprobe -i $line 2>&1 > /dev/null |grep Duration |cut -d',' -f1 |cut -d' ' -f4)
framerate=$(ffprobe -i $line 2>&1 > /dev/null |grep Stream |cut -d',' -f4 |cut -d' ' -f2)
bitrate=$(ffprobe -i $line 2>&1 > /dev/null |grep Duration |cut -d',' -f3 |cut -d' ' -f3-)
modified=$(stat $line |grep Modify |cut -d' ' -f3 |cut -d'.' -f1)
file=$(echo $line | cut -d'/' -f2)
echo $file,$framerate,$bitrate,$duration,$modified >> times_temp1.csv
done
sort -df -o times_temp2.csv times_temp1.csv
rm times_temp1.csv
echo file,framerate,bitrate,duration,end > original_times.csv
cat times_temp2.csv >> original_times.csv
rm times_temp2.csv
cat times.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment