How to get video duration from shell!?
I have a directory with too many videos file.
I want to print duration of total of the file in directory.
Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.
I dont think there is a command that can do what you want directly. You can try installing ffmpeg, and with it you get
If you run:
you get all the data about it (including the duration). Since it's based on ffmpeg, it supports more-or-less all the popular codecs.
With this, you can write a script to parse and sum up all the durations.
ps: for some unknown reason, my version of ffmpeg outputs data to STDERR instead of STDOUT. Dont know if it's a bug or a feature.