Encode opencv frames

Hi Folks

I am looking to dump my opencv output to encoder - for creation of compressed bitstream. I looked around jetson forums and found this -

https://devtalk.nvidia.com/default/topic/1004096/opencv-frames-to-gstreamer-pipeline/

The command line given in aforesaid link is :

VideoWriter m_videoWriter;

m_videoWriter.open("appsrc ! autovideoconvert ! omxh265enc ! matroskamux ! filesink location=test.mkv ", 0, (double)30, cv::Size(1920, 1080), true);

This looks syntatically correct and generates a bitstream for me. However, my data is in YUV420 format, and it resides in three individual cv::Mat (each for Y, U and V - size of U and V cv::Mat is half of cv:Mat for Y). Could someone please help in adapting the VideoWriter above to encode data from my matrices - cv::Mat imgY, imgU, imgV ?

Thanks

Hi dumbogeorge,
On OpenCV 3.3, it supports NV12/I420 in appsink:
https://devtalk.nvidia.com/default/topic/1024245/jetson-tx2/opencv-3-3-and-integrated-camera-problems-/post/5210735/#5210735

Not sure if it is the same for appsrc, you may give it a try.