[FFmpeg-cvslog] avfilter/f_ebur128: set output frame duration
Paul B Mahol
git at videolan.org
Tue May 30 15:02:53 EEST 2023
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue May 30 10:44:02 2023 +0200| [81f658b99d7bf3979cb0e89e2017ebbde887c960] | committer: Paul B Mahol
avfilter/f_ebur128: set output frame duration
Also produce output video timestamps that are consistent with
10 frames per second.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=81f658b99d7bf3979cb0e89e2017ebbde887c960
---
libavfilter/f_ebur128.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libavfilter/f_ebur128.c b/libavfilter/f_ebur128.c
index dfa62f0a36..49f68c0e84 100644
--- a/libavfilter/f_ebur128.c
+++ b/libavfilter/f_ebur128.c
@@ -295,7 +295,6 @@ static int config_video_output(AVFilterLink *outlink)
int i, x, y;
uint8_t *p;
AVFilterContext *ctx = outlink->src;
- AVFilterLink *inlink = ctx->inputs[0];
EBUR128Context *ebur128 = ctx->priv;
AVFrame *outpicref;
@@ -308,8 +307,8 @@ static int config_video_output(AVFilterLink *outlink)
outlink->w = ebur128->w;
outlink->h = ebur128->h;
outlink->sample_aspect_ratio = (AVRational){1,1};
- outlink->time_base = inlink->time_base;
outlink->frame_rate = av_make_q(10, 1);
+ outlink->time_base = av_inv_q(outlink->frame_rate);
#define PAD 8
@@ -430,7 +429,7 @@ static int config_audio_input(AVFilterLink *inlink)
* can be more complex to integrate in the one-sample loop of
* filter_frame()). */
if (ebur128->metadata || (ebur128->peak_mode & PEAK_MODE_TRUE_PEAKS))
- ebur128->nb_samples = inlink->sample_rate / 10;
+ ebur128->nb_samples = FFMAX(inlink->sample_rate / 10, 1);
return 0;
}
@@ -735,7 +734,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
AVFilterLink *outlink = ctx->outputs[0];
const int64_t pts = insamples->pts +
av_rescale_q(idx_insample, (AVRational){ 1, inlink->sample_rate },
- outlink->time_base);
+ ctx->outputs[ebur128->do_video]->time_base);
ebur128->sample_count = 0;
@@ -887,7 +886,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
}
/* set pts and push frame */
- pic->pts = pts;
+ pic->pts = av_rescale_q(pts, inlink->time_base, outlink->time_base);
+ pic->duration = 1;
clone = av_frame_clone(pic);
if (!clone)
return AVERROR(ENOMEM);
More information about the ffmpeg-cvslog
mailing list