hi all, need help:
My project is aim to Get an RTSP server running on the Jetson TX2 using gstreamer. Link the server to the ZED camera. Get an RTSP link.
Below is the test-readme.c:
i hv change the origin code
"( videotestsrc is-live=1 ! x264enc ! rtph264pay name=pay0 pt=96 )"
Replace with
"(nvcamerasrc is-live=1 device=/dev/video1 ! video/x-raw,framerate=30/1,width=2560,height=720 ! omxh264enc ! rtph264pay name=pay0 pt=96)"
The whole code (test-readme.c):
#include <gst/rtsp-server/rtsp-server.h>
int
main (int argc, char *argv[])
{
GMainLoop *loop;
GstRTSPServer *server;
GstRTSPMountPoints *mounts;
GstRTSPMediaFactory *factory;
gst_init (&argc, &argv);
loop = g_main_loop_new (NULL, FALSE);
/* create a server instance */
server = gst_rtsp_server_new ();
/* get the mount points for this server, every server has a default object
* that be used to map uri mount points to media factories */
mounts = gst_rtsp_server_get_mount_points (server);
/* make a media factory for a test stream. The default media factory can use
* gst-launch syntax to create pipelines.
* any launch line works as long as it contains elements named pay%d. Each
* element with pay%d names will be a stream */
factory = gst_rtsp_media_factory_new ();
gst_rtsp_media_factory_set_launch (factory,"(nvcamerasrc is-live=1 device=/dev/video1 ! video/x-raw,framerate=30/1,width=2560,height=720 ! omxh264enc ! rtph264pay name=pay0 pt=96)");
gst_rtsp_media_factory_set_shared (factory, TRUE);
/* attach the test factory to the /test url */
gst_rtsp_mount_points_add_factory (mounts, "/test", factory);
/* don't need the ref to the mapper anymore */
g_object_unref (mounts);
/* attach the server to the default maincontext */
gst_rtsp_server_attach (server, NULL);
/* start serving */
g_print ("stream ready at rtsp://172.16.127.55:8554/test\n");
g_main_loop_run (loop);
return 0;
}
The server terminal shows:
nvidia@tegra-ubuntu:~/Downloads/gst-rtsp-server-1.8.1/examples$ gcc test-readme.c -o test-readme $(pkg-config --cflags --libs gstreamer-1.0 gstreamer-rtsp-server-1.0)
nvidia@tegra-ubuntu:~/Downloads/gst-rtsp-server-1.8.1/examples$ ./test-readme
stream ready at rtsp://172.16.127.55:8554/test
Available Sensor modes :
2592 x 1944 FR=30.000000 CF=0x1109208a10 SensorModeType=4 CSIPixelBitDepth=10 DynPixelBitDepth=10
2592 x 1458 FR=30.000000 CF=0x1109208a10 SensorModeType=4 CSIPixelBitDepth=10 DynPixelBitDepth=10
1280 x 720 FR=120.000000 CF=0x1109208a10 SensorModeType=4 CSIPixelBitDepth=10 DynPixelBitDepth=10
NvCameraSrc: Trying To Set Default Camera Resolution. Selected sensorModeIndex = 1 WxH = 2592x1458 FrameRate = 30.000000 ...
The client terminal shows:
nvidia@tegra-ubuntu:~$ gst-launch-1.0 --gst-debug=3 rtspsrc location="rtsp://172.16.127.55:8554/test" latency=100 ! decodebin ! nvvidconv ! ximagesink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://172.16.127.55:8554/test
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
0:00:01.317884854 6449 0x64c050 WARN rtspsrc gstrtspsrc.c:5670:gst_rtspsrc_send:<rtspsrc0> error: Got error response: 503 (Service Unavailable).
ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not read from resource.
Additional debug info:
gstrtspsrc.c(5670): gst_rtspsrc_send (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
Got error response: 503 (Service Unavailable).
0:00:01.318408981 6449 0x64c050 WARN rtspsrc gstrtspsrc.c:6898:gst_rtspsrc_open:<rtspsrc0> can't get sdp
ERROR: pipeline doesn't want to preroll.
Setting pipeline to PAUSED ...
0:00:01.318516724 6449 0x64c050 WARN rtspsrc gstrtspsrc.c:5075:gst_rtspsrc_loop:<rtspsrc0> we are not connected
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
nvidia@tegra-ubuntu:~$
However, There is nothing pop out, anyone can assist?
if i am not wrong, something is incorrect as below which i can’t figure out:
Much appreciate!! :)
gst_rtsp_media_factory_set_launch (factory,"(nvcamerasrc is-live=1 device=/dev/video1 ! video/x-raw,framerate=30/1,width=2560,height=720 ! omxh264enc ! rtph264pay name=pay0 pt=96)");