Pipeline with appsink and tee doesn't work

Dwight Kulkarni dwight at realtime-7.com
Fri Sep 10 17:36:37 UTC 2021


Hi Nicolas,

I have been trying to setup the app from my RTSP Server to tap into the
appsink.

*1) I invoke the media_configure callback on rtsp_media_factory:   *

g_signal_connect(gst_rtsp_factory_var, "media-configure", (GCallback)
media_configure, NULL);   >>this is working

*2)  my media configure method looks like the following (and it seems to
run ok and gives me log outputs without any errors):*

string pipeline = "v4l2src device=/dev/video1 ! video/x-raw, width=1920,
height=1080, framerate=15/1  ! queue  max-size-bytes=50000000
max-size-time=500000000 max-size-buffers=10  ! vpuenc_h264  ! appsink
name=h264vid ";
ctx->generator_pipe =  gst_parse_launch(pipeline.c_str(), NULL);

  g_object_set_data_full (G_OBJECT (media), "rtsp-extra-data", ctx,
(GDestroyNotify) ctx_free);
  element = gst_rtsp_media_get_element (media);

  caps = gst_caps_new_simple ("video/x-h264",
      //"stream-format", G_TYPE_STRING, "byte-stream",
      "width", G_TYPE_INT, 1920, "height", G_TYPE_INT, 1080,
      "framerate", GST_TYPE_FRACTION, 15, 1, NULL);

  ctx->vid_appsrc = appsrc =  gst_bin_get_by_name_recurse_up (GST_BIN
(element), "h264videosrc");

  ctx->vid_appsink = appsink =   gst_bin_get_by_name (GST_BIN
(ctx->generator_pipe), "h264vid");

  g_signal_connect (appsrc, "need-data", (GCallback) need_data, ctx);
  gst_caps_unref (caps);
  gst_element_set_state (ctx->generator_pipe, GST_STATE_PLAYING);
  gst_object_unref (element);

*3) In my "need_data" is where I am getting the error, the "sample"
variable is empty.*

GstSample *sample;
GstFlowReturn ret;
sample = gst_app_sink_pull_sample (GST_APP_SINK (ctx->vid_appsink));

*4) My RTSP Server is setup with the pipeline as follows:*

pipeline_config = "appsrc name=h264videosrc ! queue ! rtph264pay name=pay0
pt=96";
gst_rtsp_media_factory_set_launch(factory, rtsp_pipeline_config.c_str());


Do you have any idea what is going wrong and what I can do to debug this ?

On Fri, Sep 10, 2021 at 12:24 PM Nicolas Dufresne <nicolas at ndufresne.ca>
wrote:

> Le vendredi 10 septembre 2021 à 10:18 -0400, Dwight Kulkarni via
> gstreamer-devel a écrit :
>
> Hi all,
>
> I am trying to test a pipeline from gst-launch-1.0 that has an appsink and
> a tee.
>
> The first pipeline with autovideosink below showed video and saved the
> files. The second pipeline I changed autovideosink to appsink and it
> stopped saving the files.
>
> Interestingly, the second pipeline runs and doesn't show any errors, but
> no files are outputted from the splitmuxsink.
>
>
> *works:*
> gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-raw, width=1920,
> height=1080, framerate=15/1  ! vpuenc_h264 ! tee name=v ! avdec_h264 !
> autovideosink v. ! h264parse ! splitmuxsink name=filesink
> location=video%02d.mkv max-size-time=10000000000
> muxer-properties="properties,streamable=true"
>
> *doesn't work:*
> gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-raw, width=1920,
> height=1080, framerate=15/1  ! vpuenc_h264 ! tee name=v ! appsink
> name=h264vid v. ! h264parse ! splitmuxsink name=filesink
> location=video%02d.mkv max-size-time=10000000000
> muxer-properties="properties,streamable=true"
>
>
> You need to writ an app around appsink in order to pop the buffers out of
> it, otherwise your pipeline will stall very quickly.
>
>
>
>
> --
> Sincerely,
>
> Dwight Kulkarni
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210910/ce98f96e/attachment.htm>


More information about the gstreamer-devel mailing list