Is Use Jetson nano as a NVR server possible?

I want to use Jetson nano as a NVR server with 4 IP cam, but it seems Jetson nano can not afford NVR usage, I tried to find solution for a month, but I did not find a best solution.

Firstly, I try to use ZoneMinder NVR software, but when I open three rtsp IP cam to record, CPU will stuck on 100%, and I can not open another IP cam, even I need to remove power cable to shutdown Jetson nano.

And I realize that ZoneMinder use ffmpeg as a codec, but ffmpeg HW accelerate is not support Jetson GPU, since Jetson NVENC/NVDEC block is not on GPU. ref

Then I find an repo jetson-ffmpeg, it can use h264_nvmpi to enable Jetson NVENC/NVDEC for ffmpeg, I use its example and it did work, but I can not use it on ZoneMinder(I try to add vcodec=h264_nvmpi but ZoneMinder said that it can not recognize this codec, also try to modify ffmpeg path to repo install path, still not working).

Now I give up ZoneMinder and try to use gstreamer + opencv + flask on Python to establish NVR site, here is my code of how to use gstreamer + opencv:

def record(id):
    return "gst-launch-1.0 rtspsrc location=rtsp://admin:admin@ip:554/media ! rtph264depay ! queue ! h264parse ! matroskamux ! filesink location=/home/user/record/CAM"+ str(id) + "_"+ time.strftime("%Y%m%d_%H%M%S") +".mp4"

def find_camera(id):
    return 'rtspsrc location=rtsp://admin:admin@ip:554/media ! rtph264depay ! h264parse ! omxh264dec ! nvvidconv ! video/x-raw, width=640, height=360, format=BGRx ! videoconvert ! appsink '

def gen_frames(camera_id):
    cam = find_camera(camera_id)
    cap=  cv2.VideoCapture(cam, cv2.CAP_GSTREAMER)
    while True:
        # for cap in caps:
        # # Capture frame-by-frame
        success, frame =  # read the camera frame
        if not success:
            ret, buffer = cv2.imencode('.jpg', frame)
            frame = buffer.tobytes()
            yield (b'--frame\r\n'
                b'Content-Type: image/jpeg\r\n\r\n' + frame + b'\r\n') 

And NVDEC is used, CPU usage is about 90%, at the beginning 4 IP cam on the site run OK, but after a few seconds, one/two of the IP cams image will freezing.

I want to know:

  1. Is my gstreamer pipeline have any defect need to improve?
  2. Is there a better solution for the NVR server on Jetson Nano?

DeepStream SDK could be a solution to your case. Please check

We connect Jetson Nano to a PoE switch and IP cameras are connected to the switch. With this setting, we can run deepstream-app to launch the IP cameras. This is a valise usecase. FYR.