How to open a GStreamer pipeline from OpenCV with VideoWriter

Before using OpenCV’s Gstreamer API, we need a working pipeline using the Gstreamer command line tool. Sender: The OP is using JPEG encoding, so this pipeline will be using the same encoding. gst-launch-1.0 -v v4l2src \ ! video/x-raw,format=YUY2,width=640,height=480 \ ! jpegenc \ ! rtpjpegpay \ ! udpsink host=127.0.0.1 port=5000 Receiver: The sink caps for rtpjpegdepay … Read more

Write opencv frames into gstreamer rtsp server pipeline

I found the solution, lots of stuff was missing. I used the need-data signal like the examples of gst-rtsp-server. I changed some default parameters of appsrc, like the is-live, block and format. The caps on the appsrc element. I was not setting the offset of the buffer correctly. Here’s the code for anyone who’s facing … Read more

MediaCodec and Camera: colorspaces don’t match

I solved it by swapping the byteplanes myself on Android level, using a simple function: public byte[] swapYV12toI420(byte[] yv12bytes, int width, int height) { byte[] i420bytes = new byte[yv12bytes.length]; for (int i = 0; i < width*height; i++) i420bytes[i] = yv12bytes[i]; for (int i = width*height; i < width*height + (width/2*height/2); i++) i420bytes[i] = yv12bytes[i … Read more