Skip to content

Instantly share code, notes, and snippets.

@arirusso arirusso/duration.sh
Created Jan 21, 2014

Embed
What would you like to do?
One-liner to get the total duration for .mov video files in the current directory
#!/bin/sh
#
# Get the total duration for .mov video files in the current directory
#
find *.mov -print0 | xargs -0 /Applications/MPlayer\ OSX\ Extended.app/Contents/Resources/Binaries/mpextended.mpBinaries/Contents/mpextended.mpBinaries/Contents/MacOS/mplayer -vo dummy -ao dummy -identify 2>/dev/null | perl -nle '/ID_LENGTH=([0-9\.]+)/ && ($t +=$1) && printf "%02d:%02d:%02d\n",$t/3600,$t/60%60,$t%60' | tail -n 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.