开发者

What format is this JPEG stream from my cheap Chinese IP webcam?

I've got a cheap Chinese IP webcam that has a web interface showing live video. The video appears to be a sequence of jpeg images fed into the browser. If I point wget at the URL http://my-ip-camera/video.cgi I receive a big chunk of streamed data in the following format:

--ipcamera
Content-Type: image/jpeg
Content-Length: 46056

JFIF header data
... lots of data ...

this pattern repeats for every "frame".

Is this some "standard" streaming format I can play/transcode with something, or is it some made up collection of JPEGs forced into my browser that just renders them as quick as it can?

I tried using VLC but it couldn't process the URL.

The software in my IP cam is pretty terrible, so I want to capture this stream and process it on my Linux machine instead. Is there some collection of ff开发者_StackOverflowmpeg/mplayer tools I can use to do this?


Looks like MIME multipart with "ipcamera" as boundary.

http://en.wikipedia.org/wiki/MIME#Multipart_messages

MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="frontier"

This is a message with multiple parts in MIME format.
--frontier
Content-Type: text/plain

This is the body of the message.
--frontier
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64

PGh0bWw+CiAgPGhlYWQ+CiAgPC9oZWFkPgogIDxib2R5PgogICAgPHA+VGhpcyBpcyB0aGUg
Ym9keSBvZiB0aGUgbWVzc2FnZS48L3A+CiAgPC9ib2R5Pgo8L2h0bWw+Cg==

Can you post the very beginning of data?

There are a lot of libraries to work with MIME multipart. I think, you should find JS library to parse MIME-multipart and pass it into dynamic DOM of browser. Or you can use perl or other scripting with MIME support and get jpegs from this stream.

UPDATE:

actually, this is the "M-JPEG over HTTP" http://en.wikipedia.org/wiki/Motion_JPEG#M-JPEG_over_HTTP

The server software mentioned above streams the sequence of JPEGs over HTTP. A special mime-type content type multipart/x-mixed-replace;boundary= informs the browser to expect several parts as answer separated by a special boundary. This boundary is defined within the MIME-type. For M-JPEG streams the JPEG data is sent to the client with a correct HTTP-header. The TCP connection is not closed as long as the client wants to receive new frames and the server wants to provide new frames. Two basic implementations of such a server are test-server "cambozola" and webcam server "MJPG-Streamer".

Here is an example of this format generation http://nakkaya.com/2011/03/23/streaming-opencv-video-over-the-network-using-mjpeg/ - it is exaclty what you have.

Here is a python client: http://code.google.com/p/python-mjpeg-over-http-client/


Sounds like Motion JPEG, or at least some variant thereof.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜