Open yengliong93 opened 2 years ago
Hi
go-gst is a binding for gstramer in go language in which all gstramer functionalities are supported.
How does your rtsp configure with? Does it correctly set up to use tcp? ''' protocols “protocols” GstRTSPLowerTrans * Allowed lower transport protocols
Flags : Read / Write
Default value : tcp+udp-mcast+udp '''
Hi, Yes, the rtsp server is supported tcp protocol. I run the gst-launch command. The command is reading the stream with TCP protocols.
gst-launch command:
gst-launch-1.0 -e rtspsrc protocols=tcp location=rtsp://10.72.4.66:8554/final_new.h264 ! fakesink async=false
RTSP logs:
rtsp-simple-server_1 | 2022/06/13 00:34:07 INF [RTSP] [conn 10.72.4.66:47512] opened rtsp-simple-server_1 | 2022/06/13 00:34:07 INF [RTSP] [session 111889720] created by 10.72.4.66:47512 rtsp-simple-server_1 | 2022/06/13 00:34:08 INF [RTSP] [session 111889720] is reading from path 'final_new.h264', 1 track with TCP
In my code, I am able to set location of rtspsrc. It can connect to my rtsp server and the filename is correct. However, the set to protocols doesn't take effect.
First of all, check the return value from Set("protocols", "tcp")
in order to verify whether there is no error.
Second as alternative way, try to use SetArg()
instead of Set()
SetArg()
doesn`t have any return value, but it is useful for unsupported type in go-gst to set argument into gst object.
func (o *Object) SetArg(name, value string) {
Thanks, the SetArg()
works. The next step is I am trying to link both rtspsrc and fakesink. An error happened when I use ElementLinkMany to link them.
Error:
Error Happen: Failed to link rtspsrc0 to fakesink0
My codes:
fakesink, err := gst.NewElement("fakesink") if err != nil { return nil, err } fakesink.SetArg("async", "false") anyerror := pipeline.AddMany(src, fakesink) if anyerror != nil { fmt.Println("Error Happen: ", anyerror) } anyerror = gst.ElementLinkMany(src, fakesink) if anyerror != nil { fmt.Println("Error Happen: ", anyerror) }
Any idea?
Strange, Does the rtspsrc successfully be created?
I suggest you to debug logs with enable DEBUG level into gstreamer.
I figure it out by connecting the rtspsrc's pad-added signal. The issue has been discussed in https://stackoverflow.com/questions/32233370/gstreamer-1-0-rtspsrc-to-rtph264depay-cannot-link
Thanks for all the advices.
Hi, I have created a new element for rtspsrc and set the protocols to tcp. From the rtsp server logs, it is still using UDP protocol to fetch the video stream. Is the rtspsrc element supported? How can we set its protocols?
Codes:
RTSP logs: