Skip to content

Instantly share code, notes, and snippets.

@managedkaos
Created January 8, 2026 02:25
Show Gist options
  • Select an option

  • Save managedkaos/72aa5036208c3feb951598ebd0689046 to your computer and use it in GitHub Desktop.

Select an option

Save managedkaos/72aa5036208c3feb951598ebd0689046 to your computer and use it in GitHub Desktop.
A script to extract the length of a video from media files on macOS devices.
#!/bin/bash
find . -type f -name "*.mov" -print0 | while IFS= read -r -d '' f;
do
echo "$(mdls -name kMDItemDurationSeconds -raw "$f" \
| awk '{printf "%02d:%02d:%02d", $1/3600,$1%3600/60,$1%60}') - $f"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment