Revert "avvidenc: Set timebase in the ffmpeg context to nanoseconds and set framerate"

This reverts commit 50db59449e.

This broke the MPEG-1 video encoder as it requires the framerate to be
used for the timebase.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1734

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3780>
This commit is contained in:
Sebastian Dröge 2023-01-24 15:28:17 +02:00 committed by GStreamer Marge Bot
parent 12bc5b7a62
commit 5372b77987
2 changed files with 10 additions and 7 deletions

View file

@ -2956,13 +2956,14 @@ gst_ffmpeg_videoinfo_to_context (GstVideoInfo * info, AVCodecContext * context)
bpp += GST_VIDEO_INFO_COMP_DEPTH (info, i); bpp += GST_VIDEO_INFO_COMP_DEPTH (info, i);
context->bits_per_coded_sample = bpp; context->bits_per_coded_sample = bpp;
context->time_base.den = 1000000000;
context->time_base.num = 1;
context->ticks_per_frame = 1; context->ticks_per_frame = 1;
if (GST_VIDEO_INFO_FPS_N (info) == 0) {
if (GST_VIDEO_INFO_FPS_N (info) != 0) { GST_DEBUG ("Using 25/1 framerate");
context->framerate.num = GST_VIDEO_INFO_FPS_N (info); context->time_base.den = 25;
context->framerate.den = GST_VIDEO_INFO_FPS_D (info); 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.num = GST_VIDEO_INFO_PAR_N (info);

View file

@ -308,7 +308,9 @@ gst_ffmpegvidenc_set_format (GstVideoEncoder * encoder,
* (1<<16) - 1 . We therefore scale them down. * (1<<16) - 1 . We therefore scale them down.
* Agreed, it will not be the exact framerate... but the difference * Agreed, it will not be the exact framerate... but the difference
* shouldn't be that noticeable */ * shouldn't be that noticeable */
ffmpegenc->context->time_base.num = 1; ffmpegenc->context->time_base.num =
(gint) gst_util_uint64_scale_int (ffmpegenc->context->time_base.num,
65535, ffmpegenc->context->time_base.den);
ffmpegenc->context->time_base.den = 65535; ffmpegenc->context->time_base.den = 65535;
GST_LOG_OBJECT (ffmpegenc, "MPEG4 : scaled down framerate to %d / %d", GST_LOG_OBJECT (ffmpegenc, "MPEG4 : scaled down framerate to %d / %d",
ffmpegenc->context->time_base.den, ffmpegenc->context->time_base.num); ffmpegenc->context->time_base.den, ffmpegenc->context->time_base.num);