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.
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.
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.
Use ffmpeg library for encoding your stream and use RTP/RTSP stack to stream them.
精彩评论