How to play gstreamer on QGst::Ui::VideoWidget using some special filters

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to play gstreamer on QGst::Ui::VideoWidget using some special filters

YRusinov
This post was updated on .
Hello, All !

I have to stream video without sound from another machine by port 52517 in
network onto my Qt::Widget. In command line on transmitter machine I launch
    gst-launch-1.0 filesrc location = <my_file> ! decodebin ! x264enc tune=zerolatency bitrate=500 speed-preset=superfast ! rtph264pay ! udpsink host=<my_ip> port=<required_port>

on receiver machine
    gst-launch-1.0 -v udpsrc port=<required_port> caps="application/x-rtp, media=video, clock-rate=90000, encoding-name=H264, payload=96, ssrc=3394826012, timestamp-offset=2215812541, seqnum-offset=46353" ! rtph264depay ! decodebin ! videoconvert ! autovideosink sync=false

and all works fine, if I try to set this programmatically I wrote

  GstElementFactory * udpsrcFactory = gst_element_factory_find ("udpsrc");
  GstElement * udpsrcElem = gst_element_factory_create (udpsrcFactory, "udpsrc");//QGst::ElementFactory::make ("udpsrc", "52517");
  g_object_set(G_OBJECT(udpsrcElem), "port", 52517);
  GstCaps * caps = gst_caps_from_string("application/x-rtp, media=video, clock-rate=90000, encoding-name=H264, payload=96, ssrc=3394826012, timestamp-offset=2215812541, seqnum-offset=46353");
  g_object_set(G_OBJECT(udpsrcElem), "caps", caps, nullptr);

  GstElementFactory * rtph264Factory = gst_element_factory_find("rtph264depay");
  GstElement * rtph264Elem = gst_element_factory_create(rtph264Factory, "rtph264depay");

  GstElementFactory * decodebinFactory = gst_element_factory_find("decodebin");
  GstElement * decodebinElem = gst_element_factory_create(decodebinFactory, "decodebin");
 
  GstElementFactory * videoconvertFactory = gst_element_factory_find("videoconvert");
  GstElement * videoconvertElem = gst_element_factory_create(videoconvertFactory, "videoconvert");

  GstElementFactory * audiovideosinkFactory = gst_element_factory_find("autovideosink");
  GstElement * audiovideosinkElem = gst_element_factory_create(audiovideosinkFactory, "autovideosink");
  g_object_set(G_OBJECT(audiovideosinkElem), "sync", false, nullptr);

  GstElement *p = gst_pipeline_new("udp_pipeline");
  if (!p || !udpsrcElem || !rtph264Elem || !decodebinElem || !videoconvertElem || !audiovideosinkElem) {
    qDebug () << __PRETTY_FUNCTION__ << "not all gstreamer plugins were built";
    return;
  }
  gst_bin_add_many (GST_BIN (p), udpsrcElem, rtph264Elem, decodebinElem, videoconvertElem, audiovideosinkElem, nullptr);
  if (!gst_element_link_many (udpsrcElem, rtph264Elem, nullptr) ||
      !gst_element_link_many (rtph264Elem, decodebinElem, nullptr) ||
      !gst_element_link_many (videoconvertElem, audiovideosinkElem, nullptr)) {
    qDebug () << __PRETTY_FUNCTION__ << "Elements could not be linked.";
    gst_object_unref (p);
    return;
  }

  m_pipeline = QGst::PipelinePtr::wrap(GST_PIPELINE(p));
  m_pipeline->setProperty("uri", "udp://0.0.0.0:52517");
  setVideoSink (QGst::ElementPtr::wrap(audiovideosinkElem));
  watchPipeline(m_pipeline);

at my widget that inherits from QGst::Ui::VideoWidget, all threads in
debugger are set but nothing video. What is wrong ?

Best regards,
Yuriy.






--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to play gstreamer on QGst::Ui::VideoWidget using some special filters

YRusinov
Hello, All !

I have solved this problem by constructed pipeline using descriptions such this

QString pipelineDesc = QString ("udpsrc port=52517 caps=\"application/x-rtp,"
                                  "media=video,"
                                  "clock-rate=90000,"
                                  "encoding-name=H264,"
                                  "payload=96,"
                                  "ssrc=3394826012,"
                                  "timestamp-offset=2215812541,"
                                  "seqnum-offset=46353\" !"
                                  "rtph264depay !"
                                  "decodebin !"
                                  "videoconvert !"
                                  "autovideosink sync=false");
  m_pipeline_ = QGst::Parse::launch(pipelineDesc).dynamicCast<QGst::Pipeline>();
  

On Thu, Dec 12, 2019 at 1:04 PM YRusinov <[hidden email]> wrote:
Hello, All !

I have to stream video without sound from another machine by port 52517 in
network onto my Qt::Widget. In command line on transmitter machine I launch

on receiver machine

and all works fine, if I try to set this programmatically I wrote

at my widget that inherits from QGst::Ui::VideoWidget, all threads in
debugger are set but nothing video. What is wrong ?

Best regards,
Yuriy.






--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


--
Best regards,
Sincerely yours,
Yuriy Rusinov.

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel