1

我使用 GET nphMotionJpeg 从 IP Camera Panasonic 获取 Motion Jpeg 流。响应内容在下面的文档中进行了描述。

(2) Data reception 
    "HTTP/1.0 200 OK\r\n" 
    "Content-Type: multipart/x-mixed-re place; bound ary=--myboundary..." 
    "...--myboundary.Content-type: image/jpeg..." 
    JPEG binary data No. 1 (Hexadecimal notation="FFD8...... ........................ ..FFD9") 
    "...--myboundary.Content-type: image/jpeg..." 
    JPEG binary data No. 2 (Hexadecimal notation="FFD8...... ........................ ..FFD9") 
    : 
    : 
    "...--myboundary.Content-type: image/jpeg..." 
    JPEG binary data No. N (Hexadecimal notation="FFD8...... ........................ ..FFD9") 

    * Above mentioned  Content-type: From FFD8(following image/jpeg) to "--my boundary" (just before FFD9) 
    is 1 JPEG data file. 

    (3) Image displaying/saving 
    From the data above, extract JPEG  data, and display the extracted consecutively or save it. 
    A viewer that supports the above data is required to view images. 

我在尝试从上述响应内容中提取 jpeg 图像数据时遇到的问题是它不让我知道每个图像的大小。

当没有图像大小时,这很难处理。

我必须尝试编写一个算法来做到这一点,但我太老练了。它可能会影响系统性能,并且可能存在更多错误。

你能建议我一个简单的方法吗?

4

2 回答 2

0

使用 Gstreamer。请参阅上面由 Martin Beckett 链接的我的完整帖子。

gst-launch souphttpsrc location="http://[ip]:[port]/[dir]/xxx.cgi" do-timestamp=true is_live=true ! multipartdemux ! jpegdec !  videoflip method=vertical-flip ! jpegenc !  multifilesink location=image-out-%05d.jpg
于 2012-03-29T20:27:36.597 回答
0

一些 [更好的] IP 摄像机Content-Length在每个 JPEG 视频帧中都提供子标题,但是这个标题不是强制性的,这在您的情况下会成为一个问题:您事先没有 JPEG 数据长度。

除了继续读取缓冲区并检查是否接收到新的边界线之外,您无能为力,您将在此处切断视频帧。您可能还想检查缓冲区溢出。

仅供参考,一些较旧的 Panasonic(如 BL-C140)和 Axis(如 213 PTZ)摄像机格式不正确,混淆--了边界部分。

于 2012-02-12T10:54:39.527 回答