[FFmpeg-user] How to get video duration in a script using ffmpeg?

Gyan Doshi ffmpeg at gyani.pro
Wed Jan 19 14:56:21 EET 2022



On 2022-01-19 05:29 pm, Bo Berglund wrote:
> On Wed, 19 Jan 2022 17:10:26 +0530, Gyan Doshi <ffmpeg at gyani.pro> wrote:
>
>>> What do I need to just get that output I want?
>> The closest you can get is
>>
>>       ffprobe -v 0 -of compact=p=0:nk=1 -sexagesimal -show_entries
>> format=duration INPUT
> Thanks, this returns the following output:
> 0:43:26.384000
>
> Can the duration be limited to only seconds resolution (no decimals)?
>
>


ffprobe -v 0 -of compact=p=0:nk=1 -sexagesimal -show_entries
format=duration INPUT | grep -oP "^[\d:]+"

Gyan



More information about the ffmpeg-user mailing list