Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and...

24
Achieving Low-Latency Streaming At Scale

Transcript of Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and...

Page 1: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple

AchievingLow-LatencyStreamingAtScale

Page 2: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple

Introductions

JamieSherrySeniorProductManager,WowzaMediaSystems

MikeTalvensaariVP,Product&UserExperience,WowzaMediaSystems

Page 3: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple

Foundedin2005,Wowza offersacompleteportfoliotopowertoday’svideostreamingecosystem fromencodingtodelivery.Wowza providesbothsoftwareandmanagedstreaming servicesforproducers,developersandengineerstobuilduniquestreaming experiencesforanydeviceoraudiencesize.Wowza StreamingEngineisWowza’sflagshipaward-winningmediaserversoftware.Wowza StreamingCloudis anend-to-endlivestreamingservice.Wowza alsooffersWowza GoCoder amobileSDKandfreeappforlivestreamingandWowza Player,amodernHTML5videoplayerthatistightlyintegratedwithotherWowza products.

Page 4: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple

WhatisLatency?

• Latency isatimeintervalbetweenthestimulationandresponse,or,fromamoregeneralpointofview,atimedelaybetweenthecauseandtheeffectofsomephysicalchangeinthesystembeingobserved.• Intermsofstreaming,latencyisthedelaybetweentheinitialcaptureofthevideoandtheviewer.

Page 5: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple

OtherRelatedTerms

• Timetofirstframe- Timedelayfromwhenapersonclickstheplaybuttonandwhenvideoappears• BroadcastDelay– Thepracticeofintentionallydelayingthebroadcastoflivematerialtopreventprofanity,bloopers,orviolence(wikipedia)• Quality- Higherquality=higherresolution=moredatatosend• Scale- Howmanyinputs/participants,howfar,howmanyviewers• Bandwidth- Howmuchtrafficcantheinfrastructureideallyhandle• Throughput- Howmuchtrafficistheinfrastructurereallydelivering• Bitrate- Howmanybitsofdataarebeingprocessedovertime

Page 6: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple

Whyistherelatency?

Page 7: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple

Q:Whyislatencyaproblem?

A:Latencyisnotusuallyaproblem– butpeoplethinkitis.

• Formany(orpossiblymost)livestreams,latencydoesnotmatter• HTTPstreamingintentionallyintroduceslatencyforimprovedreliability.

• Forsomelivestreams,latencyiscritical.

Page 8: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple
Page 9: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple

Demo

Page 10: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple

WhatFactorsImpactLatency

Mainfactorsaffectinglatencyare:1. Quality2. Scale

LowLatency

LargeScale

HighQuality

Aseither(orboth)increaselatencyincreases

Page 11: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple

WhatFactorsImpactLatencyLow

Latency

LargeScale

HighQuality

Quality• Resolution• Two-way• Multi-thread• Framerate• Smoothplayback• Chunk/BlockSize• Buffering

Scale• Distance• Participants• Viewers• Streams• Complexity• Variability• Diverseendpoints

Page 12: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple

HowQualityInjectsLatencyHigherquality=higherresolution=moredatatosend• Resolutionincreasestheamountofdatainanyframe,block,chunkortimeslice.Ifweholdinfrastructureconstantasresolutiongoesupthewindowandlatencytodeliverasegmentincreases.• Trade-offs:Somemitigationtechniques

IncreasingThroughputIncreasingthroughputwithmorebandwidth(network)andbitrate(compute)=Moreinfrastructure,moreoverhead,morecost

ReducingBufferReducingthebufferrequirementwillreducelatencybutitalsomakesnetworkfluctuationsmorevisibletotheviewer– e.g.a1msbufferideallymeanscontentcanbeviewedaslittleas1msaftercapturebuta0.1-secondnetworkinterruptionwillresultin100buffersegmentsbeingun-recoverableinalivestream.

ReducingFramerateReducingthe(framerate)numberofframespersecondreducesthesmoothnessoftheviewingexperience– e.g.15fpsisgenerallyagoodviewingexperienceforlowmovementbroadcastslikepresentationscreencapture/sharingormanychurchservices,itwillproduceachoppyexperienceforviewingsports

Page 13: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple

HowScaleInjectsLatencyScaleincreasesdistances,complexityandvariability• Asdistance,thenumberofstreams,andviewersincrease,networkimperfections,variability,anddegradationincreaseandcanamplifylatency.• Trade-offs:Somemitigationtechniques

IncreasingThroughputIncreasingthroughputwithmorebandwidth(network)andbitrate(compute)=Moreinfrastructure,morecomplexity,moreoverhead,morecost

IncreasingBufferIncreasingbuffersizeaddsabilityforbothencoders,transcodersandplayerstodealwithvariabilitysmoothlybutincreasingbufferinherentlyincreaseslatency.Bydefinition,buffersizeistheminimumamountofdataforwhichaprocesscanbeinitiated.Ifmoredatamustbeaccumulated,thenprocessingwilltakelonger.

TCPvsUDPBecauseitisalighterweightprotocolwithouterrorchecking,monitoring,orderofmessagingandheadersroughly1/3thesizeofTCP,UDPisinherentlyfasterbutthereisnoguaranteedataisreceived.

Page 14: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple

Wherestreaminglatencyhasbeen

• WindowsMedia• MMS,RTSP,HTTP(usingUDPorTCP)• Encoder,Server,andPlayerbuffersizemanagement• “Lowdelay”audiocodecs• FastStart,AdvancedFastStart,FastRecovery,FastReconnect,FEC• 2-3seconds(onagoodnetwork)

• RealTimeStreamingProtocol(RTSP)• DevelopedandbyRealNetworks• ReliesonRTPandRTCP• Framescanbesentoneatatimeinrealtime• CanleverageUDP• Potentiallatencycouldbeaslowas~125ms withminimalbuffering(2-3framesbehind)

Page 15: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple

Wherestreaminglatencyhasbeen

• RealTimeMessagingProtocol(RTMP)• DevelopedandopensourcedbyAdobe• 1-3secondsandsometimesbelow1second

• HTTP• AppleHLS

• 30+secondsoniOS(using10secondchunks)

• MPEG-DASH• 10-20seconds(variable)

Page 16: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple

Wherelatencyisgoing

• WebRTC• Designedforreal-timeaudio,videoanddatadeliveryoverless-reliableconnections• LeveragesTCPorUDP• MultipleprotocolsrelatedtoRTSP/RTP• 1secondorless(aslowas200ms)

• WebSocket• Designedtoprovideastandardized,two-way,reliablecommunicationschannelbetweenabrowserandaserver• WorkswithTCP• CanbeusedwithotherstreamingprotocolsincludingRTMP,WebRTC,Haivision SRT,WowzaWOWZandAspera FASP• Aslowas200ms

Page 17: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple

Wherelatencyisgoing

• HTTP• Reducingto4seconds(using1secondchunks)forDASHandbelow8seconds(using2secondchunks)forHLS(includesGOPadjustmentsaswell)• CMAF+HTTP/1.1(usingHTTPChunkedTransferCoding)enablesvideotransfer,decode,anddisplaybeforetheendofthechunkencoding(“chunksofchunks”)• OptimizingDASHMPDattributes(availabilityStartTime andminBufferTime)• Videoencodingenhancementsthatdonotimpactdecoding(H.264GDR)

Page 18: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple

Wherelatencyisgoing

• QuickUDPInternetConnections(QUIC)• UsesUDP(withTCPfallback)• Focusesonsecurityandreliability• TriestobelikeTCPwhilereducingconnectandroundtriptimes,packetloss,congestioncontrol,andmoreusingintelligentretransmissionsandstorageanddeliveryofinformation• BuiltwithHTTP/2inmind

• SecureReliableTransport(SRT)• Avideotransportprotocolthatenablesthedeliveryofhigh-qualityandsecure,low-latencyvideoacrossthepublicInternet• Designedtodeliverthebestqualitylivevideoovertheworstnetworks• Accountsforpacketloss,jitter,andfluctuatingbandwidthwhilemaximizingquality

Page 19: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple

Wherelatencyisgoing

• WowzaStreamingCloudlowlatencyAPI-onlypreview• UsingWowzaWOWZ+WebSocket inanorigin-edgearchitecture• Sub3secondsend-to-end(origintoplayer)• Highlyscalable

Page 20: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple

Reducingworkflowcomponentlatency

• Youneedtothinkaboutitateverystep• Contentcreation(codec,bitrate,resolution)• Streamingworkflowanddevices• Buffermanagement(encoder,player)• Networkconsiderations

• Howyouoptimizedelivery(protocol,transportlayer)• Howyoureachyouraudience(size,location,andquality)

• WebRTC andWebSocket canscaleusingtraditionalorigin/mid-tier/edgeconfigurations(stillrequires“aware”clients)• CDNsareinvestigatingoptionstoenablelowlatencythroughtheirnetworks• “Tuned”HTTPisafrontrunner

Page 21: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple

Measuringlatency

• Thisisnoteasy(especiallyatscale)• Latencyiscommonlymeasuredinseconds(ormilliseconds)thoughsomepreferframes• Avisualtestiseasybutrequiresaccurateclocks(synchronizedusing“reliable”NTPservers)• For“traditional”streamingprotocols,markersinthestreamcanbeused

Page 22: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple

Optionsforlowlatencyatscale

• Buildyourown• Encoder• Server(origin/edge)• Player

• Buy• Akamai• Agora.io• WowzaStreamingCloud(preview)

Page 23: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple

Questions?

Page 24: Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and data delivery over less-reliable connections • Leverages TCP or UDP • Multiple

Thankyou!