Skip to main content

Get the duration of a video file with mediainfo

  • Tagged with video
  • Posted

Use mediainfo --Inform='Video;%Duration%' [VIDEO_FILE].

Here’s an example:

$ mediainfo --Inform='Video;%Duration%' speech.mp4
5658174

This returns the length of the video in milliseconds: 5,658,174 milliseconds is 5,658 seconds, or 1h 34m 18s.