AGX Orin hardware accelerated ffmpeg

Hi, I’m trying to enable ffmpeg hardware acceleration in AGX orin. I have tried the following guides:
https://docs.nvidia.com/video-technologies/video-codec-sdk/ffmpeg-with-nvidia-gpu/

Using the example test command:

ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 -c:v h264_nvenc -b:v 5M output.mp4

I get the following output:

ffmpeg version N-109417-g5a46647f00 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: --enable-nonfree --enable-cuda-nvcc --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --disable-static --enable-shared
  libavutil      57. 43.100 / 57. 43.100
  libavcodec     59. 55.100 / 59. 55.100
  libavformat    59. 34.102 / 59. 34.102
  libavdevice    59.  8.101 / 59.  8.101
  libavfilter     8. 52.100 /  8. 52.100
  libswscale      6.  8.112 /  6.  8.112
  libswresample   4.  9.100 /  4.  9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/orin/factorymonitor/samples/arsenal.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.45.100
  Duration: 00:00:21.90, start: 0.000000, bitrate: 1274 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 608x1080 [SAR 1:1 DAR 76:135], 1142 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
      vendor_id       : [0][0][0][0]
File 'output.mp4' already exists. Overwrite? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_nvenc))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[h264 @ 0xaaaaf8144340] Cannot load libnvcuvid.so.1
[h264 @ 0xaaaaf8144340] Failed loading nvcuvid.
[h264 @ 0xaaaaf8144340] Failed setup for format cuda: hwaccel initialisation returned error.
[h264_nvenc @ 0xaaaaf7b2df50] Cannot load libnvidia-encode.so.1
[h264_nvenc @ 0xaaaaf7b2df50] The minimum required Nvidia driver for nvenc is 520.56.06 or newer
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
[aac @ 0xaaaaf7b2e930] Qavg: 26316.979
[aac @ 0xaaaaf7b2e930] 2 frames left in the queue on closing
Conversion failed!

This document suggest that agx orin has nvenc/nvdec.
Help would be appreciated.

2 Likes

Hi,
Please refer to document and relevant topics:
Accelerated Decode with ffmpeg — Jetson Linux<br/>Developer Guide 34.1 documentation
Jetson TX2 and FFmpeg - Can't initialize nvrm channel - #5 by DaneLLL
Hardware accelerated video playback with L4T ffmpeg - #7 by DaneLLL

Hardware decoding is enabled in the package.

What about encoding? I’m mostly interested in generating videos from frames with hardware acceleration.

Hi,
We enable hardware decoding in the ffmpeg package. Foe hardware encoding, you may try to use jetson_multimedia_api. Please take a look at the samples:

/usr/src/jetson_multimedia_api/samples/01_video_encode
/usr/src/jetson_multimedia_api/samples/unittest_samples/encoder_unit_sample/

Okay, thank you for your help. Another question is can g-streamer do the same things? We might not be able to go low level programming. I found this. Would that make use of hardware accelaration?

Hi,
We have developed v4l2 plugins for hardware encoding/decoding. Please take a look at gstreamer user guide:
Accelerated GStreamer — Jetson Linux<br/>Developer Guide 34.1 documentation

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