Created on 2020.12.07
In this document we will explore how to synchronize the IP video streams between two (2) or more PTZOptics cameras. We will then explore how to leverage this same methodology to synchronize an audio feed to the multiple video streams that have been synchronized.
A side benefit of implementing these changes is the ability to minimize drift in IP video latency which is applicable even for single camera installations.
Description of the Issue_________________________________________________________
When you are operating a production system that has more than one (1) PTZOptics camera the IP video feeds can be out of synchronization with each other. In addition, when attempting to synchronize audio with these IP video streams of varying latency it can become difficult to produce a professional stream.
Overview of the Solution________________________________________________________
To accomplish synchronizing multiple video streams and audio we will leverage the NTP, Network Time Protocol, settings on your PTZOptics cameras as well as your PC. Once everything is set, NTP will allow your PC and network to properly decode the IP video packets in a correct order without creating additional latency to reorganize the incoming information.
Scope for Synchronization_______________________________________________________
First we need to select a Network Time Server to point the cameras and PC at to ensure proper synchronization
If you are aware of the Time Server utilized by your network equipment, router, it is highly recommended to use that same server for your PC and cameras.
By default a Unifi network deployment will utilize the Unifi time servers
An example of a Unifi time server address 0.ubnt.pool.ntp.org
If you are unable to determine the Time Server utilized by your network make sure to set the PC and cameras to the same time server.
When selecting a Network Time Server it is important to select one that is close to your physical location, as an example being located around Philadelphia I may select one from NY or VA, to ensure the least amount of latency when synchronizing.
There are a plethora of freely available network time servers to use with a simple Google search
Once we have selected a Network Time Server to use we need to begin applying it to our production equipment.
For the camera simply log into the Web Interface and navigate to the Network section
Near the bottom is a section titled “NTP Settings” where we will make our adjustments
Set the Time Zone, drop down, to your appropriate time zone for your equipments current physical location
Click the radio button to turn On the NTP Time Sync
Set the Server Address to the Time Server selected above
Set the Time Interval to 10 minutes
Navigate to the System section and [Reboot] the camera
Repeat these same steps for any additional PTZOptics cameras making sure to click Apply and reboot each time.
For the PC we will need to apply this same time server to our Operating System
For the Windows 10 Operating System start by opening Control Panel
Select “Clock and Region”
Click the sub-selection of “Set the time and date”
Select the tab for “Internet Time”
Click “Change Settings”
Note this may require an administrative account to configure
Make sure the “Synchronize with an Internet time server” has been checked
For the “Server:” entry please use the network time server select above
Click “Update Now”
Exit all previous windows
For the Mac Operating System start by clicking on the Apple menu
Select “System Preferences”
Click the Date & Time icon
Note this may require you to “unlock” the settings using your Administrative password
Check the “Set Date & Time Automatically” checkbox
Enter the address of the network time server selected above
Close out all open windows
Now if you open an IP video feed from each of the sources configured using the above method they should provide video feeds synchronized to within 30ms in current testing.
If we want to synchronize audio to these same video feeds we simply need to route the output of the sound system into the available 3.5mm line-level input on the PTZOptics P/T/Z cameras
It is worth attempting to set the Network Time Server address to match that which your own network utilizes for the best possible experience
All testing has shown the method outlined above to produce a multi camera production system where the video feeds are within 30ms of each other.
Using this same methodology, even for a single PTZOptics camera, should prevent drift in the video latency
These tests have been performed using the RTSP and NDI video feeds available from a PTZOptics camera.
These tests have been performed using VLC, vMix, OBS and NDI Studio Monitor
This solution is still being refined and any new information or capabilities will be added as discovered, tested and documented.
Why this works…
When a device sends IP video data over a packet switched network it has the ability to apply timestamps to the packet data to ensure the frames are assembled in a proper order.
The timestamps for the video data are set by the sending device, the camera, and if two (2) devices timestamps do not match it will add delay, latency, ensuring that the data is not out of order or dropped.
The camera thinks the time is 09:01:15.545
The computer thinks the time is 09:01:13:223
The stream coming from the camera will look fine to the computer with
usual latency, but as soon as the computer sends a packet to the camera,
the camera will see that the packet from the computer is old and think there
is a larger than actual network delay. Then will readjust the stream to tell the
computer buffering to compensate. -Example courtesy of Erik Aaron