Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/imbuf/intern/anim_movie.c')
-rw-r--r--source/blender/imbuf/intern/anim_movie.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index d5ff427f204..4ace72d9fa4 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -525,9 +525,14 @@ static int startffmpeg(struct anim *anim)
}
frame_rate = av_get_r_frame_rate_compat(pFormatCtx->streams[videoStream]);
- anim->duration = ceil(pFormatCtx->duration *
- av_q2d(frame_rate) /
- AV_TIME_BASE);
+ if (pFormatCtx->streams[videoStream]->nb_frames != 0) {
+ anim->duration = pFormatCtx->streams[videoStream]->nb_frames;
+ }
+ else {
+ anim->duration = ceil(pFormatCtx->duration *
+ av_q2d(frame_rate) /
+ AV_TIME_BASE);
+ }
frs_num = frame_rate.num;
frs_den = frame_rate.den;