简体   繁体   English

ffmpeg的视频文件的持续时间是否准确?

[英]Is the duration accurate for a video file by ffmpeg?

I have an original video file "inputVideoFile.mp4" 我有一个原始视频文件“ inputVideoFile.mp4”

I use ffmpeg to decode the input video file, process each frame, and then encode those frames to "outputVideoFile.mp4". 我使用ffmpeg解码输入的视频文件,处理每个帧,然后将这些帧编码为“ outputVideoFile.mp4”。

I do not get the delayed frames, which means the output video file should have less frames than the input video file. 我没有得到延迟的帧,这意味着输出视频文件的帧数应少于输入视频文件的帧数。

However, when I use ffprob to see how many frames are in the two files, it shows their duration values are the same: 但是,当我使用ffprob查看两个文件中有多少帧时,它表明它们的持续时间值是相同的:

$ffprobe inputVideoFile.mp4 $ ffprobe inputVideoFile.mp4

Duration: 00:00:04.08, start: 0.000000, birate: 7835 kb/s 持续时间:00:00:04.08,开始:0.000000,速率:7835 kb / s

$ffprobe outputVideoFile.mp4 $ ffprobe outputVideoFile.mp4

Duration: 00:00:04.08, start: 0.000000, bitrate: 21055 kb/s 持续时间:00:00:04.08,开始:0.000000,比特率:21055 kb / s

Why is it the case? 为什么会这样呢? And BTW, what units for the one after second, in 00:00:04.08? 顺便说一句,在00:00:04.08中,每秒的单位是多少? in ".08", is the unit 1/60 sec, or 1/100 sec? 在“ .08”中,单位是1/60秒还是1/100秒?

Thanks! 谢谢!

I find the answer: 我找到答案:

av_guess_frame_rate(a_AVFormatContext, a_AVStream, NULL) av_guess_frame_rate(a_AVFormatContext,a_AVStream,NULL)

It works! 有用!

No, it is not accurate. 不,这是不准确的。 It is a guess based on average bitrate and filesize. 这是基于平均比特率和文件大小的猜测。 Obviously, filesize is always accurate, but in some cases average bitrate is not properly recorded. 显然,文件大小始终是准确的,但是在某些情况下,平均比特率未正确记录。 I don't know, however, if this is a fundamental problem of the file format or a problem caused by the system/program that created the video file. 但是,我不知道这是文件格式的根本问题还是由创建视频文件的系统/程序引起的问题。 For example, with Mythtv recordings, with the NuppelVideo formatted recordings, FFMPEG estimate would be off by 2-3x, that is, it estimates 1 hr recordings to be 2 or 3 hrs long. 例如,对于Mythtv录音和NuppelVideo格式的录音,FFMPEG估计将减少2-3倍,即,将1个小时的记录估计为2或3个小时长。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM