--ipcamera Content-Type: image/jpeg Content-Length: 46056 JFIF header data ... lots of data ...
每个“框架”都会重复这种模式.
这是一种“标准”流媒体格式,我可以用某些东西进行播放/转码,还是一些强制进入我浏览器的JPEG集合,只是尽可能快地渲染它们?
我尝试使用VLC,但无法处理URL.
我的IP cam中的软件非常糟糕,所以我想捕获这个流并在我的Linux机器上处理它.我可以使用一些ffmpeg / mplayer工具来做这个吗?
解决方法
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==
你能发布数据的最开头吗?
有很多库可以使用MIME multipart.我想,您应该找到JS库来解析MIME-multipart并将其传递给浏览器的动态DOM.或者,您可以使用带有MIME支持的perl或其他脚本,并从此流中获取jpeg.
更新:
实际上,这是“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”.
以下是此格式生成http://nakkaya.com/2011/03/23/streaming-opencv-video-over-the-network-using-mjpeg/的一个示例 – 它非常适合您.
这是一个python客户端:http://code.google.com/p/python-mjpeg-over-http-client/