From 9becd72b604c6b7ff5568121d19943ea2ea6c481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 1 Oct 2013 22:38:32 +0200 Subject: [PATCH] avenc: Choose 25 fps if we don't have any in the caps 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 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ext/libav/gstavcodecmap.c b/ext/libav/gstavcodecmap.c index 00816edb0e..dacac4bb5a 100644 --- a/ext/libav/gstavcodecmap.c +++ b/ext/libav/gstavcodecmap.c @@ -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);