Hello,<br><br>I want to display with wxPython the images sent by an ip camera.<br><br>Getting the photos is not a problem: <br>page = urllib2.build_opener().open(&quot;<a href="http://192.168.1.3/Jpeg/CamImg.jpg" target="_blank">http://192.168.1.3/Jpeg/CamImg.jpg</a><div style="display: inline; cursor: pointer; padding-right: 16px; width: 16px; height: 16px;">
 </div><div style="display: inline; padding-right: 16px; width: 16px; min-height: 16px;">
 </div>&quot;)<br>
image = Image.open(cStringIO.StringIO(page.read()))<br>Then I display the images one by one with wx with a loop (4 to 8 Frames Per<br>Second, which is not quick enough). But it works well.<br><br>What I&#39;d like to do is to display the frames in a continous mode, ie &#39;movie&#39;.<br>


The problem is that I can&#39;t manage to analyze the stream sent by the camera<br>whose address is: &#39;<a href="http://192.168.1.3/GetData.cgi" target="_blank">http://192.168.1.3/GetData.cgi</a><div style="display: inline; cursor: pointer; padding-right: 16px; width: 16px; height: 16px;">
 </div><div style="display: inline; padding-right: 16px; width: 16px; min-height: 16px;">
 </div>&#39;<br><br>I tried to adapt the script mentioned here<br>
(<a href="http://thread.gmane.org/gmane.comp.python.general/449768" target="_blank">http://thread.gmane.org/gmane.comp.python.general/449768</a><div style="display: inline; cursor: pointer; padding-right: 16px; width: 16px; height: 16px;">
 </div><div style="display: inline; padding-right: 16px; width: 16px; min-height: 16px;">
 </div>) without success. See below.<br><br>My problem is that I don&#39;t know where to begin and where to stop the extraction<br>
of data (the stream of data is continous):<br>See the class below:<br>   boundary = self.buffer.find(r&quot;&quot;&quot;--IPCamBoundary&quot;&quot;&quot;)<br>   begin = boundary + 43<br>   end = self.buffer.rfind(r&quot;&quot;&quot;--IPCamBoundary&quot;&quot;&quot;)<br>


<br>I&#39;d appreciate that some help to understand what I should do.<br><br>Many thanks in advance for four help<br>Dominique<br><br><br><br>--------------------------------------------------------------------------<br>

Below is some info that may be needed with a view to helping me:<br>
&gt;&gt;&gt; stream = urllib2.urlopen(&#39;<a href="http://192.168.1.3/GetData.cgi" target="_blank">http://192.168.1.3/GetData.cgi</a><div style="display: inline; cursor: pointer; padding-right: 16px; width: 16px; height: 16px;">
 </div><div style="display: inline; padding-right: 16px; width: 16px; min-height: 16px;">
 </div>&#39;)<br>&gt;&gt;&gt; print <a href="http://stream.info/" target="_blank">stream.info</a><div style="display: inline; cursor: pointer; padding-right: 16px; width: 16px; height: 16px;"> </div><div style="display: inline; padding-right: 16px; width: 16px; min-height: 16px;">
 </div>()<br>Date: Sat, 01 Feb 2003 05:30:42 GMT<br>

<br>Server: WYM/1.0<br><br>Connection: close<br><br>Content-Type: multipart/x-mixed-replace;boundary=IPCamBoundary<br><br>Last-Modified: Sat, 01 Feb 2003 05:30:42 GMT<br><br>Pragma: no-cache<br><br>Cache-Control: no-cache<br>


<br>Expires: 01 Jan 1970 00:00:00 GMT<br><br><br>&gt;&gt;&gt; stream.readline()<br>&#39;--IPCamBoundary\r\n&#39;<br>&gt;&gt;&gt; stream.readline()<br>&#39;Content-Type: image/jpeg\r\n&#39;<br>&gt;&gt;&gt; stream.readline()<br>


&#39;\r\n&#39;<br>&gt;&gt;&gt; stream.readline()<br>&#39;\xff\xd8\xff\xe2\x00\x06&gt;;?b\xff\xe7\x00\x04\x00\x00\xff\xdb\x00C\x00\x04\x03\x03\x04\x03\x03\x04\x04\x04\x04\x05\x05\x04\x05\x06\n&#39;<br>&gt;&gt;&gt; and so on.<br>


I tried to attach the code returned by the camera  (with two &quot;--IPCamBoundary\r\n&quot;, which seem<br>to be the begining of a frame.) but it was rejected by the image-sig list...<br><br>-------------------------------------------------------------------------------<br>


Script:<br><br>class myCamera(object):<br>    def __init__(self, url = &#39;<a href="http://192.168.1.3/GetData.cgi" target="_blank">http://192.168.1.3/GetData.cgi</a><div style="display: inline; cursor: pointer; padding-right: 16px; width: 16px; height: 16px;">
 </div><div style="display: inline; padding-right: 16px; width: 16px; min-height: 16px;">
 </div>&#39;, param = None):<br>        self.url = url<br>        self.param = param<br>
        self.state = 0<br>        self.buffer = &#39;&#39;<br>        self.limit = 8092<br>        <br>    def Start(self):<br>        try:<br>            self.fp = urllib2.build_opener().open(self.url)<br>        except URLError:<br>


            print u&quot;&quot;&quot;Check connection&quot;&quot;&quot;<br>        self.state = True<br><br>    def Stop(self):<br>        self.fp.close()<br>        self.state = 0<br><br>    def NextFrame(self):<br>        if self.state:<br>


            temp = self.fp.read(self.limit)<br>            self.buffer += temp<br>            boundary = self.buffer.find(r&quot;&quot;&quot;--IPCamBoundary&quot;&quot;&quot;)<br>            count = self.buffer.count(r&quot;&quot;&quot;--IPCamBoundary&quot;&quot;&quot;)<br>


            if boundary &lt;&gt; -1:<br>                if count &gt; 1:<br>                    begin = boundary + 43<br>                    end = self.buffer.rfind(r&quot;&quot;&quot;--IPCamBoundary&quot;&quot;&quot;)<br>


                    buff = self.buffer[boundary:end-1]<br>                    output = cStringIO.StringIO()<br>                    output.write(buff)<br>                    contents = output.getvalue()<br>                    image = Image.open(cStringIO.StringIO(contents))<br>


                    output.close()<br><br>This script results in a traceback:<br>image = Image.open(cStringIO.StringIO(contents))<br>  File &quot;D:\Python26\lib\site-packages\PIL\Image.py&quot;, line 1980, in open<br>    raise IOError(&quot;cannot identify image file&quot;)<br>


IOError: cannot identify image file