[FFmpeg-devel] [PATCH 2/4] ffmpeg: move AVFrame time base adjustment into a function

Jan Ekström jeebjp at gmail.com
Sun Sep 13 21:07:09 EEST 2020


On Sun, Sep 13, 2020 at 7:14 PM Michael Niedermayer
<michael at niedermayer.cc> wrote:
>
> On Sun, Sep 13, 2020 at 01:26:20PM +0300, Jan Ekström wrote:
> > This will have to be called later for video down the line.
> > ---
> >  fftools/ffmpeg.c | 77 ++++++++++++++++++++++++++++++++----------------
> >  1 file changed, 52 insertions(+), 25 deletions(-)
>
> This affects the output, example:
> ./ffmpeg -i mm-small.mpg -vf idet  -v 50 -bitexact -f null - 2>&1 | grep idet
>

Apparently this was due to the leftover logging I left there. This
also happens with vanilla FFmpeg if you add such logging to
reap_filters.

In other words, just this following diff appears to fix it.
Additionally, I will be moving the debug_ts log line back to
reap_filters for now since we want to know of the AV_NOPTS_VALUE
frames as well.

Jan

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 7e6c0a962b..acaf6bc47a 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -914,12 +914,6 @@ static double
adjust_frame_pts_to_encoder_tb(OutputFile *of, OutputStream *ost,
     int extra_bits = av_clip(29 - av_log2(tb.den), 0, 16);

     tb.den <<= extra_bits;
-    av_log(NULL, AV_LOG_VERBOSE,
-           "%s: frame pts: %"PRId64" start_time: %"PRId64", "
-           "filter_tb: %d/%d, tb: %d/%d\n",
-           __FUNCTION__, frame->pts, start_time,
-           filter_tb.num, filter_tb.den,
-           tb.num, tb.den);

     float_pts =
         av_rescale_q(frame->pts, filter_tb, tb) -
@@ -932,10 +926,6 @@ static double
adjust_frame_pts_to_encoder_tb(OutputFile *of, OutputStream *ost,
         av_rescale_q(frame->pts, filter_tb, enc->time_base) -
         av_rescale_q(start_time, AV_TIME_BASE_Q, enc->time_base);

-    av_log(NULL, AV_LOG_VERBOSE,
-           "%s: post-adjustment PTS: %"PRId64"\n",
-           __FUNCTION__, frame->pts);
-
     if (debug_ts) {
         av_log(NULL, AV_LOG_INFO, "filter -> pts:%s pts_time:%s
exact:%f time_base:%d/%d\n",
                 av_ts2str(frame->pts), av_ts2timestr(frame->pts,
&enc->time_base),


More information about the ffmpeg-devel mailing list