2

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. 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. I really want to avoid using FFMPEG since its a software decoder, which is slower then a hardware decoder.

I am finidng that the iPhone will not take anything from the camera's stream unless I use HLS as a middleman server. 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.

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

Vivek Kalkur
  • 2,200
  • 2
  • 21
  • 40
mpopovi
  • 21
  • 1
  • 3
  • See [Access to the iOS' video decoder?](http://stackoverflow.com/questions/3600926/access-to-the-ios-video-decoder). AFAIK currently the chunk-based http-streaming is the only option. – Georg Fritzsche Jan 03 '12 at 08:17

2 Answers2

2

/* Edit (January 24, 2012) */

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.

See here: 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.

Most IP cameras offer a reasonable degree of control over bitrate.

If you can sacrifice quality for speed, try getting a bitrate of around 32kbps. With H.264 compression, this will be around 1-2 FPS at QVGA resolution.

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!

Jason
  • 871
  • 1
  • 8
  • 18
  • Are you going to tell us what your better answer is? – Elliott B Jul 18 '18 at 06:15
  • @Elliott B The OP wanted to avoid the use of a middleware server. My "better answer" involves such a server, so it's inappropriate to discuss here. I should have worded my edit "better solution." At any rate, if you have a commercial application, use WOWza Media Server. It's cheap and it works. With the new version 4, it's very easy to get your stream going. – Jason Jul 18 '18 at 14:40
0

EDIT: Doe not work with stock iOS or 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?

Here is a list of IP cameras and their RTSP streams: http://www.soleratec.com/rtsp/

If you can make a web page, you can use this code to embed your RTSP stream. It works on iOS, and is fairly universal:

<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. Style the containing div any way you want. I recommend to center it, in case you call the web page in a tablet, laptop, PC, etc. Just makes it easier to see.

Example CSS .box { margin: 0 auto; width: 320px; height: 240px; }

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. May be a bit longer on a 3G wireless network. As I mentioned, latency is a fact of life with video. Even very expensive solutions will have 1-2 seconds of lag.

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.

Jason
  • 871
  • 1
  • 8
  • 18
  • this invokes the vlc plugin and it is NOT available on iOS – dwery May 31 '13 at 15:16
  • A little hasty with the downvote, dwery. This does indeed work on both of my iPhone 4 test devices. One is a stock device using software version 4.2.1, and the other is stock using I believe version 6.xx. – Jason May 31 '13 at 18:42
  • I did try with a 4S/iOS6.x before downvoting and it does not work. I also did some research on google and found no other references to RTSP played this way on an iPhone, a feature like that would have certainly be discovered. However, I will happily upvote if you can give a working link. – dwery Jun 05 '13 at 14:13
  • 1
    dwery, I through together a test page and confirmed this does not work with iOS, or Android 4.0 for that matter. I've appended my answer and I retract my criticism of your down vote, which apparently was well justified. I'm not sure where I went wrong, and I apologize. – Jason Jun 05 '13 at 18:05
  • It's very rare to read apologies nowadays. I removed the downvote. – dwery Jun 07 '13 at 09:26
  • Here is another site with a really detailed list of ip-camera manufacturers along with the RTSP URL listings... Seems to have even more companies and camera models then the other sites listed... Hope this helps someone else too. http://www.securityhive.com/rtsp – rtsp_guy Aug 13 '14 at 15:19