How to get I420_12LE into memory:NVMM?

Hello!

I am trying to encode a I420_12LE video with H264 on Jetson Nano, using r32.2 drivers.

I checked the hardware-accelerated encoder elements with gst-inspect-1.0 to find that none of them support I420_12LE as input. https://developer.nvidia.com/embedded/dlc/l4t-accelerated-gstreamer-guide-32-1 specifies that it is possible to convert from I420_12LE to I420 with hardware acceleration though, if I420_12LE comes from video/x-raw(memory:NVMM).

However, after going through all elements that support I420_12LE, I haven’t found one that is has source capability video/x-raw(memory:NVMM) with format I420_12LE. videoconvert is listed as having capability video/x-raw(ANY) with format I420_12LE, but the following pipeline fails:

gst-launch-1.0 filesrc location=akiyo_qcif_12le.yuv ! \ 
        videoparse width=176 height=144 framerate=25/1 format=i420-12le ! \ 
        videoconvert ! 'video/x-raw(memory:NVMM)' ! \ 
        nvvidconv ! 'video/x-raw(memory:NVMM), format=(string)I420' ! \ 
        nvv4l2h264enc ! 'video/x-h264, stream-format=(string)byte-stream' ! \ 
        h264parse ! qtmux ! filesink location=akiyo_qcif_h264.mp4 -e

with the message “WARNING: erroneous pipeline: could not link videoconvert0 to nvvconv0, videoconvert0 can’t handle caps video/x-raw(memory:NVMM)”

I have additionally tried removing all format specifications:

gst-launch-1.0 filesrc location=akiyo_qcif_12le.yuv ! \ 
        videoparse width=176 height=144 framerate=25/1 format=i420-12le ! \ 
        videoconvert ! nvvidconv ! \ 
        nvv4l2h264enc ! 'video/x-h264, stream-format=(string)byte-stream' ! \ 
        h264parse ! qtmux ! filesink location=akiyo_qcif_h264.mp4 -e

and then it failed with the following error message:

NvDdkVicConfigure Failed
nvbuffer_transform Failed
gst_nvvconv_transform: NvBufferTransform Failed
ERROR: from element /GstPipeline:pipeline0/GstVideoParse:videoparse0/GstRawVideoParse:inner_rawvideoparse: Internal data stream error.
Additional debug info:
gstbaseparse.c(3611): gst_base_parse_loop (): /GstPipeline:pipeline0/GstVideoParse:videoparse0/GstRawVideoParse:inner_rawvideoparse:
streaming stopped, reason error (-5)
ERROR: pipeline doesn’t want to preroll.

The I420_12LE video was created with the following pipeline:

gst-launch-1.0 filesrc location=akiyo_qcif.yuv ! \
        videoparse width=176 height=144 framerate=25/1 format=i420 ! \
        videoconvert ! 'video/x-raw, format=I420_12LE' ! \
        filesink location=akiyo_qcif_12le.yuv -e

What am I missing here? Is there perhaps some other way to achieve I420_12LE -> H264 encoding with hardware acceleration?

Thanks in advance!

Hi,
Hardware encoder of Jetson Nano does not support 12bit YUV420. You have to convert it to 8-bit. The following pipeline is with videotestsrc:

$ gst-launch-1.0 videotestsrc num-buffers=300 ! video/x-raw,format=I420_12LE ! videoconvert ! <b>video/x-raw,format=I420</b> ! nvvidconv ! nvv4l2h264enc ! h264parse ! qtmux ! filesink location=a.mp4

Below pipeline should work:

gst-launch-1.0 filesrc location=akiyo_qcif_12le.yuv ! \ 
        videoparse width=176 height=144 framerate=25/1 format=i420-12le ! \ 
        videoconvert ! <b>'video/x-raw,format=I420'</b> ! \ 
        nvvidconv ! 'video/x-raw(memory:NVMM), format=(string)I420' ! \ 
        nvv4l2h264enc ! 'video/x-h264, stream-format=(string)byte-stream' ! \ 
        h264parse ! qtmux ! filesink location=akiyo_qcif_h264.mp4 -e

I see, thanks for an answer!