Saturday, October 3, 2015

Bit Rate

Bit Rate For DVR, NVR & IP Camera

What are Bit Rates?
Let’s start with “what is a bit, and “why do I need to know?” A bit is short for “binary digit”, the smallest unit of information in computing. It takes 8 bits to make a byte of information. “Bit rate” refers to the number of bits of data transferred in a file over a set length of time usually measured in number of “bits per second” or “bps”.
Constant bit rate (CBR) and variable bit rate (VBR) are the main types of bit rate encoding. Scene complexity can vary significantly over several hours of recorded video, and the bit rate you select for recording will have an effect on image quality, bandwidth consumption, and hard drive storage. A complex scene with moving action, such as traffic on a city street, or a scene with a lot of contrasting colors, will affect image quality and bandwidth consumption more than a less complex scene, such as an interior room with very little action or movement.
Most NVRs and IP cameras let you choose either constant or variable bit rates for recording video, and this is why you “need to know” the difference.

Constant Bit Rate (CBR)
With constant bit rate encoding, a fixed bit rate and bandwidth is used throughout the entire encoded video file. With a constant bit rate, image quality may fluctuate over the course of the video stream because some scenes are more difficult to render than others. In order for the bit rate to remain constant, the video may be encoded with fewer bits in some places or more bits in other places resulting in inconsistent image quality. Since bandwidth consumption with constant bit rates does not vary, the file size is limited and more predictable than with variable bit rates.
You will most commonly use CBR to restrict the data flow to keep network utilization as low as possible. If you have 10 cameras set to 8000K (8 megabits) on a 10/100 LAN, you are using 80% of your available bandwidth. With CBR, you can set that bit rate down to 5000K and your utilization will be around 50%.
Pre-planning your security video storage requirements is easier with constant bit rate because the amount of data being recorded never changes.

Variable Bit Rate (VBR)
With variable bit rate encoding, a changeable bit rate and bandwidth is used throughout the encoded video file. The variability of bit rates allows for video to be recorded at a lower bit rate when the  scene on screen is less complex and at a higher bit rate when the scene is more complex. Complex scenes (such as moving traffic) require more data and greater bandwidth to maintain image quality  than less complex scenes such as a wall or hallway with very little movement or action. With variable bit rates, the quality of video is higher and more consistent throughout the video stream compared to constant bit rates, yet the file size is less predictable.

Image quality is better with variable bit rates than with constant bit rates, yet pre-planning your security video storage requirements is more difficult because the bit rate changes and more complex scenes will require greater bandwidth and storage.

Here’s a Quick Look at How Constant and Variable Bit Rates Compare:
Constant Bit Rates
Variable Bit Rates
Variable video image quality
Consistent video image quality
File size is predictable because bit rate and bandwidth consumption is fixed
File size is unpredictable because bit rate and bandwidth consumption varies
Greater compatibility with most systems (compared to variable bit rate)
Less predictable compatibility (compared to constant bit rate)
When to use: When you need to limit file size and the quality of video is less important.
When to use: When consistent image quality is critical and predicting or limiting file size is less important.
The best of both worlds is when the device allows you to set VBR with a ‘Cap’ or maximum allowed bit rate.

Here is a handy ‘Quick Reference’ for setting a constant Bit Rate in bits per second.
Low Activity
Compression
Frame Rate
VGA/D1
720P/1.3MP
1080P/3MP
H.264
25~30
768K
2000K
3000K
15~20
512K
1500K
2000K
8~10
386K
1000K
1500K
2~5
256K
768K
1000K
MPEG4
25~30
1000K
3000K
5000K
15~20
768K
2000K
4000K
8~10
512K
1500K
3000K
2~5
386K
1000K
2000K

Normal Activity
Compression
Frame Rate
VGA/D1
720P/1.3MP
1080P/3MP
H.264
25~30
1000K
3000K
5000K
15~20
768K
2000K
4000K
8~10
512K
1500K
3000K
2~5
386K
1000K
2000K
MPEG4
25~30
1500K
4000K
6000K
15~20
1000K
3000K
5000K
8~10
768K
2000K
4000K
2~5
512K
1500K
3000K

High Activity or PTZ on Tour
Compression
Frame Rate
VGA/D1
720P/1.3MP
1080P/3MP
H.264
25~30
2000K
4000K
6000K
15~20
1500K
3000K
5000K
8~10
1000K
2000K
4000K
2~5
768K
1500K
3000K
MPEG4
25~30
3000K
6000K
8000K
15~20
2000K
4000K
6000K
8~10
1500K
3000K
4000K
2~5
1000K
2000K
3000K
In the bit rate charts above, you will see 1000K / 2000K etc. These figures can be loosely translated into ‘megabits’ per second.
1000K = 1Mb | 2000K = 2Mb and so on.

(In the computing world you would actually use 1024K = 1Mb and 2048K = 2Mb, but since most CCTV devices won’t allow those exact numbers, we just round them down to the closest thousand.) These figures are important to familiarize yourself with to manage your network load.

For example – 1 camera running a high bitrate of 8000Kbps (8Mbps) is no problem on a 10/100 network. 10 cameras at that bit rate = 80Mbps. 80Mbps is 80% network utilization on a 10/100 LAN. This is enough to see visible slowdown on the network and may begin to cause problems.

Switch to a Gigabit LAN and that becomes 8% utilization. Always check the capabilities of the network you are installing on – this can save you from a lot of headaches. When using IP cameras, always use Gigabit routers and switches when possible.  Also, make sure your NVR is connected to a gigabit switch. Plugging your NVR in to a 10/100 switch will limit your NVR to a 100Mb connection.

And finally – here is a “loose rule of thumb” for setting a bitrate:
[image width] x [image height] x [framerate] x [motion rank] x 0.07 = [desired bit rate]

Where the image width and height is expressed in pixels, and the motion rank is a number between 1 and 4. 1 being low motion, 2 being medium motion, and 4 being high motion (motion being the amount of image data that is changing between frames.).

So for instance, if we take a 1280×720 video at 24 FPS, with medium motion (movie with slow camera movements, not many scene changes…), the expected ideal bit rate would be:
1280 x 720 x 24 x 2 x 0.07 = 3,096,576 bps => approximately 3000 kbps, or 3MB
Remember – bit rates are not “universal” – different cams will give different results due to variations in encoding methods, hardware, and environmental conditions. Watch for artifacts like “ghosting” or “smearing” of moving objects.

Ghosting = when someone moving across the image may appear transparent, or may have a “ghost” following them. The “ghost” is not always transparent and may look like two people overlapped.

Smearing = when a moving object causes objects around it to change in appearance or starts to become pixilated.

Pixilated = When objects become unclear – may appear as a “smear” or slightly out of focus. In worst cases you will begin to see blocks of similar colors instead of the object itself.

Tuesday, September 22, 2015

RS-232 cable Wiring & Testing

COM Port (OR) RS-232 cable Wiring & Testing


As A technical background eSecurity Professional, many time got call “my Access Controller communication has RS232 enable How we connect with Computer (COM Port), is there any layout” Sometime “Successfully testing via my Laptop but Customer computer not responding, any distance or new programming is there”. I remember in year 2006 me also facing this type of problem with an Access Controller; I would be like to share the myth.

Com Port (Com1 / Com2 etc)= Serial Port = RS232 = Consol.

The wiring of RS232 has always been a problem. Originally the standard was defined for DTE (data terminal equipment) to DCE (data communication equipment connection), but soon people started to use the communication interface to connect two DTEs directly using null modem cables. No standard was defined for null modem connections with RS232 and not long after their introduction, several different wiring schemes became common. With Digital Equipment Corporation tried to define their own standard for serial interconnection of computer devices with modified modular jack connectors. This interfacing standard became available on most of their hardware, but it wasn't adopted by other computer manufacturers. Maybe because DEC used an non-standard version of the modular jack.


Very interesting is the RS232 to RJ45 wiring standard proposed by Dave Yost in 1987, based on earlier wiring schemes used at Berkeley University. He tried to define a standard comparable to DEC, where both DTEs and DCEs could be connected with one cable type. This standard was published in the Unix System Administration Handbook in 1994, and has since that moment been a wiring standard for many organizations. We will discuss this standard in detail here.
The RS-232 standard 9600bps port will drive 13 metres of shielded cable. RS232 standard is an asynchronous serial communication method. The word serial means, that the information is sent one bit at a time. Asynchronous tells us that the information is not sent in predefined time slots. RS232 sending of a data word can start on each moment. If starting at each moment is possible, this can pose some problems for the receiver to know which is the first bit to receive. To overcome this problem, each data word is started with an attention bit. This attention bit, also known as the start bit, is always identified by the space line level. Directly following the start bit, the data bits are sent. Data bits are sent with a predefined frequency, the baud rate. Both the transmitter and receiver must be programmed to use the same bit frequency. After the first bit is received, the receiver calculates at which moments the other data bits will be received. It will check the line voltage levels at those moments. With RS232, the line voltage level can have two states. The on state is also known as mark, the off state as space. No other line states are possible. When the line is idle, it is kept in the mark state. For error detecting purposes, it is possible to add an extra bit to the data word automatically. The transmitter calculates the value of the bit depending on the information sent. The receiver performs the same calculation and checks if the actual parity bit value corresponds to the calculated value. The stop bit identifying the end of a data frame can have different lengths. Actually, it is not a real bit but a minimum period of time the line must be idle (mark state) at the end of each word. On PC's this period can have three lengths: the time equal to 1, 1.5 or 2 bits. 1.5 bits is only used with data words of 5 bits length and 2 only for longer words. A stop bit length of 1 bit is possible for all data word sizes.
Goals of the Yost device wiring standard
The mess with RS232 wiring is widely known. It was the reason for starting this website. Dave Yost wanted to solve that mess once and for all, reaching as much as possible of the following goals:
  1. All cable connectors should have the same connector type (RJ45)
  2. All cable connectors should have the same connector gender (male)
  3. DTEs and DCEs should have the same connector wiring
  4. All cables should be identical (except for length)
  5. No need for null modems or other special cables for specific situations
These goals are very close to the goals DEC wanted to achieve. The Yost standard has however one basic advantage. Because RJ45 connectors are used, eight pins are available which makes it possible to transfer almost all RS232 signals. Therefore the Yost standard can be used with much more equipment.
Yost DTE adapter wiring
Now we know how the cables are wired, it is time to define the adapter wiring for various equipment. Depending of the type of equipment, DB9 or DB25 connectors are used. Layouts for both connectors to a RJ45 socket for DTE equipment is shown here. The colors are defined by the Yost standard. The DTR to DSR connection is optional. Please use the manual of the device or software to decide if this loop is necessary. It doesn't harm most of the time if you connect both lines, even with systems that don't use the DSR input signal.
Test COM port by using HyperTerminal.
The HyperTerminal application has been distributed with the Windows operating system versions for a long time now, and for administrators and technical support Representatives, it can be a very useful tool. HyperTerminal allows a user to make a connection to a "host" system from a Windows computer using an available COM port. This will enable you to verify whether or not a port is active and open.  If you have never looked at HyperTerminal, take a couple of minutes to read through the following and see how it can make your life easier.
The HyperTerminal application is started by default from the Start | Programs | Accessories | Communications | HyperTerminal location. When you start HyperTerminal, you are asked to name the connection you are about to configure. This is useful as once you have configured your connection, you can then save all the settings to a configuration file of the same name. This configuration file can be used to implement equivalent settings for subsequent connections. After selecting a connection name, click OK.
On the Connect To dialog box, you are introduced to the different types of connection that HyperTerminal offers. By default, a dial-up connection using a modem is selected (assuming you have a modem present). If you have installed an external modem in addition to an internal modem that modem should also be present in the drop down menu as a choice.
 If you click the downwards arrow on the Connect Using field, you may see one or more COMx (where x is the number of the COM port. i.e COM5) options depending on the number of serial ports available on your computer. The COMx options are typically used for attaching to something like a UNIX computer via serial cable or to a router via its serial console cable. 

To test a specific COM port select that COM port you wish to test. Once the COM port is selected you will not be able to access the other options on this dialog box. They will appear grayed out.

Click OK and select these options:
9600 Bits Per Second, 8 Data Bits, No Parity, 1 Stop Bit, and Hardware Flow Control.
Before clicking OK on the COM3 Properties Dialog Box look at the lower left corner of the HyperTerminal Window. Notice it says "Disconnected" See graphic Below.
Now click the OK button on the COM3 Properties Dialog box. Watch the lower left corner of the HyperTerminal Windows. If the COM port is available and can be opened you will see the status change to Connected. See graphic below.
 If you select OK and get an error saying "Unable to open COMx (where x is the COM port number). Please check your port settings". The COM port you are testing is being used by some device or is not functioning correctly.
Start at the beginning of the COM port test and test another available COM port.
If you receive the error we discussed on every port you select then there are no available ports and you will need to either troubleshoot further or speak to your hardware manufacturer and ask your manufacturer to recommend a hardware solution appropriate for your situations.

Test COM port by using Loopback tester
This is a simple and useful tool for testing RS-232 ports in DTE equipment are working working or not. This plug is connected so that every sent character is echoed back.
 If you Short DB9 (Com Port / RS232) Pin 2 & 3, & Press any Word via Keypad, you can get Eco of that Key. IF you got replied then your Com port is Working Normal, IF not then need to either troubleshoot further or speak to your hardware manufacturer and ask your manufacturer to recommend a hardware solution appropriate for your situations.

Differences between RS-232 and full-duplex RS-485

From a software point of view, full-duplex RS-485 looks very similar to RS-232. With 2 pairs of wires -- a dedicated "transmit" pair and a dedicated "receive" pair (similar to some Ethernet hardware), software can't tell the difference between RS-485 and RS-232.
From a hardware point of view, full-duplex RS-485 has some major advantages over RS-232 -- it can communicate over much longer distances at higher speeds.
Alas, a long 3-conductor cable intended for RS-232 cannot be switched to full-duplex RS-485, which requires 5 conductors.
RS-232 is only defined for point-to-point connections, so you need a separate cable for each sensor connected to a host CPU. RS-485 allows a host CPU to talk to a bunch of sensors all connected to the same cable.

Differences between RS-232 and half-duplex RS-485

But a lot of RS-485 hardware uses only 1 pair of wires (half-duplex). In that case, the major differences are
  • Each RS-485 node, including the host CPU, must "turn off the transmitter" when done transmitting a message, to allow other devices their turn using the shared medium
  • The RS-485 hardware generally receives on the receiver every byte that was transmitted by every device on the shared medium, including the local transmitter. So software should ignore messages sent by itself.
A long 3-conductor cable intended for RS-232 can often be switched to half-duplex RS-485, allowing communication at higher speeds and at higher external noise levels than the same cable used with RS-232 signaling.
RS-232 is only defined for point-to-point connections, so you need a separate cable for each sensor connected to a host CPU. RS-485 allows a host CPU to talk to a bunch of sensors all connected to the same cable.
Alas, half-duplex RS-485 networks are often more difficult to debug when things go wrong than RS-232 networks, because
  • When a "bad message" shows up on the cable, it is more difficult (but not impossible) to figure out which node(s) transmitted that message when you have a shared-medium with a dozen nodes connected to the same single cable, compared to a point-to-point medium with only 2 nodes connected to any particular cable.
  • Transmitting data bidirectionally over the same wire(s), rather than unidirectional transmission, requires a turn-around delay. The turn-around delay should be proportional to the baud rate -- too much or too little turn-around delay may cause timing problems that are difficult to debug.

Differences between RS-232 and both kinds of RS-485

RS-485 signal levels are typically 0 to +5 V relative to the signal ground.
RS-232 signal levels are typically -12 V to +12 V relative to the signal ground.
RS-232 uses point-to-point unidirectional signal wires: There are only two devices connected to a RS-232 cable. The TX output of a first device connected to the RX input of a second device, and the TX output of the second device connected to the RX input of the first device. In a RS-232 cable, data always flows in only one direction on any particular wire, from TX to RX.
RS-485 typically uses a linear network with bidirectional signal wires: There are typically many devices along a RS-485 shared cable. The "A" output of each device is connected to the "A" output of every other device. In a RS-485 cable, data typically flows in both directions along any particular wire, sometimes from the "A" of the first device to the "A" of the second device, and at a later time from the "A" of the second device to the "A" of the first device.

Friday, September 18, 2015

Point To Point Communication for IP Camera

Point To Point with Nano Tp-LocoM5

Many Installers are requesting methods to connect their Security Systems. From running cable race ways in commercial buildings to installing conduit above or below ground in residential installations, running wired connections can take a lot of time – which equals more money to spend in labor. This article can serve as a guide on how to maximize the use of our Nano Station Loco M5. In this article we will be going to be utilizing an IP Megapixel system.

Example: IP camera System
Items Needed:-
TP-Loco M5
Any IP camera
Any NVR
Category 5, 5e or 6 Cable / Patch Cables
PoE Switch

Before installing any hardware we first need to configure the Nanos. Lets start by Configuring the Nano that will act as an Access Point. This is the one that will be located at the Main Network.
Nano (Access Point)
Navigate to http://192.168.1.20 on your web browser. If you get this page . Click on “Continue to this website (not recommended)”
This is the correct page you should see displayed on your browser. Once you are here you can log in using UBNT as Username and Password.
Select your Country and agree to the terms of use by ticking the radio button.
Once you have gained access to the Main GUI, navigate to the Wireless Tab
Match the Settings displayed.
Wireless Mode: Access point
WDS : Enabled
SSID: UBNT_Bridge
Security : WPA2-AES
Preshared KEY: UBNT2014
Hit Change but not apply.
Network Mode: Bridge
Static Ip: 192.168.1.159
Match your Gateway as well as the DNS server. In this example we left this out as many networks are different.
Finally hit apply.
Once you have applied the settings your Nano will restart and you can install the Access Point at the Main location where the Main network is.
Nano (Station)
Lets go ahead and open an internet browser.
Navigate to http://192.168.1.20
Use the following credentials to log in.
Username: UBNT Password: UBNT
Select your Country & Language
Check the radio button to Agree the terms of use as.
Once you are loge in navigate to the Network Tab
Use the Following settings
Wireless Mode: Station
WDS : Enabled
SSID: UBNT_Bridge
Security : WPA2-AES
Preshared KEY: UBNT2014
Navigate to Network
Use the Following settings
Network Mode: Bridge
Static Ip: 192.168.1.160
Match your Gateway as well as the DNS server in this example we left this out as many networks are different.
Navigate to the Ubiquity tab
Make sure to match these settings and hit apply.
Once you have completed both Nanos you can install them making sure that they both have line of sight between the devices, some minor adjustments can be done to ensure a good connection.
The Nano’s will lock onto the network by themselves or you can click on the SELECT button this will open up a tab that will display any Access Points in the area select the correct one and lock onto it.
Once you have completed setting up your Point to Point Bridge we can focus on the location.
In this illustration you can see that the Nano (Access Point) is in line of sight with the Nano (Station) that has an IP camera connected to it.
The Connections are simple

Site Side
1.        Connect the camera that you need to add into your Main network onto its own PoE Switch “POE Port”
2.        Attach the “LAN” Cable on the single port PoE switch to the “LAN” on the PoE switch from the Nano (Site)
3.        Attach the “PoE” Cable to the Nano Station “LAN” port.
Main Side
1.        Connect the Nano Station to its PoE switch  (“LAN” to “PoE”)
2. Attach an Ethernet cable from your Router LAN port to the “LAN” port located on the Nano stations PoE switch.

*NVR connections are simple simply attach your NVR to the Router  by attaching a cable in between the LAN port on the NVR to the LAN port of your router.

Mounting Options:
The Nanos come already designed to be attached to a pole, there is a supplied Nylon Zip Ties.

Troubleshooting Tips:
If you have successfully connected all of the devices and you cannot seem to ping your camera on any device on the Station side, make sure that the WDS is enabled in both the AP and Station.
If signal is poor you can use the AirView Application to check your signals. If you are not that tech savvy you can use the Signal bars behind the units or simply log in to both and tweak your nano’s position.
Once you have completed mounting your camera and Nano stations as well as configuring your Nano’s, your system should be up and running.
Also, to view your cameras outside your network, some port forwarding is needed. Ports that need to be opened are 37777,37778 and HTTP ports.