How to find duration of a video file using mediainfo in seconds or other formats?

后端 未结 3 622
时光说笑
时光说笑 2020-12-28 10:51

How can I find duration of a video file in miliseconds i.e. in integer in deterministic way. I have used ffprobe to get the duration but it doesn\'t give duration for all fi

3条回答
  •  星月不相逢
    2020-12-28 11:23

    Use the following commands:

    i) To get the duration of video stream:

    $ mediainfo --Inform="Video;%Duration%"  [inputfile]
    

    ii) To get the duration of the media file:

    $ mediainfo --Inform="General;%Duration%" [inputfile]
    

    iii) To get the duration of audio stream only:

    $ mediainfo --Inform="Audio;%Duration%" [inputfile]
    

    iv) To get values of more than one parameter:

    $ mediainfo --Inform="Video;%Width%,%Height%,%BitRate%,%FrameRate%" [inputfile]
    

    Output would be something like this:

    1280,720,3000000,30.0
    

提交回复
热议问题