As you can see it uses BGR format which is wrong, because the numpy arrays I have contain data represented as RGB. So the resulting video has blue and red channels swapped. I tried modifying the definition to be:
Well, many gstreamer elements would determine what processing to do depending on the SINK (input) and SRC (output) caps.
My proposal breaks this, using multpartmux/multipartdemux for changing the caps without changing buffers…this is not clean.
Though, in your case, appsrc is sending RGB buffer with BGR caps, so this trick is just intended to restore coherency.
Final note:
If your case has fixed resolution (should be the case with an opencv VideoWriter), you may save the multipart mux/demux overhead using capssetter instead:
! capssetter replace=true caps=video/x-raw,format=RGB,width=<your_width>,height=<your_height>, ... specify any non standard framerate, pixel-aspect-ratio, ...