I currently have a bash script to sort downloaded video files into separate sub dirs for TV shows and films.
There is a lot more to the script, however the main sort function for detecting short videos simply from file size is below:
Code:
find /home/Download/ -type f \( -iname \*.mkv -o -iname \*.avi -o -iname \*.wmv -o -iname \*.mp4 -o -iname \*.m4v \) -size -8000M -exec mv {} -f /home/Videos/Shortform/ \;
Of course it's easy for this form of sort to get it wrong, especialy if sorting files that are not 1080P.
I've recently found the following bit of code:
Code:
ffprobe -v quiet -of csv=p=0 -show_entries format=duration *
This returns the length of video files in seconds. Therefore it's a much better way of detecting TV shows from films, ie anything below 4,200 seconds (70mins) is a TV show, anything above is a film. Again not fool proof but better than doing it via file size.
What I'm attempting to work out is the syntax for how to initiate a mv command for any file that ffprobe returns a length in seconds under 4,200.
Many thanks for any help.
Tim