Skip to content

Instantly share code, notes, and snippets.

@arirusso
Created January 21, 2014 06:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arirusso/8535316 to your computer and use it in GitHub Desktop.
Save arirusso/8535316 to your computer and use it in GitHub Desktop.
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