I want to broadcast the image from the webcam on the site. The camera is located in LAN with the server at the internal address 192.168.h.h. The webserver is also available at the external address mysite.ru with a dedicated ip address. How to broadcast the camera on the website at mysite.ru, if the camera is in the internal grid, to which the server has access?

I was doing:

img.php

<?php $ch=curl_init(); curl_setopt($ch, CURLOPT_URL, "http://192.168.0.100/video/mjpg.cgi"); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_USERPWD, "user:pass"); curl_exec($ch); ?> 

if you insert into index.php

 <img src="/img.php"> 

then nothing is shown. that is, it takes a long time to load (it’s the same stream !!) and ends up with nothing. How else can you broadcast from the internal to the external network?

UPD.

cameras controlled by TrendNET TV-IP512P. Server running Win 2K3. Web server - Denver.

  • I would look in the direction of the protocol [WebRTC] [1]. So far the standard has the mark [Draft] [2], but I think the HTML 5.1 specification will enter as RFC. The video stream (WebM format) is broadcast between clients, bypassing the server (P2P). Through the server, pass only the service data about the connection of clients. For production, I think it's a bit early, although there are already projects (sipml5, Callbacker). [1]: habrahabr.ru/post/163527 [2]: dev.w3.org/2011/webrtc/editor/webrtc.html - romeo


2 answers 2

To do a repeater on php - bad job. There would be a mjpeg stream, something would nagit. And so it is possible and to use ready-made programs: http://www.nchsoftware.com/broadcam/index.html is free and works well.

  • So the stream is just the same mjpeg ... What can you do? - Yoharny Babay
  • @ Yoharny Babai I mean an existing stream that can be captured. - lampa
  1. You can broadcast from the WEB camera using the ngx_rtmp_module module, a detailed article on Habré how to use it
  2. You can use media server Maxim Lapshin erlvideo
  3. or red5 media server

In any case, I advise you to use software specially developed for broadcasting.