Jetson TX2 and FFmpeg - Can't initialize nvrm channel

Hello, I have a problem with a FFmpeg and it’s Jetson HW decoding.

My setup:
TX2 in dev kit and TX2 in carrierboard from Connect tech inc.
L4T 32.4.3.

I want HW decoding of RTSP H264 stream for use in Zoneminder.
I compile both ZM anf FFMPEG from source. Both compile without a issue.

I tried this in docker but I had some problems so I moved to installation in root, see post.

I use FFmpeg 4.3.1 to keep system dependencies . I tried both approach, Jcover’s and Pandias.

Both approach works in cli:

ffmpeg -c:v h264_nvmpi -i 1.mp4 -f null -
ffmpeg -c:v h264_nvv4l2dec -i 1.mp4 -f null - 

Problem comes when I want to use them with Zoneminder. Decoder is registered by:

avcodec_find_decoder_by_name("h264_nvmpi ")
# Or
avcodec_find_decoder_by_name("h264_nvv4l2dec")

Both fail with following error even before component is fully loaded, no meaningful debug output:

Error: Can't initialize nvrm channel
Error: Can't initialize nvrm channel
Couldn't create ddkvic Session: Cannot allocate memory
nvbuf_utils: Could not create Default NvBufferSession

I tried:

sudo nvpmodel -m 0 
sudo jetson_clocks

Suggested here, but it did not help.

@DaneLLL any ideas?

Hi,
Please check

This is the docker for L4T. You would need to refer to it and set up docker environment accordingly.

Hello @DaneLLL, I tried it and it failed with other error in my previous post. My setup is now pure L4T 32.4.3 with all additional packages installed trough sdkmanager.

No docker.

Hi,
We would suggest build the package from source in local folder and check if you can build/run your application in the folder. Please do the steps:

  1. Get source code
$ echo "deb https://repo.download.nvidia.com/jetson/ffmpeg main main" |  sudo tee -a /etc/apt/sources.list
$ echo "deb-src https://repo.download.nvidia.com/jetson/ffmpeg main main" |  sudo tee -a /etc/apt/sources.list
$ sudo apt update
$ apt source ffmpeg
  1. Configure and build:
ffmpeg-4.2.2$ ./configure --enable-nvv4l2dec --enable-libv4l2 --enable-shared --extra-libs="-L/usr/lib/aarch64-linux-gnu/tegra -lnvbuf_utils" --extra-cflags="-I /usr/src/jetson_multimedia_api/include/"
ffmpeg-4.2.2$ make
  1. Verify hardware decoding by setting LD_LIBRARY_PATH and running the command:
ffmpeg-4.2.2$ export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:/home/nvidia/ffmpeg/ffmpeg-4.2.2/libavdevice:/home/nvidia/ffmpeg/ffmpeg-4.2.2/libavfilter:/home/nvidia/ffmpeg/ffmpeg-4.2.2/libavformat:/home/nvidia/ffmpeg/ffmpeg-4.2.2/libavcodec:/home/nvidia/ffmpeg/ffmpeg-4.2.2/libavformat:/home/nvidia/ffmpeg/ffmpeg-4.2.2/libswresample:/home/nvidia/ffmpeg/ffmpeg-4.2.2/libswscale:/home/nvidia/ffmpeg/ffmpeg-4.2.2/libavutil:
ffmpeg-4.2.2$ ./ffmpeg -c:v h264_nvv4l2dec -i /opt/nvidia/deepstream/deepstream-5.0/samples/streams/sample_720p.mp4 a.yuv

And then try to build/run your application under ffmpeg-4.2.2 folder.

Seems that user need to be in video group to be able to use decoder, could you confirm that?

Hi,

Yes, it is correct. Permission issue may happen if the user is not in video group. Please refer to this topic:

1 Like