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

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...
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...
Critical Vulnerability Across 18+ Network Switch Vendors: Cisco, Netgear, More on Aug 26, 2019
Cisco, Netgear and more than a dozen other brands, including small Asian ones, have been found to share the same critical vulnerability, discovered...
CheckMySystems Company Profile on Aug 14, 2019
CheckMySystems says that too many users respond, "I get an email when something is wrong" when talking about their video system maintenance plan,...
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...
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...
LifeSafety Power NetLink Vulnerabilities And Problematic Response on May 20, 2019
'Power supplies' are not devices that many think about when considering vulnerabilities but as more and more devices go 'online', the risks for...
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...
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...
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,...

Most Recent Industry Reports

FLIR New Coronavirus Prioritized Temperature Screening Camera Examined on Apr 03, 2020
FLIR has announced a new series of thermal cameras "prioritized for entities working to mitigate the spread of COVID-19 virus", the A400/A700...
ADI Branch Burglary on Apr 03, 2020
A security systems distributor branch is an odd target for burglary but that happened this week at ADI's Memphis location. Vehicle Smash &...
YCombinator AI Startup Visual One Tested on Apr 02, 2020
Startup Visual One, backed by Silicon Valley's powerful Y Combinator, aims to be "Your 24/7 Watchman" with advanced analytics and object...
Free IPVM Memberships For The Unemployed on Apr 02, 2020
IPVM is giving 3-month free memberships (regular price $99) for the unemployed, no questions asked. To get it, just contact us, your request...
Dahua Faked Coronavirus Camera Marketing on Apr 01, 2020
Dahua has conducted a coronavirus camera global marketing campaign centered around a faked detection. Now, Dahua has expanded this to the USA,...
Video Surveillance Trends 101 on Apr 01, 2020
This report examines major industry factors and how they could impact video surveillance in the next 5 - 10 years. This is part of our Video...
USA's Seek Scan Thermal Temperature System Examined on Apr 01, 2020
This US company, Seek, located down the road from FLIR and founded by former FLIR employees is offering a thermal temperature system for the...
Terrible Convergint Coronavirus Thermal Camera Recommendation on Apr 01, 2020
A week after Convergint disclosed falling revenue, pay and job cuts, Convergint is touting 'extensive research' that is either grossly incompetent...
The IPVM New Products Online Show April 2020 Opens With 40+ Manufacturers on Mar 31, 2020
IPVM is excited to announce the first New Products Online show, with 40+ manufacturers, to be held April 14 to the 16th, free to IPVM members,...