Capturing UDP stream of images

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Capturing UDP stream of images

Alexa_B
I currently have a Python program which pushes images to a gstreamer
pipeline, however it only seems to display the images using autovideosink,
and not with udpsink.

def __init__(self):
                self.is_push_buffer_allowed = None
                self._mainloop = GObject.MainLoop()
                udp_sink_pipeline = "appsrc name=source !
image/jpeg,framerate=(fraction)30/1  ! decodebin ! videoscale ! capsfilter
caps=video/x-raw,width=640,height=480,pixel-aspect-ratio=(fraction)1/1  !
queue ! autovideosink"

'''jpegenc ! rtpjpegpay ! udpsink host=127.0.0.1,port=5000'''

                self._pipeline = Gst.parse_launch(udp_sink_pipeline)

                self._src = self._pipeline.get_by_name('source')
                self._src.connect('need-data', self.start_feed)
                self._src.connect('enough-data', self.stop_feed)

                self._src.set_property('format','time')
                self._src.set_property('do-timestamp', True)


        def start_feed(self,src,length):
                self.is_push_buffer_allowed = True

        def stop_feed(self,src):
                self.is_push_buffer_allowed = False

        def play(self):
                self._pipeline.set_state(Gst.State.PLAYING)

        def stop(self):
                self._pipeline.set_state(Gst.State.NULL)

        def run(self):
                self._mainloop.run()

        def push(self, filename):
                if self.is_push_buffer_allowed:
                        handle = open(filename, 'rb');
                        data = handle.read()
                        handle.close()
                        buf = Gst.Buffer.new_allocate(None, len(data),None)
                        buf.fill(0,data)
                        sample = Gst.Sample.new(buf, Gst.caps_from_string("image/jpeg,
framerate=(fraction)30/1"),None,None)
                        gst_flow_return = self._src.emit('push-sample',sample)

                        if gst_flow_return != Gst.FlowReturn.OK:
                                print("Error, Stopped streaming")

                        else:
                                '''print("Enough data on buffer.")'''


I try to capture using:

gst-launch-1.0 udpsrc port=5000 !
application/x-rtp,encoding-name=JPEG,payload=26 ! rtpjpegdepay ! jpegdec !
autovideosink




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