avenc: Choose 25 fps if we don't have any in the caps
authorSebastian Dröge <slomo@circular-chaos.org>
Tue, 1 Oct 2013 20:38:32 +0000 (22:38 +0200)
committerSebastian Dröge <slomo@circular-chaos.org>
Tue, 1 Oct 2013 20:38:32 +0000 (22:38 +0200)
Some encoders require a non-zero framerate to be configured properly
and just choosing something will make them not fail completely at
least.

https://bugzilla.gnome.org/show_bug.cgi?id=708732

ext/libav/gstavcodecmap.c

index 00816ed..dacac4b 100644 (file)
@@ -2511,8 +2511,14 @@ gst_ffmpeg_videoinfo_to_context (GstVideoInfo * info, AVCodecContext * context)
   context->bits_per_coded_sample = bpp;
 
   context->ticks_per_frame = 1;
-  context->time_base.den = GST_VIDEO_INFO_FPS_N (info);
-  context->time_base.num = GST_VIDEO_INFO_FPS_D (info);
+  if (GST_VIDEO_INFO_FPS_N (info) == 0) {
+    GST_DEBUG ("Using 25/1 framerate");
+    context->time_base.den = 25;
+    context->time_base.num = 1;
+  } else {
+    context->time_base.den = GST_VIDEO_INFO_FPS_N (info);
+    context->time_base.num = GST_VIDEO_INFO_FPS_D (info);
+  }
 
   context->sample_aspect_ratio.num = GST_VIDEO_INFO_PAR_N (info);
   context->sample_aspect_ratio.den = GST_VIDEO_INFO_PAR_D (info);