How to capture the camera(YUV422) to encode H264

I have a yuv422 camera and can display on the screen. But When I throw the data to the encoder, The encoder seems to not work. Is there any example about capture the image(yvu422 v4l2) then encode it? I am using multimedia.

Have a check this document for encode and modify the source sink to v4l2src

I know. gst command is ok. But I am using multimedia api. Is multimedia not supported by offical?

Check the …/jetson_multimedia_api/samples/10_camera_recording sample code.
Install the multimedia API sample code by below command.

sudo apt list -a nvidia-l4t-jetson-multimedia-api
sudo apt install