First time here? Check out the FAQ!

Ask Your Question
0

How do i use videowriter with ffmpeg for streaming?

asked Mar 2 '18

denis.istu gravatar image

Documentation at https://docs.opencv.org/master/d0/da7... states, that "OpenCV can use the FFmpeg library (http://ffmpeg.org/) 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://127.0.0.1:5000

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; writer.open("appsrc ! etc...", cv::CAP_GSTREAMER, fourcc, fps, size);

Preview: (hide)

Comments

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 (Mar 3 '18)edit

2 answers

Sort by » oldest newest most voted
3

answered Mar 3 '18

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.

Preview: (hide)
0

answered Mar 3 '18

supra56 gravatar image
CAP_FFMPEG
Preview: (hide)

Question Tools

1 follower

Stats

Asked: Mar 2 '18

Seen: 3,895 times

Last updated: Mar 03 '18