Does nvv4l2h265enc support lossless?

Hello, people in charge.

I am currently using Jetson AGX Xavier to encode raw data into .h265.
I am wondering that does nvv4l2h265enc support lossless enconing?

Thank you very much.

Hi, We support it on Jetpack 4.6. Please refer to the command:

gst-launch-1.0 filesrc location=test.yuv ! videoparse
width=352 height=288 format=52 framerate=30 ! 'video/x-raw, format=(string)NV24'
! nvvidconv ! 'video/x-raw(memory:NVMM), format=(string)NV24' !
nvv4l2h265enc profile=High444 ! h265parse ! filesink location=test_yuv444.265

For lossless only YUV444 is supported.

Thank you very much. That’s really helpful.
Can I ask one more question?

Can I use PC to decode the .265 file that encoded in Jetson? Is there a method that we can convert ‘video/x-raw(memory:NVMM)’ to ‘video/x-raw’ on PC?

Thank you.

On PC, you can use software decoder such as avdec_h265 to get video/x-raw buffer.

video/x-raw(memory:NVMM) is hardware DMA buffer. The type is only supported and works on Jetson platforms.

The reason that I ask this question is:
After I used avdec_h265 to decode the .265 file that encoded in Jetson and compared with the original input data which has been saved before the encoding process. The result show the two files are not same.
However, If I use nvv4l2decoder and do the backward process, the result shows same.
Please find the commands below.
gst-launch-1.0 filesrc location=test_yuv444.h265 !
h265parse ! avdec_h265 ! filesink location=test_output.yuv
I compared the test.yuv and test_output.yuv with ‘cmp’ command. The result shows two files are not same.

Could you please give me some suggestion?

It sounds like avdec_h265 does not decode the stream correctly. As comparison, could you try ffmpeg command:

$ ./ffmpeg -i test_yuv444.h265 ffmpeg_output.yuv

Both are software decoders but implementation is different. This can clarify if the issue is specific to avdec_h265.

Thank you for your kindness.
I tried the ffmpeg command and the output of decoding h265 file is different from the original one. It seems like the ffmpeg does not support NV24 format as well as avdec_h265.
Is there an option for ffmpeg that can determine the format of output?
Thank you very much.

The decoded YUV data should be in YUV444. Please do conversion:

gst-launch-1.0 filesrc location=test.yuv ! videoparse width=352 height=288 format=52 framerate=30 ! video/x-raw, format=(string)NV24 ! videoconvert ! video/x-raw,format=Y444 ! filesink location=test_1.yuv

And compare with test_1.yuv.

1 Like

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