NVIDIA / libnvidia-container

NVIDIA container runtime library
Apache License 2.0
846 stars 205 forks source link

low bitrate for h264 rtp gstreamer pipeline in docker on jetson nano #164

Closed wirstrom closed 2 years ago

wirstrom commented 2 years ago

Hi I experience very low bitrate (or at least that is what it looks like) when I use gstreamer to stream h264 encoded video from inside a docker container. The received stream looks much better if I stream directly from jetson (i.e not in a container). See the attached images below.

I have verified with jtop that the NVENC hardware acceleration is used in both cases.

The command I use to launch docker container: docker run --net=host --runtime nvidia --rm --ipc=host -v /tmp/.X11-unix/:/tmp/.X11-unix/ -v /tmp/argus_socket:/tmp/argus_socket --cap-add SYS_PTRACE -e DISPLAY=$DISPLAY -it nvcr.io/nvidia/l4t-base:r32.4.3

The command for running the gstreamer sender: gst-launch-1.0 nvarguscamerasrc ! nvvidconv ! omxh264enc ! 'video/x-h264, stream-format=(string)byte-stream' ! h264parse ! rtph264pay mtu=1400 config-interval=1 pt=96 ! udpsink host=192.168.125.205 port=6000

The command for running the gstreamer receiver: gst-launch-1.0 -v udpsrc port=6000 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! rtph264depay ! h264parse ! avdec_h264 output-corrupt = false ! videoconvert ! queue ! autovideosink

Thank You!

Streamed from container on jetson nano: Screenshot from 2022-04-04 17-42-00

Streamed from jetson nano (no container): Screenshot from 2022-04-04 17-40-40

wirstrom commented 2 years ago

Never mind! I realized I was using the deprecated omxh264enc component. After changing to nvv4l2h264enc it worked nicely.

The command for running the gstreamer sender: gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM)' ! nvv4l2h264enc insert-sps-pps=1 ! h264parse ! rtph264pay ! udpsink host=192.168.125.205 port=6000