Streaming video using C ++

I am going to create a C ++ application that creates a stream of photos and then sends them as a video stream to another application. any ideas on how i can start? What do I mean, which libraries should I use and what is the encoding? I am thinking of MJPEG, UDP or RTP as a protocol .... any help would be greatly appreciated.

+6
c ++ video streaming
source share
3 answers

If your input is just a bunch of random images, not videos, you are not going to make "streaming video." You are just about to send a bunch of full images. No need to use video encoding technology, just the simplest image transfer. Video encoders rely on each frame, which has a different relationship with the previous one, as is usually the case in real video. For random image inputs, they will not be able to compress so much, and single-frame compression (such as JPEG / PNG / independently) will most likely already be applied to your input data.

It is probably easiest to send the contents of each file along with the original file name, and the receiving client will re-create the file on disk and open and decode the image using existing disk libraries.

You probably just need to use TCP for this, there is nothing in your requirements indicating the need for more complex and error-prone UDP / RTP based solutions.

+5
source share

For streaming you can use Live555 . It should cover everything you need. This still leaves the problem of generating an MJpeg stream. I can only guess FFMpeg might be what you are looking for (as I see it also covers streaming, so you may only need this one). I think MJpeg is very suitable for you. As for TCP or UDP, it depends on how you want to use it. UDP makes sense if you want to make your own Multicast stream, otherwise I would prefer TCP because it is more reliable.

We hope these are helpful tips.

+5
source share

Use the ffmpeg library to encode your stream and use the RTP / RTSP stack to stream it.

0
source share

All Articles