From: Jaroslav Kysela Date: Mon, 23 Nov 2015 12:20:12 +0000 (+0100) Subject: transcoding: set 30fps by default when the video decoder cannot determine frame timin... X-Git-Tag: v4.2.1~1486 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7329323902522ea2dc96ea9187c6c155091ad93a;p=thirdparty%2Ftvheadend.git transcoding: set 30fps by default when the video decoder cannot determine frame timing, fixes #3315 --- diff --git a/src/plumbing/transcoding.c b/src/plumbing/transcoding.c index c7bd3e6d9..1956e55ae 100644 --- a/src/plumbing/transcoding.c +++ b/src/plumbing/transcoding.c @@ -1239,6 +1239,15 @@ transcoder_stream_video(transcoder_t *t, transcoder_stream_t *ts, th_pkt_t *pkt) // Encoder uses "time_base" for bitrate calculation, but "time_base" from decoder // will be deprecated in the future, therefore calculate "time_base" from "framerate" if available. octx->ticks_per_frame = ictx->ticks_per_frame; + if (ictx->framerate.num == 0) { + ictx->framerate.num = 30; + ictx->framerate.den = 1; + } + if (ictx->time_base.num == 0) { + ictx->time_base.num = ictx->framerate.den; + ictx->time_base.den = ictx->framerate.num; + } + octx->framerate = ictx->framerate; #if LIBAVCODEC_VERSION_MICRO >= 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(56, 13, 100) // ffmpeg 2.5 octx->time_base = av_inv_q(av_mul_q(ictx->framerate, av_make_q(ictx->ticks_per_frame, 1))); #else