Skip to content

Conversation

@stronk-dev
Copy link
Contributor

Minor change - splits up the avfilter_graph_create_filter command into a separate alloc & init. AFAIK this is the correct order of operations (with av_opt_set_int_list in between).

@j0sh
Copy link
Collaborator

j0sh commented Dec 18, 2025

Looks like av_opt_set_int_list is also deprecated; this threw an error last time I looked at ffmpeg8 compatibility.

I was able to get things to compile with the following (but haven't actually tested it)

diff --git a/ffmpeg/filter.c b/ffmpeg/filter.c
index bb0cf93f4a..deba5cd86d 100644
--- a/ffmpeg/filter.c
+++ b/ffmpeg/filter.c
@@ -57,6 +57,7 @@ int init_video_filters(struct input_ctx *ictx, struct output_ctx *octx, AVFrame
     AVFilterInOut *inputs  = NULL;
     AVRational time_base = ictx->ic->streams[ictx->vi]->time_base;
     enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE }; // XXX ensure the encoder allows this
+    int nb_pix_fmts = sizeof(pix_fmts) / sizeof(pix_fmts[0]);
     struct filter_ctx *vf = &octx->vf;
     char *filters_descr = octx->vfilters;
     enum AVPixelFormat in_pix_fmt = ictx->vc->pix_fmt;
@@ -104,8 +105,8 @@ int init_video_filters(struct input_ctx *ictx, struct output_ctx *octx, AVFrame
                                        "out", NULL, NULL, vf->graph);
     if (ret < 0) LPMS_ERR(vf_init_cleanup, "Cannot create video buffer sink");
 
-    ret = av_opt_set_int_list(vf->sink_ctx, "pix_fmts", pix_fmts,
-                              AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN);
+    ret = av_opt_set_array(vf->sink_ctx, "pixel_formats", AV_OPT_SEARCH_CHILDREN,
+                           0, nb_pix_fmts, AV_OPT_TYPE_PIXEL_FMT, pix_fmts);
     if (ret < 0) LPMS_ERR(vf_init_cleanup, "Cannot set output pixel format");
 
     ret = filtergraph_parser(vf, filters_descr, &inputs, &outputs);
@@ -211,6 +212,7 @@ int init_signature_filters(struct output_ctx *octx, AVFrame *inf)
     AVFilterInOut *inputs  = NULL;
     AVRational time_base = octx->oc->streams[0]->time_base;
     enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE }; // XXX ensure the encoder allows this
+    int nb_pix_fmts = sizeof(pix_fmts) / sizeof(pix_fmts[0]);
     struct filter_ctx *sf = &octx->sf;
     char *filters_descr = octx->sfilters;
     enum AVPixelFormat in_pix_fmt = octx->vc->pix_fmt;
@@ -260,8 +262,8 @@ int init_signature_filters(struct output_ctx *octx, AVFrame *inf)
                                        "out", NULL, NULL, sf->graph);
     if (ret < 0) LPMS_ERR(sf_init_cleanup, "Cannot create video buffer sink");
 
-    ret = av_opt_set_int_list(sf->sink_ctx, "pix_fmts", pix_fmts,
-                              AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN);
+    ret = av_opt_set_array(sf->sink_ctx, "pixel_formats", AV_OPT_SEARCH_CHILDREN,
+                           0, nb_pix_fmts, AV_OPT_TYPE_PIXEL_FMT, pix_fmts);
     if (ret < 0) LPMS_ERR(sf_init_cleanup, "Cannot set output pixel format");
 
     ret = filtergraph_parser(sf, filters_descr, &inputs, &outputs);

BTW, for the ffmpeg8 bump: we can probably remove the signature stuff from LPMS / go-livepeer since I don't believe we are using it anymore. I just haven't gotten around to the surgery that's required to cleanly remove all signature references in both codebases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants