Reputation: 2179
I want to get the duration of audio/video files that are being uploaded into the system. Earlier I had used hachoir-metadata
, but it's not maintained anymore I guess, as there is no python 3 compatible module for that.
Upvotes: 1
Views: 1214
Reputation: 2179
For anyone looking for this particular thing, follow following steps:
avconv
command. If not present, do sudo apt-get install libav-tools
ffmpeg -i myvideo 2>&1 | grep Duration | cut -d ' ' -f 4 | sed s/,//
(I found this command here).Correct me if I am wrong somewhere
Upvotes: 1
Reputation: 19733
if you know about ffmpeg
, you can use ffmpeg to read the audio or video, it will output the duration of audio or video
$ ffmpeg -i "Gotye - Somebody That I Used To Know (feat. Kimbra) - official video.mp4" 2>&1 | grep -E -o "Duration: \S+"
Duration: 00:04:03.90,
Upvotes: 1