Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and...
Transcript of Achieving Low-Latency Streaming At Scale · • WebRTC • Designed for real-time audio, video and...
AchievingLow-LatencyStreamingAtScale
Introductions
JamieSherrySeniorProductManager,WowzaMediaSystems
MikeTalvensaariVP,Product&UserExperience,WowzaMediaSystems
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.
WhatisLatency?
• Latency isatimeintervalbetweenthestimulationandresponse,or,fromamoregeneralpointofview,atimedelaybetweenthecauseandtheeffectofsomephysicalchangeinthesystembeingobserved.• Intermsofstreaming,latencyisthedelaybetweentheinitialcaptureofthevideoandtheviewer.
OtherRelatedTerms
• Timetofirstframe- Timedelayfromwhenapersonclickstheplaybuttonandwhenvideoappears• BroadcastDelay– Thepracticeofintentionallydelayingthebroadcastoflivematerialtopreventprofanity,bloopers,orviolence(wikipedia)• Quality- Higherquality=higherresolution=moredatatosend• Scale- Howmanyinputs/participants,howfar,howmanyviewers• Bandwidth- Howmuchtrafficcantheinfrastructureideallyhandle• Throughput- Howmuchtrafficistheinfrastructurereallydelivering• Bitrate- Howmanybitsofdataarebeingprocessedovertime
Whyistherelatency?
Q:Whyislatencyaproblem?
A:Latencyisnotusuallyaproblem– butpeoplethinkitis.
• Formany(orpossiblymost)livestreams,latencydoesnotmatter• HTTPstreamingintentionallyintroduceslatencyforimprovedreliability.
• Forsomelivestreams,latencyiscritical.
Demo
WhatFactorsImpactLatency
Mainfactorsaffectinglatencyare:1. Quality2. Scale
LowLatency
LargeScale
HighQuality
Aseither(orboth)increaselatencyincreases
WhatFactorsImpactLatencyLow
Latency
LargeScale
HighQuality
Quality• Resolution• Two-way• Multi-thread• Framerate• Smoothplayback• Chunk/BlockSize• Buffering
Scale• Distance• Participants• Viewers• Streams• Complexity• Variability• Diverseendpoints
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
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.
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)
Wherestreaminglatencyhasbeen
• RealTimeMessagingProtocol(RTMP)• DevelopedandopensourcedbyAdobe• 1-3secondsandsometimesbelow1second
• HTTP• AppleHLS
• 30+secondsoniOS(using10secondchunks)
• MPEG-DASH• 10-20seconds(variable)
Wherelatencyisgoing
• WebRTC• Designedforreal-timeaudio,videoanddatadeliveryoverless-reliableconnections• LeveragesTCPorUDP• MultipleprotocolsrelatedtoRTSP/RTP• 1secondorless(aslowas200ms)
• WebSocket• Designedtoprovideastandardized,two-way,reliablecommunicationschannelbetweenabrowserandaserver• WorkswithTCP• CanbeusedwithotherstreamingprotocolsincludingRTMP,WebRTC,Haivision SRT,WowzaWOWZandAspera FASP• Aslowas200ms
Wherelatencyisgoing
• HTTP• Reducingto4seconds(using1secondchunks)forDASHandbelow8seconds(using2secondchunks)forHLS(includesGOPadjustmentsaswell)• CMAF+HTTP/1.1(usingHTTPChunkedTransferCoding)enablesvideotransfer,decode,anddisplaybeforetheendofthechunkencoding(“chunksofchunks”)• OptimizingDASHMPDattributes(availabilityStartTime andminBufferTime)• Videoencodingenhancementsthatdonotimpactdecoding(H.264GDR)
Wherelatencyisgoing
• QuickUDPInternetConnections(QUIC)• UsesUDP(withTCPfallback)• Focusesonsecurityandreliability• TriestobelikeTCPwhilereducingconnectandroundtriptimes,packetloss,congestioncontrol,andmoreusingintelligentretransmissionsandstorageanddeliveryofinformation• BuiltwithHTTP/2inmind
• SecureReliableTransport(SRT)• Avideotransportprotocolthatenablesthedeliveryofhigh-qualityandsecure,low-latencyvideoacrossthepublicInternet• Designedtodeliverthebestqualitylivevideoovertheworstnetworks• Accountsforpacketloss,jitter,andfluctuatingbandwidthwhilemaximizingquality
Wherelatencyisgoing
• WowzaStreamingCloudlowlatencyAPI-onlypreview• UsingWowzaWOWZ+WebSocket inanorigin-edgearchitecture• Sub3secondsend-to-end(origintoplayer)• Highlyscalable
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
Measuringlatency
• Thisisnoteasy(especiallyatscale)• Latencyiscommonlymeasuredinseconds(ormilliseconds)thoughsomepreferframes• Avisualtestiseasybutrequiresaccurateclocks(synchronizedusing“reliable”NTPservers)• For“traditional”streamingprotocols,markersinthestreamcanbeused
Optionsforlowlatencyatscale
• Buildyourown• Encoder• Server(origin/edge)• Player
• Buy• Akamai• Agora.io• WowzaStreamingCloud(preview)
Questions?
Thankyou!