From 370a2d6917ebd8df5177fe4854a447e3839dddaa Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 26 Feb 2018 16:39:18 +0100 Subject: Fix T53857: Incorrect framerate for videos imported from OBS This is an issue with which value to trust: fps vs. tbr. They both cam be somewhat broken. Currently the idea is: - If file was saved with FFmpeg AND we are decoding with FFmpeg we trust tbr. - If we are decoding with Libav we use fps (there does not seem to be tbr in Libav, unless i'm missing something). - All other cases we use fps. Seems to work all good for files from T53857, T54148 and T51153. Ideally we would need to collect some amount of regression files to make further tweaks more scientific. Reviewers: mont29 Reviewed By: mont29 Differential Revision: https://developer.blender.org/D3083 --- source/blender/imbuf/intern/anim_movie.c | 4 ++-- source/blender/imbuf/intern/indexer.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/imbuf') diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 5472cae3ef2..a770b34ecc6 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -511,7 +511,7 @@ static int startffmpeg(struct anim *anim) return -1; } - frame_rate = av_get_r_frame_rate_compat(pFormatCtx->streams[videoStream]); + frame_rate = av_get_r_frame_rate_compat(pFormatCtx, pFormatCtx->streams[videoStream]); if (pFormatCtx->streams[videoStream]->nb_frames != 0) { anim->duration = pFormatCtx->streams[videoStream]->nb_frames; } @@ -989,7 +989,7 @@ static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position, v_st = anim->pFormatCtx->streams[anim->videoStream]; - frame_rate = av_q2d(av_get_r_frame_rate_compat(v_st)); + frame_rate = av_q2d(av_get_r_frame_rate_compat(anim->pFormatCtx, v_st)); st_time = anim->pFormatCtx->start_time; pts_time_base = av_q2d(v_st->time_base); diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 009258079ee..eaf4dfd84b4 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -909,7 +909,7 @@ static int index_rebuild_ffmpeg(FFmpegIndexBuilderContext *context, stream_size = avio_size(context->iFormatCtx->pb); - context->frame_rate = av_q2d(av_get_r_frame_rate_compat(context->iStream)); + context->frame_rate = av_q2d(av_get_r_frame_rate_compat(context->iFormatCtx, context->iStream)); context->pts_time_base = av_q2d(context->iStream->time_base); while (av_read_frame(context->iFormatCtx, &next_packet) >= 0) { -- cgit v1.2.3 From 50dde3d01ac5076cf42a0523d9eab4aac917a990 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 10 Mar 2018 04:33:14 +0100 Subject: Fix T54269: saved EXR file files unreadable some editors in Blender. Don't write the multichannel metadata when there is only a single layer, and don't unnecessarily consider single layer images with Blender metadata as multi layer. --- source/blender/imbuf/intern/openexr/openexr_api.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source/blender/imbuf') diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 4cb1c13a44a..4e85d70d382 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -1621,14 +1621,13 @@ static bool exr_has_alpha(MultiPartInputFile& file) static bool imb_exr_is_multilayer_file(MultiPartInputFile& file) { - const StringAttribute *comments = file.header(0).findTypedAttribute("BlenderMultiChannel"); const ChannelList& channels = file.header(0).channels(); std::set layerNames; /* will not include empty layer names */ channels.layers(layerNames); - if (comments || layerNames.size() > 1) + if (layerNames.size() > 1) return true; if (layerNames.size()) { @@ -1667,7 +1666,7 @@ static void imb_exr_type_by_channels(ChannelList& channels, StringVector& views, } else { *r_singlelayer = false; - *r_multilayer = true; + *r_multilayer = (layerNames.size() > 1); *r_multiview = false; return; } -- cgit v1.2.3