DEV Community

Keis828
Keis828

Posted on

A simple way to get time duration of mp4

You can get mp4 duration using below script

ffprobe -i ${file_name} -show_entries format=duration -print_format json -loglevel quiet

Output is like this

{
    "format": {
        "duration": "15.061333"
    }
}

Please ensure that you already installed ffmpeg

brew install ffmpeg

Oldest comments (0)