This GStreamer element lets you call into OpenCV, do your magic, and write back out ot GStreamer. I included the standard 1-kernel Sobel filter just to get you up and running.
I needed to make an RTSP server consisting of mutliple UDP video feeds that be inferenced at 30fps using non-hardware-specific libraries (e.g, DeepStream).
There are roughly 50,000+ OpenCV "streaming" projects that dribble out >1 fps using CV2/Python/Flask
OpenCV doesn't support writing to a video stream easily (AFAIK, please let me know if I'm wrong!)
GStreamer is waaaay more fleixble than VLC and FFMPEG for what I need.
This was compiled on Ubuntu 16.04, GStreamer 1.17.0, OpenCV 188.8.131.52, g++ 5.4.0.