A folder of 10 video files, how to get the total duration of them? BTW, I have tried (Command+Control+I) and it doesn’t show the total duration.


3 Answers 3


You can also open all of the files in VLC. It will play the videos automatically, but press stop in the lower left (the square symbol) and it will show you the playlist. At the top of the playlist it will have the total duration. If you enable the correct columns (right click on a column header and check the appropriate boxes), it will give the name, file size, and duration for the individual files, as well.

Additionally, VLC is an amazingly fully-featured video player that supports every format you will ever encounter, and then plenty more. It is also cross-platform (working on Linux as well as Windows).

  • 1
    This is the easiest way and with VLC compatibility with virtually every known format to man it is no brainer. Additionally with VLC being a universal player for Windows/Mac/Linux this method is also universal! This answer should have been marked as accepted
    – Pierre
    Nov 23, 2016 at 1:56

Seems like the best solution would be to install MPlayer in Mac OS X and then run a command line Bash script such as this one shown here:

find . -type f -name "*.avi" -print0 | xargs -0  mplayer -vo dummy -ao dummy -identify 2>/dev/null | perl -nle '/ID_LENGTH=([0-9\.]+)/ && ($t +=$1) && printf "%02d:%02d:%02d\n",$t/3600,$t/60%60,$t%60' | tail -n 1

As the user “syssyphus” states:

Change the *.avi to whatever you want to match, you can remove it altogether if you want to check all files.

  • Don't you need to pass the path to find? "The find utility recursively descends the directory tree for each path listed," it'll complain about the -t in -type otherwise. See the man page. The BSD find on OS X operates differently than Gnu's find which uses the current working directory if no path is given.
    – user187561
    Mar 5, 2015 at 8:49

Use Python script solved this problem.

# -*- coding: utf-8 -*-


pip install --upgrade setuptools
pip install moviepy

python compute_duration.py --path ~/Movies/ --type .mp4

import os
import datetime
import argparse
from moviepy.editor import VideoFileClip

def main():
    parser = argparse.ArgumentParser(
        description='Compute Total Time of a Series of Videos')
    parser.add_argument("--path", metavar="PATH", default=".",
                        help="the root path of the videos(default: .)")
    parser.add_argument("--type", metavar="TYPE", default=".mkv",
                        help="the type of the videos(default: .mkv)")
    args = parser.parse_args()
    filelist = []
    for a, b, c in os.walk(args.path):
        for name in c:
            fname = os.path.join(a, name)
            if fname.endswith(args.type):
    ftime = 0.0
    for file in sorted(filelist):
        clip = VideoFileClip(file)
        print("{}: {}".format(file, clip.duration))
        ftime += clip.duration
    print("%d seconds: " % ftime, str(datetime.timedelta(seconds=ftime)))

if __name__ == "__main__":

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .