HW decoding in ffmpeg does not work well

Hello.

I want to do HW encoding/decoding in jetson.
I am using jetpack 4.6.
I have finished the ffmpeg implementation in one step and this is the result.

$ ffmpeg -codecs | grep 264
ffmpeg version git-2022-08-09-d931554 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 7 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04)
  configuration: --enable-cuda-nvcc --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --enable-gpl --enable-shared --enable-libx264
  libavutil      57. 32.101 / 57. 32.101
  libavcodec     59. 42.101 / 59. 42.101
  libavformat    59. 30.100 / 59. 30.100
  libavdevice    59.  8.101 / 59.  8.101
  libavfilter     8. 46.101 /  8. 46.101
  libswscale      6.  8.102 /  6.  8.102
  libswresample   4.  8.100 /  4.  8.100
  libpostproc    56.  7.100 / 56.  7.100
 DEV.LS h264                 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_v4l2m2m h264_cuvid ) (encoders: libx264 libx264rgb h264_nvenc h264_v4l2m2m )
ffmpeg -hwaccels
ffmpeg version git-2022-08-09-d931554 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 7 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04)
  configuration: --enable-cuda-nvcc --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --enable-gpl --enable-shared --enable-libx264
  libavutil      57. 32.101 / 57. 32.101
  libavcodec     59. 42.101 / 59. 42.101
  libavformat    59. 30.100 / 59. 30.100
  libavdevice    59.  8.101 / 59.  8.101
  libavfilter     8. 46.101 /  8. 46.101
  libswscale      6.  8.102 /  6.  8.102
  libswresample   4.  8.100 /  4.  8.100
  libpostproc    56.  7.100 / 56.  7.100
Hardware acceleration methods:
cuda

However, when I try to use the hardware decoder with the ffmpeg command, I get an error.

nakayo@nakayo-desktop:~$ ffmpeg -y -vsync 0 -c:v h264_cuvid -i rtsp://192.168.2.191:8554/camera camera.mp4
ffmpeg version git-2022-08-09-d931554 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 7 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04)
  configuration: --enable-cuda-nvcc --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --enable-gpl --enable-shared --enable-libx264
  libavutil      57. 32.101 / 57. 32.101
  libavcodec     59. 42.101 / 59. 42.101
  libavformat    59. 30.100 / 59. 30.100
  libavdevice    59.  8.101 / 59.  8.101
  libavfilter     8. 46.101 /  8. 46.101
  libswscale      6.  8.102 /  6.  8.102
  libswresample   4.  8.100 /  4.  8.100
  libpostproc    56.  7.100 / 56.  7.100
-vsync is deprecated. Use -fps_mode
Passing a number to -vsync is deprecated, use a string argument as described in the manual.
Input #0, rtsp, from 'rtsp://192.168.2.191:8554/camera':
  Metadata:
    title           : Stream
  Duration: N/A, start: 0.023922, bitrate: N/A
  Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080, 15 fps, 15 tbr, 90k tbn
[h264_cuvid @ 0x55b2d0e460] Cannot load libnvcuvid.so.1
[h264_cuvid @ 0x55b2d0e460] Failed loading nvcuvid.
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_cuvid) -> h264 (libx264))
Error while opening decoder for input stream #0:0 : Operation not permitted

Indeed, there is no “libnvcuvid.so.1” in /usr/local/.
Is there a mistake in the build method?

Thank you.

Hi,
Please refer to developer guide and related topics:
Jetson TX2 and FFmpeg - Can't initialize nvrm channel - #5 by DaneLLL
Hardware accelerated video playback with L4T ffmpeg - #7 by DaneLLL

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