Skip to content

Instantly share code, notes, and snippets.

@vadimkantorov
Last active May 3, 2022 16:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vadimkantorov/71c54e2750c298c3c58acaf8c610f984 to your computer and use it in GitHub Desktop.
Save vadimkantorov/71c54e2750c298c3c58acaf8c610f984 to your computer and use it in GitHub Desktop.
Bash alias for audio/video file duration
# https://superuser.com/questions/650291/how-to-get-video-duration-in-seconds
# Usage: duration myfile.wav
alias duration="ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1"
# mkdir -p sample; find segments.* -name '*.wav' -type f | while read filename; do echo "$(duration $filename) $filename"; done | grep "^5\." | while read duration_ filename_; do cp $filename_ sample; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment