Is there a way to get any media file (.avi, .mp4, .mp3, etc.) length using Mac's Terminal?
I there is a need to install a package or a library can you please specify which, and how to install them?
You can use ffmpeg
or ffprobe
to get the duration. You can install ffmpeg
easily using Homebrew:
brew install ffmpeg
And then you can get the duration using this command:
ffmpeg -i input 2>&1 | grep "Duration"| cut -d ' ' -f 4 | sed s/,//
See the answers here for more details: How to get length of video file from console?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With