Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Capturing video from a MJPEG stream using C++

I would like to capture a MJPEG stream using C++. Which options do I have? I have tried OpenCV with FFMPEG support but icvCreateFileCapture_FFMPEG_p is always returning null (after a few seconds of timeout). May I program a HTTP client by myself?

Regards,

like image 779
Didac Perez Parera Avatar asked Oct 15 '12 17:10

Didac Perez Parera


People also ask

Can VLC play MJPEG?

VLC can play MJPEG files.

Is MJPEG better than h264?

If you require synchronized audio and video then H. 264 is the clear choice. For most security surveillance and remote monitoring applications the MJPEG compression technology is the best choice.

How do I watch MJPEG stream?

How to open the stream? The machinery will start a MJPEG stream on 8889, when the capture device is created succesfully. You can open the stream by browsing to your IP-address followed by the port number; e.g. http://192.168.0.11:8889.

What is MJPEG Webcam?

Motion JPEG (M-JPEG or MJPEG) is a video compression format in which each video frame or interlaced field of a digital video sequence is compressed separately as a JPEG image.


1 Answers

M-JPEG is easy to capture. You send one HTTP request to the server and read back infinite response in multipart/x-mixed-replace format (Content-Type). Then you split it into frames, which are self-contained JPEG files... Subheaders might or moight not contain additional information such as timestamps.

You might find this relevant and useful as well: How to parse MJPEG HTTP Stream within C++?

like image 71
Roman R. Avatar answered Sep 30 '22 05:09

Roman R.