admin管理员组

文章数量:1315290

Need to change video resolution on the fly via GStreamer. Here is its pipeline fragment:

...
"! vaapih264enc name=encoder rate-control=cbr quality-level=7 keyframe-period=8 ",
"! video/x-h264, profile=constrained-baseline, width=640, height=480 ",
"! h264parse config-interval=1 ",
...

AFAIK, the solution is to manage capsfilter between vaapih264enc and h264parse. I have managed to get vaapih264enc byt it's name:

auto encoder = gst_bin_get_by_name_recurse_up(media, "encoder");

And I've also managed to get it's sink:

auto sink = GST_PAD(context->encoder->sinkpads->data);

But I cannot find a way to get GstCaps object and to set it's properties. Can anybody help?

Need to change video resolution on the fly via GStreamer. Here is its pipeline fragment:

...
"! vaapih264enc name=encoder rate-control=cbr quality-level=7 keyframe-period=8 ",
"! video/x-h264, profile=constrained-baseline, width=640, height=480 ",
"! h264parse config-interval=1 ",
...

AFAIK, the solution is to manage capsfilter between vaapih264enc and h264parse. I have managed to get vaapih264enc byt it's name:

auto encoder = gst_bin_get_by_name_recurse_up(media, "encoder");

And I've also managed to get it's sink:

auto sink = GST_PAD(context->encoder->sinkpads->data);

But I cannot find a way to get GstCaps object and to set it's properties. Can anybody help?

Share Improve this question asked Jan 30 at 12:33 Mikhail ZimkaMikhail Zimka 7241 gold badge10 silver badges20 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

In order to get the GstCaps you need to get the GstSample and the GstAppsink first. Based on the code you showed, you could do something like this:

auto appsink = GST_APP_SINK(sink);
auto sample = gst_app_sink_pull_sample(appsink)
auto caps = gst_sample_get_caps(sink);

本文标签: cSet up GstCaps on runtimeStack Overflow