How to establish a connection between sender and receiver using TCP?

Nicolas Dufresne nicolas at ndufresne.ca
Mon Aug 21 19:34:16 UTC 2023


Le lundi 21 août 2023 à 20:46 +0530, Sulthan Amanu a écrit :
> Hi Team
> 
> How to establish a connection between sender and receiver using TCP? I've
> successfully achieved the connection using UDP, but I'm facing difficulties in
> establishing a connection between the server and receiver using TCP. I'm
> encountering an error that says "Could not open resource for reading."
> 
> My goal is to save images from the server.
> 
> UDP Workable commend
> 
> Sender:
> gst-launch-1.0 v4l2src device=/dev/video1 ! video/x-raw,width=1280,height=720
> ! jpegenc ! rtpjpegpay ! queue ! udpsink host=192.168.53.207 port=7001
> 
> Receiver:
> gst-launch-1.0 udpsrc port=7001 ! application/x-rtp,encoding-
> name=JPEG,payload=26 ,x-dimensions=\"4192,3120\" ! queue  ! rtpjitterbuffer
> latency=200 !  rtpjpegdepay ! multifilesink location="image%d.jpg"
> 
> TCP - Non workable commend
> 
> Sender:
> 
> gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=50 ! video/x-
> raw,width=1280,height=720 ! jpegenc ! rtpjpegpay ! tcpserversink
> host=192.168.53.207 port=7001

Unlike UDP, you have to configure the server IP,here you have configured the
receiver IP (or 0.0.0.0 to bind to all ipv4 interfaces). Also, in absence of
datagram, you need a secondary level payloading.

gst-launch-1.0 v4l2src device=/dev/video1 num-buffers=50 ! video/x-raw,width=1280,height=720 ! jpegenc ! rtpjpegpay ! rtpstreampay ! tcpserversink host=<server-ip> port=7001

> 
> Receiver:
> 
> gst-launch-1.0 tcpclientsrc host=192.168.53.207 port=7001 ! application/x-
> rtp,encoding-name=JPEG,payload=26 ! queue ! rtpjitterbuffer latency=200 !
> rtpjpegdepay ! multifilesink location="image%d.jpg"

gst-launch-1.0 tcpclientsrc host=<server-ip> port=7001 ! application/x-rtp-stream,encoding-name=JPEG,payload=26 ! queue ! rtpstreamdepay ! rtpjitterbuffer latency=200 ! rtpjpegdepay ! multifilesink location="image%d.jpg"

> 
> 
> e$ gst-launch-1.0 tcpclientsrc host=192.168.53.207 port=7001 ! application/x-
> rtp,encoding-name=JPEG,payload=26 ! queue ! rtpjitterbuffer latency=200 !
> rtpjpegdepay ! multifilesink location="image%d.jpg"
> 
> Setting pipeline to PAUSED ...
> ERROR: Pipeline doesn't want to pause.
> ERROR: from element /GstPipeline:pipeline0/GstTCPClientSrc:tcpclientsrc0:
> Could not open resource for reading.
> Additional debug info:
> gsttcpclientsrc.c(459): gst_tcp_client_src_start ():
> /GstPipeline:pipeline0/GstTCPClientSrc:tcpclientsrc0:
> Failed to connect to host '192.168.53.207:7001': Connection refused
> Setting pipeline to NULL ...
> Freeing pipeline ...

This should in theory resolve the issue.

regards,
Nicolas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20230821/92ac6da8/attachment.htm>


More information about the gstreamer-devel mailing list