xakepp35
xakepp35

Reputation: 3262

how to get raw mjpg stream from webcam

I have logitech webcam, which streams 1080p@30fps using MJPG compression via USB2.0. I need to write this raw stream to hard drive or send via network. I do NOT need to decompress it. OpenCV gives me decompressed frames, so i need to compress them back. This leads to heavy CPU utilization waste. How to get raw MJPEG stream instead as it comes from camera? (Windows 7, Visual Studio, C++)

Upvotes: 0

Views: 1994

Answers (1)

Roman Ryltsov
Roman Ryltsov

Reputation: 69724

Windows native video capture related APIs DirectShow and Media Foundation let you capture video from a webcam in original format. It is a natural task for these APIs and is done in a straightforward way (specifically, if a web camera gets hardware compressed M-JPEG feed, you can have that programmatically).

You are free to do whatever you want with the data afterwards: decompress, send over network, compose a Motion JPEG over HTTP response feed etc.

Upvotes: 1

Related Questions