1
0
Fork 0

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:
Hendrik Leppkes 2012-07-02 16:17:33 +02:00
parent 31768fdae6
commit 27db6dceb5
Signed by: hendrik
GPG Key ID: 846079A4B0A7C1B5
1 changed files with 2 additions and 1 deletions

View File

@ -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;