Question

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.

I've decided on the approach of trying to run the below Python script (found and modified it from here-http://blog.mikemccandless.com/2013/11/pulling-h264-video-from-ip-camera-using.html but I have a couple of problems first.

  1. 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

  2. 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?

  3. 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.

Thanks! Elizabeth

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() < endTime:
  time.sleep(0.1)

# Tell Live555's event loop to stop:
live555.stopEventLoop()

# Wait for the background thread to finish:
t.join()

No correct solution

OTHER TIPS

Usage: python3 example.py 192.168.1.3 1 10 out.264 is a clue of how to run from the command line if that is any help.
C/C++ extensions in python libraries are usual compiled & built with python3 setup.py build from the command line in the directory that is the top of the downloaded package and then installed with sudo python3 setup.py install at least on many systems however a check on the website gave the following.

How to configure and build the code on Unix (including Linux, Mac OS X, QNX, and other Posix-compliant systems)

The source code package can be found (as a ".tar.gz" file) here. Use "tar -x" and "gunzip" (or "tar -xz", if available) to extract the package; then cd to the "live" directory. Then run ./genMakefiles where is your target platform - e.g., "linux" or "solaris" - defined by a "config." file. This will generate a Makefile in the "live" directory and each subdirectory. Then run "make". If the "make" fails, you may need to make small modifications to the appropriate "config." file, and then re-run "genMakefiles ". (E.g., you may need to add another "-I" flag to the COMPILE_OPTS definition.) Some people (in particular, FreeBSD users) have reported that the GNU version of "make" - often called "gmake" - works better than their default, pre-installed version of "make". (In particular, you should try using "gmake" if you encounter linking problems with the "ar" command.) If you're using "gcc" version 3.0 or greater: You may also wish to add the -Wno-deprecated flag to CPLUSPLUS_FLAGS. If no "config." file exists for your target platform, then try using one of the existing files as a template. If you wish, you can also 'install' the headers, libraries, and applications by running "make install".

I would also suggest taking a look at pyopencv as well.

So I've solved half my problem.

Between some extensive questions to the Panasonic software department and repurposing an old PC, I was able to tweak the settings in their admin (not only change the bit rate, make sure both channels are broadcasting in both h264 and through http, and turn audio on through the internal mic, obvious I know but getting their help to even get into the admin panel was tough). All that seems obvious but you have to save it a couple of times and for both channels or you run into problems.

Ok, then I was able to run an "Open Network Channel" through VLC by just putting in this URL "rtsp://LocalIP/MediaInput/h264", and then opening the Streaming/File settings in the wizard to make sure it streamed locally. Once I had confirmed this worked for all 4 cameras. My next step was to run all four simultaneously.

I accomplished this by running all four from the command line with these commands on a Mac OSX Mavericks:

$ alias vlc='/Applications/VLC.app/Contents/MacOS/VLC' $ vlc rtsp://192.168.1.6/MediaInput/h264

Now I am trying but haven't quite accomplished running them all through a mosaic. I've included my config file here. And once that is accomplished, then I will try to run the whole thing on a webpage (I'm using a dynamic web project in eclipse).

new channel1 broadcast enabled
setup channel1 input rtsp://192.168.1.3/MediaInput/h264
setup channel1 output #duplicate{dst=mosaic-bridge{id=1,height=144,width=180},select=video,dst=bridge-out{id=1},select=audio}

new channel2 broadcast enabled setup channel2 input rtsp://192.168.1.4/MediaInput/h264 setup channel2 output #duplicate{dst=mosaic-bridge{id=2,height=144,width=180},select=video,dst=bridge-out{id=2},select=audio}

new channel3 broadcast enabled setup channel3 input rtsp://192.168.1.5/MediaInput/h264 setup channel3 output #duplicate{dst=mosaic-bridge{id=3,height=144,width=180},select=video,dst=bridge-out{id=3},select=audio}

new channel4 broadcast enabled setup channel4 input rtsp://192.168.1.6/MediaInput/h264 setup channel4 output #duplicate{dst=mosaic-bridge{id=3,height=144,width=180},select=video,dst=bridge-out{id=4},select=audio}

new background broadcast enabled setup background input /Users/xxx/Pictures/yyyy/ks logo.png setup background output #transcode{sfilter=mosaic,vcodec=mp2v,vb=10000,scale=1}:bridge-in{delay=400,id-offset=100}:standard{access=udp,mux=ts,url=239.255.12.42,sap,name="mosaic"}

control background play control channel1 play control channel2 play control channel3 play control channel4 play

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top