views:

761

answers:

3

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.

+2  A: 

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.

unwind
The exception is "Motion JPEG" (MJPEG) which is really just a sequence of JPEG compressed frames with a small header on each one. My Canon digital camera captured videos in this format.
Greg Hewgill
The difference between bunch of images and video stream (except for type of compression) is that in video stream you have time synchronization.
Kirill V. Lyadvinsky
A: 

Use ffmpeg library for encoding your stream and use RTP/RTSP stack to stream them.

Himanshu
+1  A: 

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 ehat 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 that are some usefull hints.

Space_C0wb0y