FFmpeg: Fix off by one error in number of detected frames in matroska container

Seems to be rounding error. Hopefully new code handles the error fixed back in
SVN revision 28901 and still have proper frame number for Hjalti.

What could possibly go wrong here..
This commit is contained in:
Sergey Sharybin 2016-10-12 16:17:43 +02:00
parent 22cdf44101
commit a54242503e
1 changed files with 3 additions and 3 deletions

View File

@ -522,9 +522,9 @@ static int startffmpeg(struct anim *anim)
anim->duration = pFormatCtx->streams[videoStream]->nb_frames;
}
else {
anim->duration = ceil(pFormatCtx->duration *
av_q2d(frame_rate) /
AV_TIME_BASE);
anim->duration = (int)(pFormatCtx->duration *
av_q2d(frame_rate) /
AV_TIME_BASE + 0.5f);
}
frs_num = frame_rate.num;