Changing pipepline source to videotestsrc dynamically

Lev875 lev875 at
Thu Jul 25 17:16:09 UTC 2019


I am trying to record rtsp stream to a file and I want to change the input
during recording, so that half of the video recorder from stream and the
later half is taken from videotestsrc. Here is my pipeline

rtspsrc location=rtsp:// protocols=tcp name=vsrc !
rtph264depay name=vdepay ! avdec_h264 name=avdec ! videoconvert
name=videoconv ! filesink location=test.mp4 name=fsink

I am tried to accomplish this by pausing the pipeline, unlinking rtspsrc,
rtph264depay and avdec_h264 and then creating videotestsrc and x264enc and
linking them to videoconverter, by so far when I try it only half of the
video is recorder, and after resuming the pipeline it starts without errors,
but the video is not recorder anymore. 

    gst_element_set_state (pipeline, GST_STATE_PAUSED);
    gst_element_set_state (vsrc, GST_STATE_NULL);
    gst_element_set_state (vdepay, GST_STATE_NULL);

    gst_bin_remove_many (GST_BIN (pipeline), vsrc, vdepay, NULL);

    gst_bin_add_many(GST_BIN (pipeline), vtest, enc, NULL);

    gst_element_link_many (vtest, enc, videoconv, NULL);

    gst_element_set_state (pipeline, GST_STATE_PLAYING);

How should something like this be implemented. 

Sent from:

More information about the gstreamer-devel mailing list