Last active
May 3, 2022 16:40
-
-
Save vadimkantorov/71c54e2750c298c3c58acaf8c610f984 to your computer and use it in GitHub Desktop.
Bash alias for audio/video file duration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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