[FFmpeg-devel] [FFmpeg-cvslog] avfilter/vf_tpad: if there is no frame to clone return early
Paul B Mahol
onemda at gmail.com
Thu Feb 24 23:29:43 EET 2022
On Thu, Feb 24, 2022 at 10:12 PM Thierry Foucu <tfoucu at gmail.com> wrote:
> On Thu, Feb 24, 2022 at 12:30 PM Paul B Mahol <git at videolan.org> wrote:
>
> > ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Feb 24
> > 20:32:41 2022 +0100| [3715f2f8643695940582ce040b7a052cccfb9db2] |
> > committer: Paul B Mahol
> >
> > avfilter/vf_tpad: if there is no frame to clone return early
> >
> > >
> >
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3715f2f8643695940582ce040b7a052cccfb9db2
> > ---
> >
> > libavfilter/vf_tpad.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/libavfilter/vf_tpad.c b/libavfilter/vf_tpad.c
> > index e5acece1e4..120dbcb4d3 100644
> > --- a/libavfilter/vf_tpad.c
> > +++ b/libavfilter/vf_tpad.c
> > @@ -148,6 +148,11 @@ static int activate(AVFilterContext *ctx)
> > frame->data, frame->linesize,
> > 0, 0, frame->width, frame->height);
> > } else if (s->stop_mode == 1) {
> > + if (!s->cache_stop) {
> > + s->pad_stop = 0;
> > + ff_outlink_set_status(outlink, AVERROR_EOF, s->pts);
> > + return 0;
> > + }
> > frame = av_frame_clone(s->cache_stop);
> > if (!frame)
> > return AVERROR(ENOMEM);
> >
> >
> The problem with this solution is that the tpad will then not do what we
> are expecting, which is padding video track, and the output file will not
> have the desired duration.
> Will it not be better to just output black frame (aka stop_mode == 0) ,
> something like that?
>
I doubt that, clone is clone, there is no point in padding stream that have
no frames at all.
>
> iff --git a/libavfilter/vf_tpad.c b/libavfilter/vf_tpad.c
> index e5acece1e4..5e4062e9f2 100644
> --- a/libavfilter/vf_tpad.c
> +++ b/libavfilter/vf_tpad.c
> @@ -140,7 +140,7 @@ static int activate(AVFilterContext *ctx)
> ff_outlink_set_status(outlink, AVERROR_EOF, s->pts);
> return 0;
> }
> - if (s->stop_mode == 0) {
> + if (s->stop_mode == 0 || !s->cache_stop) {
> frame = ff_get_video_buffer(outlink, outlink->w, outlink->h);
> if (!frame)
> return AVERROR(ENOMEM);
>
>
>
>
> > _______________________________________________
> > ffmpeg-cvslog mailing list
> > ffmpeg-cvslog at ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-cvslog-request at ffmpeg.org with subject "unsubscribe".
> >
>
>
> --
>
> Thierry Foucu
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>
More information about the ffmpeg-devel
mailing list