How to determine webm duration using ffprobe

前端 未结 3 792
[愿得一人]
[愿得一人] 2021-01-11 23:58

My goal is simple , I have several webm files need to be concated, but first I need to determine their durations.

It seems webm file are played as streams, so there

相关标签:
3条回答
  • 2021-01-12 00:30

    Container Duration

    Print total seconds:

    ffprobe -v error -show_entries format=duration \ 
    -of default=noprint_wrappers=1:nokey=1 input.webm  
    

    Result example: 221.333000.
    Adding the -sexagesimal option, the result will show HH::MM::SS time unit format.
    Result example: 0:03:41.333000.

    Reference: https://superuser.com/a/945604/614421

    0 讨论(0)
  • 2021-01-12 00:41

    I ran into your question while trying to solve mine: Re-encoding vlc-created mpeg2 .ts file results in 20 second file

    If you want to find the duration, use something like this:

    ffmpeg -probesize 90M -analyzeduration 90M -i my_mpeg2_file.webm
    

    I chose 90M since my file was just over 70mb, choose the appropriate size according to your file.


    EDIT:

    Not sure why it is not working for others, I have now tested with multiple .webm files, and am having success getting the duration for all of them. If it fails for you, can you please provide a link to the webm file so I can test? In my case, it worked for the following:

    https://thepaciellogroup.github.io/AT-browser-tests/video/ElephantsDream.webm

    http://dl3.webmfiles.org/big-buck-bunny_trailer.webm

    0 讨论(0)
  • 2021-01-12 00:55

    I faced the same issue with some files that does not contain the Duration nor Bitrate on it and found the following solution:

    1- Repackage the files with: (Note that this won't transcode the files, just will copy them)

    ffmpeg -i source.webm -vcodec copy -acodec copy new_source.webm
    

    2- Take the duration from the new copied file:

    ffprobe new_source.webm | grep Duration
    
    0 讨论(0)
提交回复
热议问题