Attention! This forum will be made read-only by Dec-20. Please migrate to Most of existing active users should've received invitation by e-mail.
Ask Your Question

How do i use videowriter with ffmpeg for streaming?

asked 2018-03-02 03:56:53 -0500

denis.istu gravatar image

Documentation at states, that "OpenCV can use the FFmpeg library ( as backend to record, convert and stream audio and video".

I wonder how can i use ffmpeg as backend to stream video? for example i have ffmpeg command that works if i pipe cv::Mat from program stdout to ffmpeg stdin

myprogram.exe | ffmpeg -f rawvideo -pixel_format bgr24 -video_size 640x480 -framerate 30 -i - -vcodec libx264 -tune zerolatency -b 6000k -f mpegts udp://

so how can i shortcut it and have same pipe inside myprogram? for example for CAP_GSTREAMER one can write gstreamer pipe in videowriter cv::Videowriter writer;"appsrc ! etc...", cv::CAP_GSTREAMER, fourcc, fps, size);

edit retag flag offensive close merge delete


to my knowledge, only the gstreamer backend support pipelines, not the ffmpeg one.

(which means, you ''d have to compile opencv libs with gstreamer support builtin)

berak gravatar imageberak ( 2018-03-03 01:54:08 -0500 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2018-03-03 08:17:47 -0500

BAHRAMUDIN ADIL gravatar image

With FFMPEG you can read the stream on the network, but not support to write the stream back to the network, so you can use GStreamer for streaming video to a network.

edit flag offensive delete link more

answered 2018-03-02 22:15:14 -0500

supra56 gravatar image
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-03-02 03:56:53 -0500

Seen: 1,403 times

Last updated: Mar 03 '18