Hi, I am new here, I am facing a challenge with PyNvVideoCodec. Documentation says PyNvVideoCodec can decode frame in various color formats. Generally, it works fine with NV12format but lately I have been testing with 4K HDR10 video sample. PyNvVideoCodec can decode it in P016 format but after which my code fails:
with open(out_file_path, "wb") as nvcFile:
for packet in demuxer:
for decode2d in nvdec.Decode(packet):
img2d = nvcv.as_image(decode2d.nvcv_image(), nvcv.Format.U8)
ten2d = nvcv.as_tensor(img2d)
if ten2d.layout == "NCHW":
yuv_batch = cvcuda.reformat(ten2d, "NHWC", stream=cvcuda_stream)
else:
yuv_batch = ten2d
for NV12 format, I can use the yuv_batch to load into:
cvcuda.cvtcolor_into(rgb_out, yuv_batch, cvcuda.ColorConversion.YUV2RGB_NV12, stream=cvcuda_stream)
However, with P016 frame format, I am facing this error:
PyNvVCExceptionUnsupported Traceback (most recent call last)
Cell In[3], line 158
155 break
156 for decode2d in frames:
--> 158 img2d = nvcv.as_image(decode2d.nvcv_image(), nvcv.Format.U8)
159 ten2d = nvcv.as_tensor(img2d)
160 if ten2d.layout == "NCHW":
PyNvVCExceptionUnsupported: operator() :
Error code : 801
Error Type : only nv12 and yuv444 supported as of now
at /project/src/PyNvVideoCodec/src/PyNvDecoder.cpp:539
Which brings me to the part that if nvcv_image() only supports NV12 and YUV444, how do I work with the remaining formats supported by the decoders: P016, YUV444_16Bit, NV16 & P216? perhaps there is a workaround to convert this formats to NV12for CVCUDA operations?