Inquiry about NVENC Usage with Multi-GPU Setup

I am currently using a server computer equipped with 8 RTX 4090 GPUs. My goal is to receive 40 video streams, perform inference, and transmit the processed videos via RTSP. To achieve this, I am utilizing NVENC within GStreamer with the nvh264enc pipeline for RTSP streaming. However, I am only able to stream 5 videos concurrently.

Based on the reference materials, I understand that one session can accelerate up to 5 video streams. Therefore, I assumed it would be possible to handle 40 video streams with 8 GPUs. Unfortunately, I have not been successful in making this work. Could you provide guidance on how I can accomplish this?

I am using Python-based OpenCV for video transmission with the following pipeline:

appsrc is-live=true block=true format=GST_FORMAT_TIME ! videoconvert ! nvh264enc cuda-device-id={gpu_id} ! rtph264pay config-interval=1 pt=96 ! udpsink host=192.168.0.209 port={port} async=false

The operating environment and GStreamer setup are as follows:

OS: Ubuntu 20.04
GStreamer: 1.16.2 (Build)

I am keen to resolve this issue and would greatly appreciate your assistance.