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:
authorSebastian Parborg <darkdefende@gmail.com>2021-05-28 19:37:36 +0300
committerSebastian Parborg <darkdefende@gmail.com>2021-05-28 19:37:36 +0300
commit9225fe933ae9904ea7bb646110308a921b37fc86 (patch)
treecfed4d4c8e80cb9f0531baede23f3735c6272c67 /source/blender/blenkernel/intern/writeffmpeg.c
parent33113506701fac51b8b4dc8f51975200f885e50a (diff)
Make encoded video fps correct with ffmpeg < 4.4
Before the FFmpeg commit: github.com/FFmpeg/FFmpeg/commit/1c0885334dda9ee8652e60c586fa2e3674056586 FFmpeg would use deprecated variables to calculate the video fps. We don't use these deprecated variables anymore, so ensure that the duration is correct in ffmpeg versions without this fix. Reviewed By: Sergey, Richard Antalik Differential Revision: http://developer.blender.org/D11417
Diffstat (limited to 'source/blender/blenkernel/intern/writeffmpeg.c')
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 39f65d76e3c..3408f990fd1 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -205,12 +205,11 @@ static int write_audio_frame(FFMpegContext *context)
success = -1;
}
- av_packet_rescale_ts(pkt, c->time_base, context->audio_stream->time_base);
- if (pkt->duration > 0) {
- pkt->duration = av_rescale_q(pkt->duration, c->time_base, context->audio_stream->time_base);
- }
-
pkt->stream_index = context->audio_stream->index;
+ av_packet_rescale_ts(pkt, c->time_base, context->audio_stream->time_base);
+# ifdef FFMPEG_USE_DURATION_WORKAROUND
+ my_guess_pkt_duration(context->outfile, context->audio_stream, pkt);
+# endif
pkt->flags |= AV_PKT_FLAG_KEY;
@@ -349,6 +348,10 @@ static int write_video_frame(FFMpegContext *context, int cfra, AVFrame *frame, R
packet->stream_index = context->video_stream->index;
av_packet_rescale_ts(packet, c->time_base, context->video_stream->time_base);
+# ifdef FFMPEG_USE_DURATION_WORKAROUND
+ my_guess_pkt_duration(context->outfile, context->video_stream, packet);
+# endif
+
if (av_interleaved_write_frame(context->outfile, packet) != 0) {
success = -1;
break;
@@ -1181,6 +1184,9 @@ static void flush_ffmpeg(FFMpegContext *context)
packet->stream_index = context->video_stream->index;
av_packet_rescale_ts(packet, c->time_base, context->video_stream->time_base);
+# ifdef FFMPEG_USE_DURATION_WORKAROUND
+ my_guess_pkt_duration(context->outfile, context->video_stream, packet);
+# endif
int write_ret = av_interleaved_write_frame(context->outfile, packet);
if (write_ret != 0) {