Browse Source

obs-ffmpeg/ffmpeg-mux: Set codec->time_base if avformat < 59

Maya Venkatraman 5 years ago
parent
commit
04596ec097
1 changed files with 4 additions and 0 deletions
  1. 4 0
      plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.c

+ 4 - 0
plugins/obs-ffmpeg/ffmpeg-mux/ffmpeg-mux.c

@@ -387,6 +387,10 @@ static void create_video_stream(struct ffmpeg_mux *ffm)
 		(AVRational){ffm->params.fps_den, ffm->params.fps_num};
 
 	ffm->video_stream->time_base = context->time_base;
+#if LIBAVFORMAT_VERSION_MAJOR < 59
+	// codec->time_base may still be used if LIBAVFORMAT_VERSION_MAJOR < 59
+	ffm->video_stream->codec->time_base = context->time_base;
+#endif
 	ffm->video_stream->avg_frame_rate = av_inv_q(context->time_base);
 
 	if (ffm->output->oformat->flags & AVFMT_GLOBALHEADER)