H264\265 encode hardware accelerate on AGX Orin

i want encode a raw file to H264 or H265, so i try some methods as follow:

  1. ffmpeg, refer to Hardware accelerated Ffmpeg on Jetson - Jetson & Embedded Systems / Jetson TX1 - NVIDIA Developer Forums, i build a ffmpeg with nvmpi on Orin, it run h264/265 encode success, but the fps is only 14fps, it is too slow; and in jtop, the NVENC is runing and freq is about 704MHz.
    ffmpeg command:
ffmpeg -vcodec rawvideo -f rawvideo -pix_fmt bayer_rggb16 -s 3840*2160 -i cam-0.raw -f hevc -frames:v 2000 -c:v hevc_nvmpi test.h265 -y

2.jetson_multimedia_api samples, i run sample 01_video_encode and 15_multivideo_encode, get same result, encode 2000 frames raw data to H265 use 55 sec, about 36fps; in jtop, NVENC min freq is 665Mhz, max freq is 998Mhz.

3.gtreamer, the test command as follow:

gst-launch-1.0 filesrc location=cam-0.raw blocksize=24834048 ! video/x-raw,format=NV12, framerate=29/1,width=4128,height=3008 ! nvv4l2h265enc ! filesink location=out.265

run fail ,and get message:

WARNING: erroneous pipeline: could not link filesrc0 to nvv4l2h265enc0, nvv4l2h265enc0 can’t handle caps video/x-raw, format=(string)NV12, framerate=(fraction)29/1, width=(int)4128, height=(int)3008

1.whether it is ffmpeg 14fps or jetson_multimedia_api sample 36fps, it is not a expected result.how can increase the frame rate of encode?

2.how to use the gstreamer for encode a raw file to H265?

Please give me some advise, Thanks.

Hi,
This looks expected. The encoder supports YUV420/NV12 as input format, so the Bayer data has to be converted into YUV420/NV12. This is done on CPU cores so performance is impacted. The optimal solution is to use hardware ISP engine to get YUV420 data if your camera source is connected to CSI ports.

In gstreamer, you may try the plugins listed in bayer

Same as in jetson_multiemdia_api, the conversion is done through CPU so performance may be impacted.

1.i want to know how to use bayer2rgb, use the command:

gst-inspect-1.0 --gst-debug-level=4 bayer2rgb

the result:

No such element or plugin ‘bayer2rgb’

2.the nvv4l2h265enc0 run fail, what should i do?

Hi,
We run the commands on Jetpack 5.1.1 and can see the plugins show up:

$ rm .cache/gstreamer-1.0/registry.aarch64.bin
$ gst-inspect-1.0 bayer2rgb
1 Like

hi,

after re-install the gst, the bayer2rgb can be found now;

and transform raw to yuv data, then run ffmpeg with nvmpi, the frame rate is 18fps.

ffmpeg -vcodec rawvideo -f rawvideo -pix_fmt nv12 -s 3840*2160 -i cam-0.yuv -f hevc -frames:v 2000 -c:v hevc_nvmpi test.h265 -y

how can i increase the encode frame rate?

and the gst encode is not work, please give me some advise.

gst-launch-1.0 filesrc location=cam-0.yuv blocksize=24834048 ! video/x-raw,format=NV12, framerate=29/1,width=4128,height=3008 ! nvv4l2h265enc ! filesink location=out.265

Hi,
Please try with videoparse plugin like:

gst-launch-1.0 filesrc location=cam-0.yuv ! videoparse format=nv12 width=4128 height=3008 ! video/x-raw,format=NV12 ! nvvidconv ! nvv4l2h265enc ! filesink location=out.265
1 Like

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