1

I have a directory full of .MP4 video files. I would like to see a list that has the name of each file and its duration in minutes and seconds. Something like this:

one.mp4    4:34
two.mp4    2:23
three.mp4  8:34
four.mp4   0:43

I have tried many file managers but cannot find one that will show me this information.

Solutions that involve the terminal would be fine.

3

Try this: (inspiration from superuser.com)

for f in *.mp4
do
  echo -n "$f "
  ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 -sexagesimal "$f"
done

However, output will be in the form HH:MM:SS.MILLISECONDS. If you leave out the option -sexagesimal, you will get the duration in seconds.

For the desired outputform HH:MM, you could do something like this:

for f in *.mp4
do
  echo -n "$f "
  dur=`ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "$f"`
  min=`echo "$dur/60" | bc`
  sec=`echo "$dur%60/1" | bc`
  echo "$min:$sec"
done
0

avprobe from the package libav-tools does this.

Sample output avprobe myfile.mp4

avprobe version 10.1-6:10.1-1~bpo70+1, Copyright (c) 2007-2014 the Libav developers
  built on Jun  6 2014 18:25:37 with gcc 4.7 (Debian 4.7.2-5)
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x90f4720] multiple edit list entries, a/v desync might occur, patch welcome
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x90f4720] multiple edit list entries, a/v desync might occur, patch welcome
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Zieleinlauf_2013_1886.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf54.2.100
  Duration: 00:00:14.09, start: 0.021995, bitrate: 4009 kb/s
    Stream #0.0(und): Video: h264 (High), yuv420p, 534x300, 3854 kb/s, 25 fps, 25 tbn, 50 tbc (default)
    Stream #0.1(und): Audio: aac, 22050 Hz, mono, fltp, 127 kb/s (default)
# avprobe output

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy