Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Video streaming using c++

I'm going to build an application in c++ that creates stream of photos and then sends them as video stream to another application. any ideas about how can i start? what I mean is, what libraries should i use and what the encoding? I'm thinking about MJPEG, and UDP or RTP as protocol.... any help would be greatly appreciated.

like image 949
Amer Avatar asked Dec 01 '09 10:12

Amer


People also ask

How can we stream stored audio video?

A compressed audio/video file can be downloaded as a text file. The client (browser) can use the services of HTTP and send a GET message to download the file. The Web server can send the compressed file to the browser. The browser can then use a help application, normally called a media player, to play the file.

How is video transmitted over Internet?

How does streaming work? Just like other data that's sent over the Internet, audio and video data is broken down into data packets. Each packet contains a small piece of the file, and an audio or video player in the browser on the client device takes the flow of data packets and interprets them as video or audio.


2 Answers

If your input data is just a bunch of random images, not video, you're not going to do "video streaming". You're just going to be sending a bunch of full images. No need to involve video encoding technology, just do the simplest possible transmission of images. Video encoders rely on each frame having various relationships to the previous, as is common in actual video. For inputs of random images, they're not going to be able to compress that much, and single-frame compression (e.g. JPEG/PNG/whatever) is very likely already going to be applied to your input data.

Probably easiest to send the contents of each file, together with the original filename, and have the receiving client re-create the file on disk, and use existing disk-oriented libraries to open and decode the image.

You should probably just use TCP for this, nothing in your requirements that indicate you need to use the more complicated and error-prone UDP/RTP-based solutions.

like image 73
unwind Avatar answered Oct 11 '22 19:10

unwind


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

Hope these are some useful hints.

like image 21
Björn Pollex Avatar answered Oct 11 '22 19:10

Björn Pollex