0

我正在尝试让我的松下 WV-SP306 在我正在构建的 Web 应用程序的 chrome 浏览器上流式传输。我可以让它通过其控制面板上的默认 IE 9/Windows 设置进行流式传输。问题是我的客户只会使用 Chrome,而我在 Mac 上开发。

我已经决定尝试运行以下 Python 脚本的方法(从这里找到并修改它 - http://blog.mikemccandless.com/2013/11/pulling-h264-video-from-ip-camera-using .html但我首先有几个问题。

  1. live555 似乎是一个 C++ 库,我从未安装或开发过它(在此之前总是 Java)。要使用这个库,我已经下载了它,但不确定在哪里解压缩。关于这一点的任何建议都会很棒。我的 Web 应用程序的索引页位于以下位置:/Users/elizabethmcginnis/Documents/Titanium_Studio_Workspace/Knightscope NOC 1.5/Resources/HTML

  2. 幸运的是,这也是我第一次编写 python 脚本。所以我相信那里也会有很多问题。这是一个完全愚蠢的问题,我很抱歉,但任何人都可以帮助我如何从命令行运行这个脚本,以便我可以开始测试它吗?

  3. 最后,我尝试通过 VLC 运行我的流,但没有成功,默认视图是 IE 上的 ActiveX,我无法使用。如果其他人有其他解决方案,我会全力以赴。

谢谢!伊丽莎白

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()
4

2 回答 2

0

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.

于 2014-01-23T19:27:54.447 回答
0

所以我已经解决了一半的问题。

在向 Panasonic 软件部门提出的一些广泛问题和重新利用旧 PC 之间,我能够调整他们管理员中的设置(不仅更改比特率,确保两个频道都以 h264 和 http 进行广播,并打开音频通过内部麦克风,很明显我知道,但获得他们的帮助甚至进入管理面板都很困难)。所有这一切似乎都很明显,但您必须为两个频道保存几次,否则您会遇到问题。

好的,然后我可以通过 VLC 运行“打开网络通道”,只需输入此 URL“rtsp://LocalIP/MediaInput/h264”,然后在向导中打开 Streaming/File 设置以确保它流式传输本地。一旦我确认这适用于所有 4 台相机。我的下一步是同时运行所有四个。

我通过在 Mac OSX Mavericks 上使用这些命令从命令行运行所有四个来完成此操作:

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

现在我正在尝试但还没有完全完成通过马赛克运行它们。我在这里包含了我的配置文件。一旦完成,然后我将尝试在网页上运行整个事情(我在 Eclipse 中使用动态 Web 项目)。

新频道1广播启用
设置频道1输入rtsp://192.168.1.3/MediaInput/h264
设置频道1输出#duplicate{dst=mosaic-bridge{id=1,height=144,width=180},select=video,dst=bridge -out{id=1},select=audio}

新频道 2 广播启用设置频道 2 输入 rtsp://192.168.1.4/MediaInput/h264 设置频道 2 输出 #duplicate{dst=mosaic-bridge{id=2,height=144,width=180},select=video,dst=bridge -out{id=2},select=audio}

新频道 3 广播启用设置频道 3 输入 rtsp://192.168.1.5/MediaInput/h264 设置频道 3 输出 #duplicate{dst=mosaic-bridge{id=3,height=144,width=180},select=video,dst=bridge -out{id=3},select=audio}

新频道4广播启用设置频道4输入rtsp://192.168.1.6/MediaInput/h264设置频道4输出#duplicate{dst=mosaic-bridge{id=3,height=144,width=180},select=video,dst=bridge -out{id=4},select=audio}

启用新的背景广播 设置背景输入 /Users/xxx/Pictures/yyyy/ks logo.png 设置背景输出 #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"}

控制后台播放控制通道1播放控制通道2播放控制通道3播放控制通道4播放

于 2014-01-28T18:03:37.403 回答