[Libav-user] Filter initialization change in git relative to 7.0?

Andrew Randrianasulu randrianasulu at gmail.com
Wed May 14 13:09:11 EEST 2025


On Wed, May 14, 2025 at 10:57 AM Andrew Randrianasulu
<randrianasulu at gmail.com> wrote:
>
> On Wed, May 14, 2025 at 10:57 AM Paul B Mahol <onemda at gmail.com> wrote:
> >
> >
> >
> > On Wed, May 14, 2025 at 5:05 AM Andrew Randrianasulu <randrianasulu at gmail.com> wrote:
> >>
> >> Even if our code compiles it does not work anymore ...
> >>
> >> [out @ 0xe1821180] Option 'pix_fmts' is not a runtime option and so
> >> cannot be set after the object has been initialized
> >>
> >>         int ret = 0;  char args[BCTEXTLEN];
> >>         AVPixelFormat pix_fmt = (AVPixelFormat)avpar->format;
> >>         snprintf(args, sizeof(args),
> >>
> >> "video_size=%dx%d:pix_fmt=%i:time_base=%d/%d:pixel_aspect=%d/%d",
> >>                 avpar->width, avpar->height,(int)pix_fmt,
> >>                 st->time_base.num, st->time_base.den, sa_num, sa_den);
> >>         if( ret >= 0 ) {
> >>                 filt_ctx = 0;
> >>                 ret = insert_filter("buffer", args, "in");
> >>                 buffersrc_ctx = filt_ctx;
> >>         }
> >>         if( ret >= 0 )
> >>                 ret = flip(theta);
> >>         AVFilterContext *fsrc = filt_ctx;
> >>         if( ret >= 0 ) {
> >>                 filt_ctx = 0;
> >>                 ret = insert_filter("buffersink", 0, "out");
> >>                 buffersink_ctx = filt_ctx;
> >>         }
> >>         if( ret >= 0 ) {
> >>                 ret = av_opt_set_bin(buffersink_ctx, "pix_fmts",
> >>                         (uint8_t*)&pix_fmt, sizeof(pix_fmt),
> >>                         AV_OPT_SEARCH_CHILDREN);
> >>         }
> >>         if( ret >= 0 )
> >>                 ret = config_filters(filter_spec, fsrc);
> >>         else
> >>                 ff_err(ret, "FFVideoStream::create_filter");
> >>         return ret >= 0 ? 0 : -1;
> >>
> >>
> >> =========
> >>
> >> There is no video filtering example in doc/examples.
> >>
> >> How I supposed to know what should be put there now?
> >
> >
> > doc/examples/decode_filter_video.c
>
>
> Thanks, but it still says
>
>
>     /* buffer video source: the decoded frames from the decoder will
> be inserted here. */
>     snprintf(args, sizeof(args),
>             "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d",
>             dec_ctx->width, dec_ctx->height, dec_ctx->pix_fmt,
>             time_base.num, time_base.den,
>             dec_ctx->sample_aspect_ratio.num, dec_ctx->sample_aspect_ratio.den);
>
>     ret = avfilter_graph_create_filter(&buffersrc_ctx, buffersrc, "in",
>                                        args, NULL, filter_graph);
>
> and  I googled and found this commit
>
> https://gitlab.com/webrtc-mirror/ffmpeg/-/commit/0548ab2e4257f9c6e7a7a57138504533a6ca5507
>
> ========
> Commit 0548ab2e
> authored 7 months ago by Anton Khirnov
>
> lavu/log,opt: detect setting non-runtime options post-init
>
> Add a mechanism to AVClass to allow objects to signal their state to
> generic code. When an object flags itself with the 'initialized' state,
> print an error (and fail, after the next major bump) if the caller
> attempts to set non-runtime options.
>
> ====
>
> For now I just removed AVERROR, but this is not way forward if we want
> to support external ffmpeg ...
>

Ah, so I just removed whole block setting


if( ret >= 0 ) {
 ret = av_opt_set_bin(buffersink_ctx, "pix_fmts",
   (uint8_t*)&pix_fmt, sizeof(pix_fmt),
   AV_OPT_SEARCH_CHILDREN);
}

on "out" and now it works with ffmpeg git .commit
038314bc6be2f35a82e9fba2228bcac2e4fee648

Still, there is strange corruption on first frame of hevc hdr video if
decoded via Vulkan, so sounds like regression?

>
> >
> >>
> >> _______________________________________________
> >> Libav-user mailing list
> >> Libav-user at ffmpeg.org
> >> https://ffmpeg.org/mailman/listinfo/libav-user
> >>
> >> To unsubscribe, visit link above, or email
> >> libav-user-request at ffmpeg.org with subject "unsubscribe".
> >
> > _______________________________________________
> > Libav-user mailing list
> > Libav-user at ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/libav-user
> >
> > To unsubscribe, visit link above, or email
> > libav-user-request at ffmpeg.org with subject "unsubscribe".


More information about the Libav-user mailing list