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?
1 Answer
Reset to default 1In 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);