title: Streaming a Panasonic IP camera for a local web application on Chrome
body: <p>I am trying to get my Panosonic WV-SP306 to stream on a chrome browser for a web application I am building. I can get it to stream through the default IE 9/Windows setup on their control pannel. The problem with that is that my client will only use Chrome and I develop on a Mac.</p>
  
  <p>I've decided on the approach of trying to run the below Python script (found and modified it from here-<a href="http://blog.mikemccandless.com/2013/11/pulling-h264-video-from-ip-camera-using.html" rel="nofollow">http://blog.mikemccandless.com/2013/11/pulling-h264-video-from-ip-camera-using.html</a> but I have a couple of problems first.</p>
  
  <ol>
  <li><p>live555 appears to be a C++ library and I have never installed or developed in this (always Java before this). To use this library, I've downloaded it but unsure where to unzip this. Any advice on this point would be great. I have my index page for my web application at this location: /Users/elizabethmcginnis/Documents/Titanium_Studio_Workspace/Knightscope NOC 1.5/Resources/HTML</p></li>
  <li><p>Lucky me, this will also be my first time writing a python script. So I am sure there will be lots of problems there too. This is a totally stupid question and I apologize but can anyone help me with how I run this script from the command line so I can start testing it?</p></li>
  <li><p>And finally, I tried running my stream through VLC and that didn't work, and the default view is ActiveX on IE which I can't use. If anyone else has another solution, I am all ears.</p></li>
  </ol>
  
  <p>Thanks!
  Elizabeth</p>
  
  <pre><code>import time
  import sys
  import live555
  import threading
  
  # Shows how to use live555 module to pull frames from an RTSP/RTP
  # source.
  
  if len(sys.argv) != 5:
    print()
    print('Usage: python3 example.py 192.168.1.3 1 10 out.264')
    print()
    sys.exit(1)
  
  cameraIP = sys.argv[1]
  channel = sys.argv[2]
  seconds = float(sys.argv[3])
  fileOut = sys.argv[4]
  
  url = 'rtsp://192.168.1.3:34005@%s/h264/Streaming/channels/%s' % (cameraIP, channel)
  
  fOut = open(fileOut, 'wb')
  
  def oneFrame(codecName, bytes, sec, usec, durUSec):
    print('frame for %s: %d bytes' % (codecName, len(bytes)))
    fOut.write(b'\0\0\0\1' + bytes)
  
  # Starts pulling frames from the URL, with the provided callback:
  useTCP = False
  live555.startRTSP(url, oneFrame, useTCP)
  
  # Run Live555's event loop in a background thread:
  t = threading.Thread(target=live555.runEventLoop, args=())
  t.setDaemon(True)
  t.start()
  
  endTime = time.time() + seconds
  while time.time() &lt; endTime:
    time.sleep(0.1)
  
  # Tell Live555's event loop to stop:
  live555.stopEventLoop()
  
  # Wait for the background thread to finish:
  t.join()
  </code></pre>