简体   繁体   English

从wifi h.264相机直接直播到iPhone

[英]live streaming from wifi h.264 camera directly to iPhone

I have a standard WiFi h.264 camera that I use as a baby monitor which, in technical terms, means I need it to be as realtime as possible. 我有一个标准的WiFi h.264摄像头,可以用作婴儿监视器,从技术上讲,这意味着我需要尽可能实时。 My initial goal was to encode the stream from the camera as such that the native iPhone hardware decoder can be used so that the result is a direct, clean, sharp, and realtime video from my camera onto my iPhone. 我最初的目标是对来自摄像机的流进行编码,以便可以使用本机iPhone硬件解码器,从而使从摄像机到iPhone的视频直接,干净,清晰,实时。 I really want to avoid using FFMPEG since its a software decoder, which is slower then a hardware decoder. 我真的想避免使用FFMPEG,因为它的软件解码器比硬件解码器要慢。

I am finidng that the iPhone will not take anything from the camera's stream unless I use HLS as a middleman server. 我确定,除非我将HLS用作中间人服务器,否则iPhone不会从相机流中获取任何东西。 I am desperatly trying to avoid introducing a server inbetween the camera and the iphone, since it means more work, more bandwidth, and more latency on the video. 我拼命地试图避免在相机和iPhone之间引入服务器,因为这意味着更多的工作,更多的带宽以及更多的视频延迟。

So my question is: What do I need to do in order to get a direct h.264 stream from my WiFi camera to show up on my iPhone using its hardware decoding? 所以我的问题是:为了从WiFi摄像机直接获取h.264流以使用其硬件解码显示在iPhone上,我该怎么办? I am currently using base profile. 我目前正在使用基本个人资料。 If you need any more details, please let me know. 如果您需要更多详细信息,请告诉我。

Again, your help means a lot since I have been beating myself up on this for over 6 months now. 同样,您的帮助意义重大,因为我在6个月多的时间里一直在努力奋斗。

/* Edit (January 24, 2012) */ / *编辑(2012年1月24日)* /

I'm leaving this answer for historic record, but I have a better answer now.. 我将这个答案留作历史记录,但现在我有了一个更好的答案。

/* End Edit */ Depending on your brand of camera, the IP Vision app from the Apple App Store should work just fine to establish a direct connection. / *结束编辑* /根据您的相机品牌,Apple App Store中的IP Vision应用程序应该可以很好地建立直接连接。

See here: http://itunes.apple.com/us/app/ip-vision/id300593485?mt=8 参见此处: http : //itunes.apple.com/us/app/ip-vision/id300593485?mt=8

There will of course be some latency, but I can tell you from 15 years experience in surveillance, that latency is just a fact of life. 当然会有一些延迟,但是从15年的监视经验中我可以告诉您,延迟只是生活中的事实。

Most IP cameras offer a reasonable degree of control over bitrate. 大多数IP摄像机对比特率提供合理程度的控制。

If you can sacrifice quality for speed, try getting a bitrate of around 32kbps. 如果您可以牺牲质量来提高速度,请尝试获得大约32kbps的比特率。 With H.264 compression, this will be around 1-2 FPS at QVGA resolution. 使用H.264压缩时,在QVGA分辨率下约为1-2 FPS。

As for latency in the app, I cannot offer you any specific advice, but the app is free, and if it provides improved results than you win! 至于应用程序中的延迟,我无法为您提供任何具体建议,但是该应用程序是免费的,并且如果它提供了比您赢的更好的结果!

EDIT: Doe not work with stock iOS or Android 4.0. 编辑:不适用于现有的iOS或Android 4.0。 May have some use for the web, so I will leave this for others. 可能在网络上有一些用途,所以我将其留给其他人使用。

Can you get an RTSP stream from your camera? 您可以从相机获取RTSP流吗?

Here is a list of IP cameras and their RTSP streams: http://www.soleratec.com/rtsp/ 这是IP摄像机及其RTSP流的列表: http : //www.soleratec.com/rtsp/

If you can make a web page, you can use this code to embed your RTSP stream. 如果可以制作网页,则可以使用此代码嵌入RTSP流。 It works on iOS, and is fairly universal: 它可以在iOS上运行,并且相当通用:

<div class="box">
<OBJECT classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921"
 codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab"
 width="320" height="240" id="vlc" events="True">
<param name="Src" value="rtsp://76.23.103.200:1935/live/camera.stream" />
<param name="ShowDisplay" value="True" />
<param name="AutoLoop" value="False" />
<param name="AutoPlay" value="True" />
<embed id="vlcEmb"  type="application/x-google-vlc-plugin" version="VideoLAN.VLCPlugin.2" autoplay="yes" loop="no" width="320" height="240"
 target="rtsp://76.23.103.200:1935/live/camera.stream" ></embed>
</OBJECT>
</div>

Style your box as required. 根据需要设置框的样式。 For an iPhone 4, screen width is going to be 320px, and for a typical IP camera, you probably have a 3:4 aspect ratio, so you want a screen height of 240px, just as listed above. 对于iPhone 4,屏幕宽度将为320px,对于典型的IP摄像机,您可能具有3:4的宽高比,因此您希望屏幕高度为240px,如上所列。 Style the containing div any way you want. 随意设置包含div的样式。 I recommend to center it, in case you call the web page in a tablet, laptop, PC, etc. Just makes it easier to see. 我建议将其居中,以防您在平板电脑,笔记本电脑,PC等中调用网页。

Example CSS .box { margin: 0 auto; 范例CSS .box {margin:0 auto; width: 320px; 宽度:320像素; height: 240px; 高度:240像素; } }

NOTE: The scope of this answer does NOT address any security concerns. 注意:此答案的范围不解决任何安全问题。 Just like anything on the web, if you put it out there unsecured, anyone can get a hold of it. 就像网络上的任何内容一样,如果您将其放到不安全的地方,任何人都可以拥有它。

Re-addressing your latency issues, this method will result in about a 3 second latency while streaming at 32kbps. 重新解决您的延迟问题,此方法在以32kbps的速率进行流传输时将导致大约3秒钟的延迟。 May be a bit longer on a 3G wireless network. 在3G无线网络上可能会更长一些。 As I mentioned, latency is a fact of life with video. 正如我提到的,延迟是视频中不可或缺的事实。 Even very expensive solutions will have 1-2 seconds of lag. 即使是非常昂贵的解决方案也会有1-2秒的延迟。

I hope this helps you some. 希望对您有所帮助。 If you don't have a website, just make a free Wordpress site and stick this code into a static page. 如果您没有网站,只需创建一个免费的Wordpress网站并将此代码粘贴到静态页面即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM