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 -


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 ?


Hi dumbogeorge,
On OpenCV 3.3, it supports NV12/I420 in appsink:

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