TCP vs UDP for Video Surveillance

By: Ethan Ace, Published on Mar 11, 2015

TCP or UDP?

What should you use for video surveillance?

TCP and UDP are both in use in the video industry today, each with strengths and weaknesses when it comes to live viewing, playback, error correction, artifacting, and more, though many users do not know the difference between the two or how choose one or the other.

*** ** ***?

**** ****** *** *** for ***** ************?

*** *** *** *** both ** *** ** the ***** ******** *****, each **** ********* *** weaknesses **** ** ***** to **** *******, ********, error **********, ***********, *** more, ****** **** ***** do *** **** *** difference ******* *** *** or *** ****** *** or *** *****.

** **** ******, ** share *** **** ******** of *** ********* ** video *******, *******, ****** and *** *************.

[***************]

Key ******** ** ****

**** ** * ***** summary:

  • *** ***** ** **** frames **** ********* ** insufficient *** ***** ****** needs.
  • *** ***** ** ***** image **** ********* ** insufficient *** ***** ****** needs.
  • ******* ******* *********** ******* TCP *** ***.
  • ********* *** ******** *** live ***** ********* **** congested ********.
  • **** ******* ***** ** be ******** **** ***.
  • ******** ***** ***** ** have ***** ****** **** TCP.
  • **** ** ******* ******* both *** *** *** *** ********* ** ** *** user ************ (**** *** or *** ***).
  • ***** **** ************* ** what ************* ** ******* they ******* *** *** or *** (******* ** Avigilon, *****, ******* *** Milestone ******).

Impact ** ***** *******

** *** ******** *****, we **** *** ********** in ***** ******* ***** TCP **. *** **** a ********* *** **/* connection. ****: *** * brief ****** ** *** differences ******* ***** *** protocols,*** *** ******** *****.

**** ***** ***, ****** all frames ******, *** *******. Stuttering ** *******, **** the ******* ******* **** one ***** ** *** scene ** *******.

*******, ** *** **** scene ***** ***, ** can *** *********** ******* *** artifacts ** **** ** gaps ** ***** ***** frames **** ******* *** no ***** *** ********.

** ****** ***** *** clips ** ****** ** this *****. ***** *** also******** ***** ******* (** MB .*** ****).

**** ***** ** ** extreme *******, **** ***** ********* and ****** **** ********* *** demonstration ********. *******, **** small ******* ** ****** loss *** *********** ********* can **** *********** ****** on ***** *******.

Impact ** *******

** ****** ******* ***** both *** *** *** in ******** ******* *** found ****** ********** ******* the *** ** * dedicated *******. ******* ******** 250-300ms *** ******, ********** of ********. ***'* ************** design, **** ** ***** correction, *** *********** ***** overhead *** ****** ****** in * ****** *******.

*******, ** ********* (**** as ****** ******** **** large ******* ** *******) or ******* (**** ** those ***** *****-*** ******** links, *.*. **** ************), UDP *** ******* ***** latency *********.

Use ** ************

** ** *****, *** and *** *** ******* very ********* ** ********* surveillance ********, ** ***** correction *** *** ********** overhead *** **** ****** to **** **** ****.

*******, ** *********-********** ************ such ** ****** ******* or ******* ********* *** the ********, *** *** UDP **** ****** ********** and *************:

**** *******: *** ********* for Smoother *******

** **** ******* ************, it ** **** ********* that ********* ******* ****** notification ** ******, ****** UDP's ***** ******** **** useful. ******* ******** *** cause ******* ******, *** events ********* **** **** than * ******* ** frames, ******** *** ******** to ********* **** *** occured ********** ** ******* video. 

*******, ** **** ********* are ** ** ******** and ******* **** ******* the ***** *** ********* can ** ********* (**** as *******), *** ****** possible ** *** (**** in ******** *****) *** ** preferred ** ***, ** more ****** ****** *** frames *** ****.

*********: *** ********* ** ****** Errors

**** ********* * ****** via * *** ********* connection, **** ** ***** or ***, *** ** preferred. **** ***** ** ensure **** *** ****** of ***** *** ******** and ******** ** *****.

** *** ** **** for *********, **** ********* may ****** *** **** of **** ***** *** to **** *******. ** the *** ******* **** video, ** *** ******* it **** *** ******'* edge ******* *** **** in *** ****, * process ********* ********* *** TCP, ****** ***** *********.

VMS/Camera ***************

*********, ** ******* ******* both *** *** *** protocols, *** ****** ******* a ****** ********* *** switching ******* *** ***. Instead, *** *** ********** ***** protocol ****** ** ****, in **** ***** *************, and ** ****** *** manual *********.

**** ** ******* ***/*** support ** ****** *****:

******** ******* ******

******** ****** ** ****** control ** ******** *********. UDP ** **** ** default *** **** *****, both **** ****** ** recorder *** ******** ** client ******.

***********

***** ****** ** ****** control ** ******** ********* in **** *****. *** of *** ** *** is ********** ** *** camera's *******, ***** ** manufacturer ***************. *******, ** ONVIF *** **** ******* protocol *** ** ******** selected ** ********* "#*********=*" to *** ** ******* when ****** *** ******, where * ** *** or ***, **** ** this *******:

******* ******** ******

******* ****** ****** ************* of ********. ** *******, cameras *** *** ** "auto", ***** ******** ** use ********* ***, **** unicast ***, **** ***, to *******, ** ***** of ********. ** ********* is ***********, ******* *** is ****. ** *** is ********** ***********, *** is ****. **** ** found ** **** ******'* video ****** *****:

********* ********

** *******, ********* ******** connects ** ******* ***** TCP. *** ** ********* in **** ******* (*** the ******** **** ***** below), *** *** *** cameras ******* **. **** simply ** *** ***** it ** ** ********. Connections **** ****** ** client *** *** *** only.

TCP *** ***

************ ******* ******** (***) *** **** ******** ******** (***) *** *** *** **** widely **** ******* *********. Both ***** **** **** into ****** *** ******* for ************ *** ********, but **** *** *** differences **** **** **** more ** **** ******** for ******** ********: 

**********-******** **. **************

*** ******** * ********** be *** ** ******* the *** ************* *******, performed *** * ********* process, ****** **** *** be ****. **** ************ begins, each *** ** ******* is ********* ** ******** before *** **** *** is ****, ********** ** ensure *** ******* ******, and ** *** ****** order.

** ********, *** **** not ******* * ********** be ******* ***** ** transmitting. ******* *** ****** sent ** *** ********* without ********** ***** *********. Because ** ****, ****** **** and ****** *** **** common ** ***.

***** ********

**** ***** ***, *************** *** sent ** *** ********* device ***** ***** ************, ensuring *** **** *** received, *** ** *** proper *****. ******* ***** were *** ******** ******** are *************, ***** *** data ** ******** ****.

******* *** ** **************, no ***** ******** ** correction ** *********. *** sender **** *** **** or ***** ** *** if *** ********* *** received *** ******* ** one ***, ** ****** continues ******* *** **** set. ******* *** ****** out ** ***** ** not ** ***, ******* errors, *** ** ************ is ***** ** *** sending ****** ** ****** lost *******.

**** **** *********.

***** **** ** **** * * question ****

Comments (25)

How many hops did you simulate?

It appears the testing was LAN-only. In modern LANs hops aren't really going to have a measurable impact, unless you're doing some kind of PHY bridging (eg: wired to wireless to wired) and even then it's usually not a first order consideration.

A better test (IMO) would have been to load up a network to 60% capacity and show the effects of TCP and UDP or to calculate the additional overhead of TCP and approximate how many streams it would take before that started to becomes a significant impact (eg: the equivalent of 3 more video streams).

Still, this was a great example of the basic differences between the two streaming options and the trade-offs.

In the past I have seen instances where UDP or TCP would cause, or even fix streaming issues.

For example, if I was streaming H.264 through VLC using a UDP connction I may see artifacting as shown in the example above (packet loss, delay, etc). However when flipping to a TCP connection, the artifacting may go away completely (due to packets being retransmitted if lost or delayed).

However, there is no right or wrong way to do it. Choose the right protocol for your environment (if it's even changeable). It was interesting to see the VMS results and what they have available.

Based on your comments, I would think that (assuming network bandwidth and server capacity was not an issue), multi-streaming two otherwise identical streams, one for live view via UDP and one for recording via TCP, would be ideal.

But since you don't actually say that I'm wondering if there is a reason, like maybe most cameras or VMSes can't support such a configuration? Or?

Most do not support it. Genetec's stream setup lets you pick UDP or TCP per stream, and assign each stream to specific uses, so you could do it there.

Others only allow you to set UDP or TCP per camera, and others, as mentioned, not at all.

Hi Ethan, I found your article particularly useful in the context of video surveillance.

The article noted that choosing TCP may lead to the video stuttering and the subject jumping from one point in the scene to another. By contrast, UDP may provide smoother viewing of live video but can lead to smearing. However in watching the TCP and UDP videos, it seemed to me that the UDP video was not only smeared but was not smooth. It appeared to be jerky and the subject seemed to jump from one point in the scene to another with a vague ghost image joining the two points. Based on these sample videos, I don't think I would ever want to choose UDP. TCP might be jumpy but at least it is crystal clear. UDP seemed jumpy and smeared.

If a poll was run, I wonder whether TCP or UDP would be more popular for low bandwidth networks?

"If a poll was run, I wonder whether TCP or UDP would be more popular for low bandwidth networks?"

I don't think enough people know or have ever considered which to choose. I am sure there are some but I doubt there would be enough to make the poll useful.

I'd agree, and also mention that oftentimes there is no option to choose. It would be a purely hypothetical question, not practical, since many or most VMSes make the selection for you. You're probably using UDP without even knowing!

Thanks John. I'm sure you're right but I found your answer funny too.

Hi Ethan, the article states the following about recording video:

When recording a camera via a low bandwidth connection, such as cable or DSL, TCP is preferred. This helps to ensure that all frames of video are received and recorded in order.

This makes it sound as though recorded video won't suffer from stuttering or the subject jumping from one point to another in the scene. However the quizz asks:

If using TCP on a congested network, where frames are delayed, what best describes the effect it will show while playing back video?

Several negative effects are provided as possible answers. If all the frames of video are received and recorded in order, then playing back the video should not show any negative effect which seems to contradict the quizz question. I am confused by what is meant and would appreciate your clarification. Thank you for your help.

If all the frames of video are received and recorded in order, then playing back the video should not show any negative effect which seems to contradict the quizz question.

How so? Even if the video is recorded perfectly, the playback stream itself will still be affected by a congested network.

One way to tell if the degradation is due to the way the stream was recorded or just a playback issue is by replaying the same clip over and over. If it plays back the same section every time the same way, (including stuttering) then it's the recorder, if it's doesn't it's a playback issue.

Hey Luke,

The question is referring to a specific instance, playback.

So regardless of what happened with the video getting to the recorder, if there are delays on the network while trying to play back the data from the recorder you can see negative effects just on playback (that may or may not have been there on the recorded video).

Keep in mind that anytime data traverses a network it will require bandwidth to do so.

If there are questions about 'where' the symptom started, I agree with 'B'. You can playback the video multiple times to see if the problems are consistent or not. Or you can go directly to the server where the data resides and playback from there (if available), so the data does not need to traverse the network during playback.

Hi Matt and "B", thanks for setting me straight. I mixed up a couple of points which led to my misunderstanding.

The article referred to recording over a low bandwidth connection and went on to say that using TCP would help to ensure that all frames of video are received and recorded in order. I then wrongly thought the quizz question was about playing back that video locally after it had been recorded from a remote source. Now you've both helped me to realize where I made my mistake. Thanks very much. I understand this article properly now.

This was great info and never really explained this well during camera manufactorers trainings Thanks.

Hi Ian,

I agree. Most manufacturer trainings that I've experienced don't get into this level of detail.

Many times, cameras will support both and provide what the VMS or client is asking for. So there is no 'reason' for them to address this in their own training.

They are mostly interested in getting you to know their product and how to use/sell it.

My understanding on this is that if realtime viewing isn't a critical issue, I choose TCP. Only if I need live realtime (with little or no delay) I'd use UDP.

TCP has error correction so it is more likely that we get all of the video.

An old thread yes, but thought I'd share my recent experience with TCP vs UDP on my 700+ camera Qognify Ocularis system -

All (Hanwha & Samsung) cameras using UDP would drop camera connectivity 50-100 times total in a 24 hour period.

All cameras since switched to TCP drop individual camera connectivity 5-10 times total in a 24 hour period.

I don't know why the results are so radically different, but I'm sticking with TCP.

what’s the network utilization?

No quick answer for this but network availability shouldn't be the issue as all switches are newer 10GB and connected back to our centralized datacenter via government fiber network.

Some would question if that’s an acceptable level.

Some would question if that’s an acceptable level.

if by ‘drop camera connectivity’ u3 means the socket drops and the VMS has to (automatically) create a new one, imho, it’s a glitch lasting 2-3 seconds, and for 700 cameras over 24 hours, 5-10 doesn’t seem out of line.

if it requires any actual user intervention or if the recover period is longer than a few seconds, i agree it’s unacceptable.

As an update, newer versions of Avigilon do allow for a choice of TCP or UDP. In the camera connect/disconnect menu, there is a selection for "LAN" (UDP) or "WAN" (TCP).

Never use UDP. UDP is a sign of a weak protocol implementation and it's not secure. Get a life and use TCP connections.

Get a life and use TCP connections.

How do I configure a TCP Multu-cast, asking for a friend? Never is a long time.

Login to read this IPVM report.
Why do I need to log in?
IPVM conducts unique testing and research funded by member's payments enabling us to offer the most independent, accurate and in-depth information.

Related Reports

NTP / Network Time Guide For Video Surveillance on Jan 10, 2019
Inaccurate time can lead to missing or inadmissible video, yet this topic is often overlooked, with cameras and servers left defaulted,...
Verkada Cloud VMS/Cameras Tested on May 02, 2019
Verkada is arguably the most ambitious video surveillance startup in many years. The company is developing their own cameras, their own VMS, their...
Subnetting for Video Surveillance on Apr 30, 2019
This guide explains when subnetting is used on security networks, and how it works. We explain how to add or remove IP addresses to your range,...
Camera Configuration Manager Shootout - Avigilon, Axis, Bosch, Dahua, Hanwha, Hikvision on May 01, 2019
Which camera manufacturer has the best management tool? We tested 6 manufacturers - Avigilon, Axis, Bosch, Dahua, Hanwha, Hikvision to find...
Exacq Remote Cloud Access Tested on Jun 20, 2019
Remote cloud access has been missing from most VMSes (including Exacq and Milestone). Now, Exacq, after releasing Cloud Drive Storage earlier in...
Vivotek Trend Micro Cyber Security Camera App Tested on Jul 22, 2019
Vivotek and Trend Micro are claiming five million blocked attacks on IP cameras, with their jointly developed app for Vivotek cameras. This new...
Dahua Wiretapping Vulnerability on Aug 02, 2019
IPVM has validated, with testing, and from Dahua, that many Dahua cameras have a wiretapping vulnerability. Even if the camera's audio has been...
Warning: Windows 7 Update Crashing NVRs on Aug 26, 2019
Windows 7 updates are causing VMS servers to fail to boot. After running the update, impacted systems do not boot as normal, instead display this...
ONVIF Exposure To "Devastating DDoS Attacks" Examined on Sep 06, 2019
ZDnet reported "Protocol used by 630,000 devices can be abused for devastating DDoS attacks", citing exposure of ONVIF devices. And after an...
Milestone XProtect 2019 R3 'Centralized Search' Tested on Oct 30, 2019
Milestone has had problems over the last few years releasing significant new software. Now, in XProtect 2019 R3, Milestone is touting "one search...

Most Recent Industry Reports

Intersec 2020 Show Report on Jan 20, 2020
IPVM is in Dubai for Intersec, the Middle East's largest security conference. In this report, we cover the main booths and issues out of the...
Clearview AI Alarm - NY Times Report Says "Might End Privacy" on Jan 20, 2020
Over the weekend, the NY Times released a report titled "The Secretive Company That Might End Privacy as We Know It" about a company named...
Favorite Camera Manufacturer 2020 on Jan 20, 2020
The past 2 years of US bans and sanctions have shaken the video surveillance industry but what impact would this have on integrators' favorite...
Severely Impacted Mercury Security 2020 Leap Year Firmware Issue on Jan 17, 2020
One of the largest access controller manufacturers has a big problem: February 29th. Mercury Security, owned by HID, is alerting partners of the...
Apple Acquires XNOR.ai, Loss For The Industry on Jan 16, 2020
Apple has acquired XNOR.ai for $200 million, reports GeekWire. This is a loss for the video surveillance industry. XNOR.ai stunned the industry...
Installation Course January 2020 - Last Chance on Jan 16, 2020
Thursday, January 16th is your last chance to register for the Winter 2020 Video Surveillance Installation Course. This is a unique installation...
Halo Smart Vape Detector Tested on Jan 16, 2020
The Halo Smart Sensor claims to detect vaping, including popular brand Juul and even THC vapes. But how well does it work in real world...
PRC Government Entity Now Controlling Shareholder of Infinova / March Networks on Jan 16, 2020
A PRC government entity is now the controlling shareholder of US security manufacturer Infinova as well as its wholly-owned subsidiary March...
Network Cabling for Video Surveillance on Jan 15, 2020
In this guide, we explain the fundamentals of network cabling for video surveillance networks, how they should be installed, and the differences in...
ONVIF [Un]Trashed Statement, Confirms Dahua and Hikvision Still Suspended on Jan 15, 2020
ONVIF has 'trashed' the suspension statement for Dahua, Hikvision, Huawei, etc. but confirms to IPVM that those companies are all still...