Материал из for iRidium developers
Перейти к: навигация, поиск
Эта страница является переводом страницы IP Cameras. Перевод выполнен на 100%.

Other languages:
English • ‎русский

IP cameras and DVR

Getting video streams from IP cameras and digital video recorders

Video from IP Cameras

Dynamic Images – they are snap shots or stream video uploaded from resources in the Internet or local network. DVRs, IP cameras, servers can serve as such resources.

Supported video-codecs:

  • JPEG / MJPEG - stream video and frame based data receipt from IP cameras or DVRs, snap shots - *.jpg or *.png images
  • H.264 / MPEG-4 - highly compressed video stream


It is required to have a direct link to the image or video stream (without interface items, ActiveX components, etc.)

where to find the direct link to the stream from the IP camera:

Editor gallery project dynamic images.png

Add the link in the iRidium project:

GALLERY >
Project Gallery > Dynamic Images >
Add Dynamic Image

- to add a link to the IP camera or video stream from the DVR in the project.


Example of the link to the dynamic image:

http://root:root@192.168.0.100:80/source/video.mjpg

rtsp://root:root@mydomain.com:554/mpeg4/media.amp

the protocol of data sending (HTTP or RTSP)
the login:password to access the camera
the address of the resource with video
the port of connection to the source
the link to the data stream


Set up the link in the project:

Editor gallery window dynamic image.png
  • URI - the link to the video stream (or the stream of frames). The login, password and port of access to the camera can be indicated in the properties below.
  • Port- for JPEG/MJPEG - port: 80, by default; for MPEG-4/H.264 - port: 554
  • Login / Password - the details for accessing the video stream from the camera
  • Refresh (ms) - frequency of reconnection to the video source.
    • Refresh: 0 (ms) - for stream video in MJPEG/H.264/MPEG-4.
    • Refresh: 1000...n (ms) - for JPEG snap shots
  • Demuxer - automatic or manual selection of the FFMPEG stream type (for those cases when the stream cannot be defined automatically). Sometimes it is used when working with Mobotix.
  • Probe Size: 50000 (Kb) - the buffer of data in Kb that will be downloaded before playing the video. It is 5Mb by default (if you set 0). It can be decreased for low resolution cameras of slow connection, but the value less then 20000Kb is not recommended.
  • Param - the type of the RTSP transport. Indicate
    • rtsp_transport=tcp; if the RTSP stream from the IP camera is uploaded via the Internet or its quality is not good
    • rtsp_transport=udp; or the empty field enables upload of the RTSP stream in the local network via UDP
  • Audio - it defines the necessity of playing the audio stream from mxpeg cameras (if there is such possibility)

The Test In Browser button can be used to check work of a JPEG/MJPEG link: the camera has to be displayed without control elements, borders and other software shells in the browser.


Assign the camera to a graphic item:

Drag the dynamic image from Project Gallery to the graphic item which will display the stream from the camera. After that you can edit the link by double-clicking on the item it is assigned to.

StretchIPCamera.png

Open the "Stretch & Filtration" tab and indicate the way of scaling the stream from the IP camera for Image:

  • None – do not scale the stream from the IP camera
  • Proportional – to scale the stream saving proportions
  • Full Size – to scale by the item size (without saving proportions)


The number of displayed cameras in your project should not be more than 4-5 for the stable work of the iRidium application. All cameras located on the pages and popups opened at the moment are considered displayed cameras. The higher the camera resolution is and the less resources the control panel has – the less number of panels can be displayed.

The excess of the recommended number of cameras can lead to problems with the project work in general.

When creating a link to a dynamic image via script, you can assign only one such image for an item. It means you cannot set up one image in State 1 and another in State 2 of the item.



Weather informers

Weather informer - it is an image which is located by the static link. The image is updated with certain frequency. It is available for downloading by HTTP. Informer codes are provided by different web sites, for example:

The service provides a code for adding on the web site. You will need only the link to the image in the png or jpg format from it. The link is set up similarly to the link for IP cameras in the Gallery > Project Gallery > Dynamic Images:


Example of the weather informer on the web site:

Editor informer dynamic image.png

Example of the link to the weather informer in iRidium:

Editor informer add dynamic image.png
  • URI - the link to the image checked in the browser is input in the URI string of the camera settings.
  • Refresh: 1000...n (ms) - the frequency for updating the image, do not indicate less than 1000 ms


http://info.weather.yandex.net/moscow/3_white.ru.png

the protocol of data transfer (HTTP)
the address of the resource – the video source
the link to the informer image


Use the Test In Browser button to check work of the ready link.

Drag the image on the item. The size of the item has to be the same size as the informer to display the image correctly.

You can edit the link by double-clicking on the item it is assigned to.


PTZ Control

PTZ control - it is control of IP cameras or DVRs via HTTP. If your camera supports PTZ commands, you can control it: change its position (if it has a mechanism for rotation), change the focus point, set up properties for recording, etc.

PTZ commands are required to be sent with the help of the AV & Custom Systems (HTTP) driver. They are usually formed as GET requests which can be sent via the browser. Learn REST API of your camera or DVR to get the list of PTZ commands. Use the list in accordance with the instructions for AV & Custom Systems (HTTP).


Video from Cameras of Control Panels

If i3 pro works on an iOS, Windows or Android device with the front-facing camera (or on the laptop with the web-camera), you can display the video from this camera in your iRidium project.

This feature is usually used when working with SIP video for displaying the stream which is transferred via the SIP protocol to another subscriber.


To display video from the main or front-facing camera of your control panel in your project, assign the link to the camera to the graphic item and start getting the stream. The setting up is performed in the script editor (JS):

IR.AddListener(IR.EVENT_START,0,function()
{
   // link the camera image to display Item
   IR.GetItem("Page 1").GetItem("Item 1").GetState(0).Image = "ir_camera://";
});
function CameraStart ()
{
   // start the camera record and flip it into vertical position (if started on iPad)
   IR.Camera(IR.CAMERA_RECORD, IR.CAMERA_FRONT, IR.CAMERA_RESOLUTION_MEDIUM);
   IR.Camera(IR.CAMERA_FLIP_VERTICAL, 1);
}
function CameraStop ()
{
   // stop the camera record
   IR.Camera(IR.CAMERA_STOP);
}


You can start and stop display of video by calling the functions CameraStart and CameraStop with the ScriptCall command:

JSguide helloFunction.png


You can also do it by adding the activation of the functions on some event in scripts:

IR.AddListener(IR.EVENT_APP_ENTER_FOREGROUND, 0, function()
{
    CameraStart (); // start video when iRidium in foreground
});
IR.AddListener(IR.EVENT_APP_ENTER_BACKGROUND, 0, function()
{
    CameraStop (); // stop video when iRidium in background
});


Video settings (quality, angle, etc.) are formed at creation of video stream with the help of IR.Camera() method. It is described in detail in JavaScript Handbook.


SIP-video

During SIP video -calls it is required to display the video-stream sent by the subscriber with which you established the connection.

The stream is generated automatically when you set up the video-call with the means of the SIP driver. To output the stream, assign it to the graphic item which will display the video. You can do it in the script editor (JS):

IR.AddListener(IR.EVENT_START,0,function()
{
   // display the SIP video
   IR.GetItem("Page 1").GetItem("Item 1").GetState(0).Image = "sip_image://";
});