Converting video from RGB to YUV 4:2:0 from the jetson utilities library to encode with nvjpeg

Hi,

The archetiecture of our project has been created around the jetson utilities libraries and the video capture method:

This method returns an RBG array in a uchar3 format. I would now like to capture certain frames from this using the nvjpeg hardware (we are using a Xavier NX). What’s the best way to do this? The multimedia library only accepts yuv as an input, so I tried using colorConvert in the utilities library. This seems to work and I get output, but occationally I am getting a segfault from the nvjpeg library, as well as the following in the nvjpeg library when attempting to resize:

[502680.069054] nvidia_smmu_context_fault_bank: 3 callbacks suppressed
[502680.069105] arm-smmu 12000000.iommu: Unhandled context fault: fsr=0x80000402, iova=0x3ff2760000, fsynr=0x220003, cbfrsynra=0x438, cb=9
[502680.069693] arm-smmu 12000000.iommu: Unhandled context fault: fsr=0x80000402, iova=0x3ff2761000, fsynr=0xe0003, cbfrsynra=0x438, cb=9

I also see this in the documentation:

YUV NV12, YUYV, YVYU, and UYVY can only be converted to RGB/RGBA (not from)

Does this still hold true that you cannot go from RGB->YUV? I seems like the code is there to do this:

If this does work, what size/type should the memory allocation be for output?

Anyhow, if someone could point me to the best way from uchar3 RGB to nvjpeg encoding that would be helpful.

Hi @catch22, looks like you are correct and I have some kernels for limited conversion from RGB->YUV formats in there for I420 / NV12. Those are 12 bits per pixel iirc, you would allocate them as a void pointer and calculate the size.

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