1

My current application reads frame by frame from RTMP stream using cv::VideoCapture, makes some modifications in each frame and write these modified frames into the file using cv::VideoWriter. Now I need put these frames into the new RTMP stream instead of file. Can anybody explain me how I can do it? Currently I use gcc5 and OpenCV 2.4.13.

Hermann
  • 247
  • 2
  • 18
  • See http://stackoverflow.com/questions/23556382/opencv-and-rtmp – Martin Beckett Dec 16 '16 at 04:57
  • librtmp doesn't solve my problem because it can translate data in FLV formatonly, e.g. I can firstly make FLV file using my frames, than translate it but I need live translation without time delay – Hermann Dec 16 '16 at 06:40
  • Possible duplicate of [OpenCV and RTMP](https://stackoverflow.com/questions/23556382/opencv-and-rtmp) – mpour Mar 30 '18 at 06:30

1 Answers1

0

Use the ffmpeg command with option '-i -', this option specifies that ffmpeg takes input from the pipe. Standard input is piped to the ffmpeg command so simply pushing the images to the standard input will do.

command = 'ffmpeg -i - -f flv [streaming_url]'

import subprocess as sp

proc = sp.Popen(command, stdin=sp.PIPE,shell=False)
proc.stdin.write(frame.tostring())

Find the equivalent in c++, to run the command and to write to standard input.

Mehul Jain
  • 468
  • 4
  • 12