[FFmpeg-user] Help please using FFprobe to find duration in minutes (rounded up).

batguano999 batguano999 at zoho.com
Thu Aug 4 11:35:12 EEST 2016

 > A bit. ffprobe is capable of printing only desired fields, check the
 > lovely example in the wiki:
 > https://trac.ffmpeg.org/wiki/FFprobeTips#Formatcontainerduration
 > This command prints the (container) duration in seconds:
 > $ ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 foo.ts

My email's working OK now, seems to allow reply.

I used this...
dur=$(printf "%.0f" $(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 foo.ts))

It returns the integer, it doesn't round UP.
My 914.901333 file returned 914.

This seems OK...
if [ $dur -gt 1799 ]; then ffmpeg -i foo.ts foo.ogg; fi
The file is converted to ogg if it's longer than 29m59s.

More information about the ffmpeg-user mailing list