matroskadec_haali: Only accept a "sane" DefaultDuration for FPS.
Alot of files have their DefaultDuration set to an calculated value which is not directly tied to the FPS, and because Matroska actually doesn't specify the DefaultDuration to be tied to the FPS, this is perfectly legal. So, before assuming the DefaultDuration is the FPS, check if the value actually makes sense. The most basic check here is that the FPS is below 125fps, because any more really doesn't make sense. If the FPS from the header is not set, avformat will probe the FPS based on the files timestamps, which will give a much better result.
This commit is contained in:
parent
41670a603d
commit
2ed1607afd
|
@ -453,7 +453,8 @@ static int mkv_read_header(AVFormatContext *s)
|
|||
1 << 30);
|
||||
if (st->codec->codec_id != AV_CODEC_ID_H264)
|
||||
st->need_parsing = AVSTREAM_PARSE_HEADERS;
|
||||
if (info->DefaultDuration) {
|
||||
av_log(s, AV_LOG_DEBUG, "Default Duration: %"PRId64"\n", info->DefaultDuration);
|
||||
if (info->DefaultDuration && info->DefaultDuration > 8000000) {
|
||||
av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den,
|
||||
1000000000, info->DefaultDuration, 100000);
|
||||
st->avg_frame_rate = st->r_frame_rate;
|
||||
|
|
Loading…
Reference in New Issue