参见英文答案 >
How to extract duration time from ffmpeg output?12个
如何在几秒钟内获得视频时长?
如何在几秒钟内获得视频时长?
我尝试过的:
ffmpeg -i file.flv 2>&1 | grep "Duration" Duration: 00:39:43.08,start: 0.040000,bitrate: 386 kb/s mediainfo file.flv | grep Duration Duration : 39mn 43s
这接近,但它不是那么准确,2383是39.71分钟
ffmpeg -i file.flv 2>&1 | grep "Duration"| cut -d ' ' -f 4 | sed s/,// | sed 's@\..*@@g' | awk '{ split($1,A,":"); split(A[3],B,"."); print 3600*A[1] + 60*A[2] + B[1] }' 2383
解决方法
2383是对的.一分钟有60秒,而不是100. 43/60 = .71
https://www.google.com/#q=39+minutes+43.08+seconds+in+seconds