0

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.

reza
  • 101
  • 2

1 Answers1

1

I dont think there is a command that can do what you want directly. You can try installing ffmpeg, and with it you get ffprobe.

If you run:

ffprobe videofile.avi

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.

mulaz
  • 10,682
  • 1
  • 31
  • 37