How do capsfilters work in Gstreamer?

peter12 mikelblaz6 at
Thu Nov 5 08:22:59 UTC 2020

I have the following pipeline template that works perfectly when I launch it.

data.pipeline_template =
                        "webrtcbin bundle-policy=max-bundle name=tx %s
rtspsrc location=%s
                        latency=50 ! \
                        queue ! rtph264depay ! h264parse config-interval=-1
! avdec_h264 ! \
                        videoconvert name=source ! \
                        textoverlay font-desc=\"Arial 40px\" text=\"TX\"
valignment=2 ! \
                        timeoverlay font-desc=\"Arial 60px\" valignment=2 !
videoconvert ! \
                        queue max-size-buffers=1 ! \
                        x264enc name=encoder bitrate=%d
speed-preset=ultrafast tune=zerolatency
                        key-int-max=5 ! \
                        video/x-h264,profile=constrained-baseline ! queue
max-size-time=100000000 ! \
                        h264parse config-interval=-1 ! rtph264pay
config-interval=-1 name=payloader ! \
                        tee name=t ! udpsink host=%s port=%d t. ! %s ! tx.
However, I would like to change the height and the width dynamically.
So I  think that I would have to add the following statement inside the

capsfilter name=resol caps=video/x-raw,width=%d,height=%d  

Later to update the pipeline in this way:
data.capsfilter = gst_bin_get_by_name(GST_BIN(data.pipeline), "resol");
caps = gst_caps_new_simple(
                "width", G_TYPE_INT, data->width,
                "height", G_TYPE_INT, data->height, NULL);
g_object_set(G_OBJECT(data->capsfilter), "caps", caps, NULL);

My problem is that I don't know where to add in the template:

capsfilter name=resol caps=video/x-raw,width=%d,height=%d  

Could someone help me?

Sent from:

More information about the gstreamer-devel mailing list