Cannot create RTSP stream on service boot

Hi everyone, I’m trying to send a pi camera stream on the network with RTSP protocol and i would like the stream to be created when my jetson nano boots up.

The simple command i would like to execute on startup is the following :

/home/eseo/RTSP/gst-rtsp-server/examples/test-launch "nvarguscamerasrc sensor-id=0 ! video/xraw(memory:NVMM) width=1920 height=1080 framerate=30/1 format=NV12 ! omxh264enc iframeinterval=15 ! h264parse ! rtph264pay name=pay0 pt=96"  

Please note that this command execute well and i’m able to retrieve the RTSP stream when launch directly on the jetson.

I’ve followed this tutorial for creating the service: How to run a script on boot - #4 by mdegans

i created this script createRTSP.sh:

#!/bin/bash 

# This script runs a command to create an RTSP stream for the PI camerea 

echo "Creating RTSP stream..." 

/home/eseo/RTSP/gst-rtsp-server/examples/test-launch "nvarguscamerasrc sensor-id=0 ! video/xraw(memory:NVMM) width=1920 height=1080 framerate=30/1 format=NV12 ! omxh264enc iframeinterval=15 ! h264parse ! rtph264pay name=pay0 pt=96"  

echo "RTSP stream closed" 

and the service file is the following:

[Unit] 
After=network.target 
Description="Creating RTSP stream on startup" 
[Service] 
ExecStart=/usr/local/bin/createRTSP.sh 
User=cameraRTSP 
[Install] 
WantedBy=multi-user.target 

After launching the service and checking the status with this command:

sudo systemctl status cameraRTSP

I’m getting these error and I’m not able to retrieve the video stream from the server:

● cameraRTSP.service - "Creating RTSP stream on startup"
   Loaded: loaded (/lib/systemd/system/cameraRTSP.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2023-04-05 10:49:04 CEST; 11s ago
 Main PID: 4458 (createRTSP.sh)
    Tasks: 2 (limit: 4181)
   CGroup: /system.slice/cameraRTSP.service
           ├─4458 /bin/bash /usr/local/bin/createRTSP.sh
           └─4515 /home/eseo/RTSP/gst-rtsp-server/examples/.libs/test-launch nvarguscamerasrc sensor-id=0 ! video/xraw(memory:NVMM) width=1920 height=1080 

Apr 05 10:49:07 jetsonnano createRTSP.sh[4458]: Error: Can't initialize nvrm channel
Apr 05 10:49:07 jetsonnano createRTSP.sh[4458]: Couldn't create ddkvic Session: Cannot allocate memory
Apr 05 10:49:07 jetsonnano createRTSP.sh[4458]: nvbuf_utils: Could not create Default NvBufferSession
Apr 05 10:49:07 jetsonnano createRTSP.sh[4458]: Error: Can't initialize nvrm channel
Apr 05 10:49:07 jetsonnano createRTSP.sh[4458]: Couldn't create ddkvic Session: Cannot allocate memory
Apr 05 10:49:07 jetsonnano createRTSP.sh[4458]: nvbuf_utils: Could not create Default NvBufferSession
Apr 05 10:49:07 jetsonnano createRTSP.sh[4458]: Error: Can't initialize nvrm channel
Apr 05 10:49:07 jetsonnano createRTSP.sh[4458]: Couldn't create ddkvic Session: Cannot allocate memory
Apr 05 10:49:07 jetsonnano createRTSP.sh[4458]: nvbuf_utils: Could not create Default NvBufferSession
Apr 05 10:49:08 jetsonnano createRTSP.sh[4458]: stream ready at rtsp://127.0.0.1:8554/test

Can you help me resolve those errors?

Hi,
Please refer to Jetson Nano FAQ

Q: How to autorun an app or commands at startup?

There are several use-cases and please give it a try.

I did the setup with rc.local and wrote my command in the rc.local file. The stream launches well at start-up. Thx!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.