Ask Your Question
0

How do i use videowriter with ffmpeg for streaming?

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

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);

edit retag flag offensive close merge delete

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 ( 2018-03-03 01:54:08 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
3

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

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
0

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

supra56 gravatar image
CAP_FFMPEG
edit flag offensive delete link more

Question Tools

1 follower

Stats

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

Seen: 3,381 times

Last updated: Mar 03 '18