Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Introduction
TheVideoLANprojectstartedatLEcoleCentraldesParisin1996.Itsgoalwasto
develophighqualitystreamingfortheCampusnetwork.In2001theprojectwentOpen
SourceprovidingacompleteHighQualityStreamingsolutionavailableundertheGPL.
TodaytheVideoLANprojectisknowforitsadherencetointernationalstreaming
standards.ThemultimediaclientandserverknownasVLCisusedastesttool,by
Universities,R&Ddepartments,Mobile,Cablemodem,SettopboxandStreaming
Servermanufacturers.VLCisalsousedincommercialproducts(Freebox,Di.com).
AcommonmisconceptionisthatVLCmediaplayerisonlyaclient,butitisalsoa
multimediastreamer.Originallyitwasonlyaclient,butsinceitgainedmultimedia
streamingcapabilitiesthedifferencebetweenclientandserverfunctionalityhasvanished
andthenamewaschangedfromVideoLANClienttoVLCmediaplayer.Thenaming
contributestotheconfusionthatsomenewusersexperience.
TheVideoLANprojectprovidesacompletestreamingsolutionthatisreadytobe
deployedinanenterpriseorhomestreamingsystem.Itincludesastreamingserver,client
andminiSAPserverformultipleplatforms.
Page 1/17
Figure1:VideoLANnetworkarchitecture
Figure1showsthatVLCcanusedifferenttypesofhardwareasinput.Tonameafew:
DVD,VCD,SVCDdrives,Acquisition,Encodingcards(PVR250/350),Satellitedish
(DVBS/C)andTerrestrialTV(DVBT).Thefigureisnotcompleteitomits:Webcams,
DVcamcorders,networkcameras(AXIS),DirectShow/DirectXdevicesandmore.
Allthosedevicesandinputsrequireabroadsupportofcodecs:QuickTime,WMV1/2,
MPEG1/2/3/4,Ogg,Vorbis,Theoraand3GPP.VLCmediaplayercanplayalmostall
multimediaformatsavailabletoday(aslongasanOpenSourcecodecimplementationis
available).Afulllistoffeaturescanbefoundonlineat
http://www.videolan.org/vlc/features.html.
VLCsstreamingcapabilitieshavesurpassedthatoftheVideoLANserver(whichwas
thefirstapproachtoastreamingserver).TheVideoLANserverisnolongerdeveloped
andconsidereddeprecated,butthesourcecodeisstillavailableonline.
TheVideoLANsolutionhasbeenportedtomanyoperatingsystems,amongstwhichyou
willfind:MacOSX,Win32/95/98/XP/2000/2003,Linux(RH,SuSE,Mandrake,Gentoo,
Debian,Familiar)BeOS,QNX,PocketPC,*BSD(Free,Net,OpenBSD).Italsorunson
awiderangeofdevices:PCs,MacOSX,laptops,settopboxes,PDAandmobilephones.
(C) 2006, Jean-Paul Saman
Page 2/17
ThechallengeoftheVideoLANteamistosupportallthoseenvironmentsandoperating
systemsasgoodaspossible.Itisdifficulttofindenoughpackagemaintainersand
developersthatassistinbugfixing,inimplementingnewfeaturesandinportingVLCto
otherplatformsordevices.
Streaming networks
Astreamingnetworkcanbeorganizedindifferentways.Allhavedifferentproperties,
advantagesanddisadvantages.Inthischapter4differentformswillbediscussed:
broadcast,unicast,multicastandvideoondemand(VOD).
Broadcast
Inabroadcaststreamingnetworkthestreamingserversendsthemultimediastreamtothenetworks
broadcastaddress.Clientslikevideoplayersorsettopboxeslistentothebroadcastaddressortoaspecific
port.Eachmultimediastreamissentonadifferentportnumber.
Definition:
Continuousstreamingofmultimediacontenttoacompletenetworksegment(subnet,netmaskeg:
172.16.10.255).
Figure2:Broadcastnetwork
Disadvantage:
Allstreamsaresenttoacompletesubnetcontinuously.
Page 3/17
Bandwidthofnetworkisinefficientlyused.
Allclientssharethesamestream.
Aclientcannotcontrolthestreamwithpause,play,stop,fastforwardorrewindcommands..
Advantage:
Allstreamsareavailableeverywhereonthenetwork.
HereisacommandlineexamplewithVLCasbroadcaststreamingserverandasclient.
VLCasstreamingserver:
$>vlcterminator_240x192\@750.mpgsout'#std{access=udp,mux=ts,dst=192.168.0.255}'
VLCasclient:
$>vlcudp://
Theserverintheaboveexamplestreamsthemultimediacontenttoport1234.ThisisVLCdefaultport.Ifa
settopboxisusedasclientthenconfigureittolistenonport1234.
Unicast
Inaunicaststreamingnetworkthestreamingserversendsthemultimediastreamtoadefinedsetofip
addresses.Clientslikevideoplayersorsettopboxeslisteneachtotheirownaddressortoaspecificport.
Eachmultimediastreamissentonadifferentportnumberandipaddress.
Definition:
Continuousstreamingofmultimediacontenttoanumberofknownipaddresses.Everyviewerhas
itsownprivatestream.
Page 4/17
Figure3:Unicastnetwork
Disadvantage:
Streamsaresenttoonlyanumberofknownclients(ipaddresses).
Inflexiblesetup;addingnewclientsmeansstartinganewstream.
Streamissentevenwhentheclientisnotlistening.
Aclientcannotcontrolthestreambyusingpause,play,stop,fastforwardorrewindcommands.
Advantage:
Betterusageofnetworkbandwidth.
Eachclienthasaprivatestream.
HereisacommandlineexamplewithVLCasunicaststreamingserverandasclient.
VLCasstreamingserverstreamingusingthedefaultport1234:
$>vlcterminator_240x192\@750.mpgsout'#std{access=udp,mux=ts,dst=192.168.0.184}'
$>vlcdvdsimple:///dev/dvdsout'#std{access=udp,mux=ts,dst=192.168.0.20}'
VLCasclientlisteningonthedefaultport1234:
$>vlcudp://
Page 5/17
Multicast
Inamulticaststreamingnetworkthestreamingserversendsthemultimediastreamtoamulticastgroup(in
the224.0.0.0to239.255.255.255range).ClientslikevideoplayersorsettopboxessendamulticastJOIN
messagetothenearestrouter/switch.Therouter/switchthenforwardstherequestedmulticastchannel
towardsthelisteningmultimediaclient.Eachmultimediastreamsissentonadifferentmulticastip
address.
Definition:
Continuousstreamingofmultimediacontenttomultipleviewerswithoutunnecessaryduplication
ofthesourcestream.Everyviewersharesthesamemultimediacontentstream.
Figure4:Multicastnetwork
Disadvantage:
Multipleclientssharethesamestreamandcannotcontrolitwithpause,play,stop,fastforwardor
rewindcommands.
Serverstreamsallstreamstoitsnearestrouter/switchevenwhennoclientiswatching.
Advantage:
Bestuseofnetwork,streamsareduplicatedatthenetworklevelclosesttotheclient.Allclients,
servers,switchesandroutersmustsupportmulticast.
Amulticastnetworkishardertosetupthanabroadcastorunicastnetwork.Allclients,servers,routers
andswitchesmustsupportit.Makesureyouroperatingsystem(ofclientandserver)hasmulticastenabled
andamulticastrouteexistinitsroutingtable.Thefollowingexampleaddsamulticastrouteonaunix
(C) 2006, Jean-Paul Saman
Page 6/17
Gateway
Genmask
Use Iface
192.168.0.0
255.255.255.0
0 eth0
169.254.0.0
255.255.0.0
0 eth0
224.0.0.0
240.0.0.0
0 eth0
default
192.168.0.250
0.0.0.0
UG
0 eth0
Deployingmulticaststreamingforalocalareanetworkrequiresmappingofmultimediastreamstoip
addresses.Whichaddressofthemulticastgroup,definedfrom224.0.0.0uptill239.255.255.255,canbe
used?Onlyasmallportionoftheentirerangeisavailableforusebymulticastapplications.TheInternet
EngineeringTaskForce(IETF)hasanRFC,number3171,thatdefinestheaddressrangesthatare
availableformulticasttraffic(http://www.ietf.org/rfc/rfc3171.txt?number=3171).Inthefollowingtablean
overviewofthatdefinitionisgiven:
Addressrange
Netmask
Description
224.0.0.0224.0.0.255
224.0.0/24 LANprotocoltrafficbetweenrouters/switches.
224.0.1.0224.0.1.255
224.0.1/24 Internetprotocoltrafficbetweenrouters/switches.
Page 7/17
Netmask
224.0.2.0224.0.255.0
Description
ADHOCBlock(globallyroutedaddresses).
224.1.0.0224.1.255.255
224.1/16
STMulticastGroups
224.2.0.0224.2.255.255
224.2/16
SDP/SAPBlockisforapplicationsthatreciveaddresses
throughtheSDP(RFC2974)protocol.
224.252.0.0224.255.255.255
DISTransientBlock
225.0.0.0231.255.255.255
RESERVED
232.0.0.0232.255.255.255.255 232/8
SourceSpecificMulticastBlock(localtothehost)
233.0.0.0233.255.255.255
GLOPBlock(globallyscopedstaticallyassignedgroup).
233/8
234.0.0.0238.255.255.255
239.0.0.0239.255.255.255
RESERVED
239/8
AdministrativelyScopedBlock.Addressesforlocal
withinadomain.
Addressesintherange239.0.0.0239.255.255.255canbesafelyusedwithinadomainformulticast
applicationtraffic.Routersandswitchesuseaddressfrom224.0.0.0to224.0.0.255andfrom224.0.1.0to
224.0.1.255forcommunication.Usingaroutefromtheserangesisilladvised.
HereisacommandlineexamplewithVLCasmulticaststreamingserverandasclient.
VLCasstreamingserver:
$>vlcterminator_240x192\@750.mpgsout'#std{access=udp,mux=ts,dst=239.255.255.184}'
ttl=3
$>vlcdvdsimple:///dev/dvdsout'#std{access=udp,mux=ts,dst=239.255.255.22}'ttl=3
VLCasclient:
$>vlcudp://@239.255.255.184
Intheaboveexamplettl=3isaddedtotheservercommandline.ATTListhetimetolivevaluethatis
ineveryIPpacket.Ittellshowmanyrouters/switchesaIPpacketmaycrossbeforeitistobediscarded.
VLChasasdefaultattlof0,soalltrafficstayslocalanddoesnttraveloutofthelocalnetwork.Ifthere
aremultipleswitches/routersinyournetwork,thenyoumustenlargethenumber.Itshouldbeatleastset
tothenumberofswitches/routersbetweenserverandclientplusone.
Page 8/17
Video On Demand
InaVideoOnDemand(VOD)streamingnetworkthestreamingserverdoesntsendmultimediacontentby
default.Insteaditwaitsforarequest.
Definition:
Multimediacontentisonlystreamedtoviewersthatrequestitexplicitly(ondemand).Each
viewerhasitsownprivatestream.
Figure5:VideoOnDemand(VOD)network
Disadvantage:
Eachclientstartsanewstreamattheserver.
Advantage:
Eachclienthasaprivatestreamandcontrolsitbyusingpause,play,stop,fastforwardorrewind
commands.
Onlystreamsthatareviewedarestreamedoverthenetwork.
Betteruseofavailablebandwidth.
VLChasamodethatallowsittoworkasaVODserver.ThismodeiscalledVLM(VideoLANMedia)
andiscontrolledthroughthetelnetinterface.AVODserverusestheRTSPprotocol(RFC2326)tocontrol
theclientsrequest.ThedefaultRTSPserverportis554,butonlyarootusermayopenanyportbelow
(C) 2006, Jean-Paul Saman
Page 9/17
UsetelnettoconnecttotheVLCtelnetinterfaceonport4212:
$>telnetlocalhost4212
Trying127.0.0.1...
Connectedtolocalhost.localdomain(127.0.0.1).
Escapecharacteris'^]'.
Password:admin
Welcome,Master
>newterminatorvodmuxmp2tenabled
>setupterminatorinput/home/media/video/terminator/terminator_240x192\@750.mpg
>newdvdvodmuxmp2t
>setupdvdinputdvdsimple:///dev/dvd
>setupdvdenabled
VLCasclient:
$>vlcrtsp://192.168.0.5:5554/terminator
or
$>vlcrtsp://192.168.0.5:5554/dvd
Firewalls
Intheaboveparagraphsseveralsetupsforastreamingserverhavebeendiscussed.Normallyyouwould
testtheserversetupfirstontheserversystembyrunningtheclientlocally.Thenextstepisthentorunthe
clientonanothermachinethathasaccesstotheserver.Atthispointyoullfindoutthatitworkslocally,
butnotonanothermachine.Whatistheproblem,youwonder?
(C) 2006, Jean-Paul Saman
Page 10/17
Figure6:Firewallonserverblockingtraffic
Firewallsprotectyourmachinefromunauthorizedaccess,butcanalsohinderyouwithallowedaccess.In
theabovescenariothefirewallismostlikelytoblockthetrafficfromthestreamingserver.Aquickwayof
checkingthisistodisablethefirewallonserverandclientsystem,temporarily.OnLinuxsystemsyoucan
doasrootonbothclientandserver:
$>/etc/init.d/iptablesstop
Thefirewallisnowdisabledandtestingthestreamingsetupwiththeclientonanothercomputercanbe
done.Ifthisworks,thenenablethefirewallonthestreamingserverandtestagain.
Checkwithanetworksnifferliketcpdumporetherealifmultimedianetworktrafficisleavingtheserver.
VLCusesport1234bydefaultforunicast.Seebelowtheoutputforatcpdumpsessioninwhichnotraffic
isleavingtheserveronport1234.
Page 11/17
0packetscaptured
0packetsreceivedbyfilter
0packetsdroppedbykernel
Thefollowingtcpdumpoutputshowstrafficthatisleavingthestreamingserveronport1234.
$>/usr/sbin/tcpdumpieth0port1234
tcpdump:verboseoutputsuppressed,usevorvvforfullprotocoldecode
listeningoneth0,linktypeEN10MB(Ethernet),capturesize96bytes
10:53:55.205169IPserver.m2x.nl.32789>192.168.0.200.1234:UDP,length1500
10:54:19.418686IPserver.m2x.nl.32789>192.168.0.200.1234:UDP,length1316
10:54:19.454679IPserver.m2x.nl.32789>192.168.0.200.1234:UDP,length1316
10:54:19.490681IPserver.m2x.nl.32789>192.168.0.200.1234:UDP,length1316
Ifthereisstillnotrafficleavingtheserver,thenaportontheserversfirewallneedstobeopen.Inour
unicastexampleport1234needstobeallowedtoleavetheserver.
$>iptablesARHFirewall1INPUTpudpmudps192.168.0.0/24sport1234jACCEPT
Ifnetworktrafficisleavingtheserver,thenenablethefirewallontheclientside.Startupthevideoplayer
(orusetcpdump,ethereal)ontheclientandseeifvideostartsplaying.Ifitdoesnt,thenthefirewallonthe
clientsideneedstoopenaport.Forinstance(vlcsdefaultport1234):
$>iptablesARHFirewall1INPUTpudpmudps192.168.0.0/24dport1234jACCEPT
Note:thedifferencebetweentheabovetwofirewallrules.Ontheclientsideyouopenthedestinationport
(dport1234)ontheserversideyouopenthesourceport(sport1234).
IncaseofVideoOnDemand(RTSP)theclientneedstosendanSETUPrequesttotheRTSPserver.The
firewallshouldaccepttraffictotheRTSPport(defaultportis554).IntheChapteraboutVideoOn
Demandthecommandlineexampleusedport5554forRTSPtraffic,becausethenVLCcanrununder
(C) 2006, Jean-Paul Saman
Page 12/17
Bandwidth
Initiallytheserversystemssendsonlyafewstreamsatthesametime.Afterawhilethereisaneedtoadd
morestreams.Thequestionhoweverishowmanycanbeadded?Itturnsoutthisquestionisnotthateasy
toanswer.Thenetworkinfrastructuredefinesthemaximumavailablebandwidth,whileamultimedia
streamconsumespartofthatbandwidth.Illdividetheseintwoparagraphdiscussingwhatnetwork
bandwidthisavailableandhowmuchbandwidthamultimediastreamconsumes.
Network bandwidth
Todaymostsystemshavea100/1000MbpsNICandareconnectedtoa100MbpsLocalAreaNetwork
(LAN).Howeverthisdoesntmeanthatyournetworkorconnectionisconfiguredtousethefull100Mbps.
Itdependsonthetypeofhubs,switchesorroutersthatareusedinthenetworkinfrastructure.Inour
examplethe100/1000MbpsNICcouldbeconnectedtoa10Mbpshub.Ifthisisthecasethenyour
streamingservercanstreamatheoreticalmaximumof10Mbpsevenwhenitcapableofusingthefull100
Mbps.
Thetooldmesg(underLinux)showsthebootlogfromtheLinuxkernel.Itcantellyouwhatnetwork
settingsareusedbythesystem.Isitona100Mbpsora10Mbpsnetworkconnection?
Page 13/17
In
theaboveoutputtherearethreesettingsthatareimportanttocontrol:speed,autonegoriationandduplex
mode.Fixthesethreesettingstothemaximumthatyournetworkequipmentiscapableoff.Togeta
reliable100Mbpsnetworkdisabletheautonegotiation,becauseitdoesntalwaysusethebestsettingthat
isavailable.
Inourexampleabovefullduplexmodeisused,whichmeansthe100Mbpsisinbothdirectionsatthe
sametime.Ifitsayshalfduplex,thenthenetworkconnectionwillhavetotaketurnsinusingthecable.
Thiswillresultinextradelaysforthenetworkconnections.
Allnetworkequipment:hubs,routersandswitchesbetweenstreamingserverandclientmustsupportthe
samesettings.Inourexampletheyallneedtosupport100Mbps,noautonegotiationandfullduplexin
theirnetworkconnections.Onceallsystems(serverandclient)NICs,hubs,routersandswitchesare
configuredcorrectly,then7080%oftheircapacitycanbeusedformultimediastreaming.
Bandwidth
DVBC/S/T
Average:3.5MbpsMaximum:5Mbps
DVD
Average:5MbpsMaximum:10Mbps
Page 14/17
Bandwidth
AcquisitionCard
Variesbutmostare1Mbps
WebCam
Variesbutmostare<1Mbps
Files
Variesbutmostare<1Mbps
Thetablealreadyindicatesthereisnosuchthingasthebandwidthforamultimediastream.When
usingfilesasinputitisevenmoredifficulttopredictwhatthebandwidthwillbe,becauseofthemany
differentwaysitcanbeencoded(MPEG2,MPEG4.DivX,H264,Theora,etc.).
Thebandwidthofamultimediastreamisnotconstant.Itvariesovertime,thisiscalledVariablebitrate
(VBR).Inthefollowingfigurethisisillustratedwithafictiveexample.Forclaritytheaverage,realand
maximumbandwidthhavebeenplotted.
bandwidth (Mbps)
4.5
4
3.5
3
Average
Real
Maximum
2.5
2
1.5
1
0.5
0
60
420 480
540 600
840 900
960
time (ms)
Figure7:Multimediastreambandwidthexample
ThebitrateisvariablebecauseAudio/Videoencoderspartitionthevideoindifferenttypeofframes.These
frameshavedifferentsizes.TheyarecalledIntracoded(Iframe),Predictivecoded(Pframe)and
Bidirectionallypredictivecoded(Bframes).TheIframeisthelargestframe,followedbythePandB
frame.
IPBBPBBBPBBP
AvideostreamisconstructedofacombinationofI,PandBframes.Thehighestpeakinthebandwidth
iscausedbyanIframe.PandBframescausesmallerpeaks,sincetheycarrylessinformationthananI
frame.APframeneedsinformationfromanIframe,andaBframeneedsbothPandotherBframes.
ConstantBitrate(CBR)streamsareactuallyvariablebitratestreamspaddedwithzeros.
Figure7showsthattheaveragebandwidthandrealbandwidthneverexceedthemaximummultimedia
(C) 2006, Jean-Paul Saman
Page 15/17
Network planning
Whenplanningamultimedianetworkthemaximumbandwidthofthestreamistakenintoaccount.Notthe
averagebandwidth,becausethatwillresultinnetworkpacketlossifseveralofthepeaksoccuratthesame
time.Thenthereissimplynotenoughbandwidthavailable.Droppedpacketsmanifestitselfinlossof
pictureandlossofaudioquality.
InaboveexampleUDPnetworktransportisassumed.UDPisaunreliablenetworkprotocolsinceit
doesntcorrectlostpackets.WhenanUDPpacketisdroppedinthenetworkthenitislostforever.You
mightbetemptedtouseTCPbasedprotocolsinsteadtocountertheproblem.Thinkagain.UDPtrafficis
onlydroppedatthenetworklevelwhenthereisnotenoughbandwidth,butaTCPpacketisretransmitted
whendropped.Theretransmissionhappensonanalreadyloadednetwork!
WhenaTCPpacketisdroppedonthenetwork,theserverwillnoticethisandretransmitsthelostpacket.If
thenetworkisloadedthenthiswillresultinevenmorepacketloss.Theretransmissionmakestheload
evenhigher.ThisiswhatIcalltheTCPcascadeeffect.InastreamingnetworkaTCPbasednetworkwill
failsoonerthenanUDPnetwork.Withmultimediastreamingthereisonlyasmallwindowintime(40ms
200ms)thatalostpacketisstilluseful.Ifitarriveslater,thenitwillbetoolatetodecodeanddisplayand
isthusdroppedbythemultimediaplayer.
Thefollowingtableshowthenumberofmultimediastreamsanetworkcanhandleusingasatellite(DVB
S)assource.Remembertoloadyournetworkonlyfor80%.
Network
Maxload
#Streams
10Mbps
8Mbps
100Mbps
80Mbps
16
Streamingmultimediainthesamequalityasthesource(thinkofDVDsorDVBsstreams)consumesmost
ofthebandwidthavailable.IntheabovetableonlyoneDVBstreamcanbesentona10Mbpsnetwork,
while16streamscanbesentona100Mbpsnetwork.Toovercomethislimitationthequalityofthestream
canbelowered.
Loweringthequalityofthesourcestreamisdoneusingatechniquecalledtranscoding.Transcoding
involvesthecompletedecodingofthesourcestreamandencodingitwithnewsettings.Thisprocesswill
reducethequalityofthesourcestream.IntheexamplebelowaDVD(typicalbandwidthupto10Mbps)is
transcodedtoastreamof1,5Mbpsonaverage.
Page 16/17
Maxload
#Streams
10Mbps
8Mbps
100Mbps
80Mbps
53
Summary
TheVLCmediaplayerisbothastreamingserverandamultimediaplayercapableof
playingalmostallmultimediafiles.AslongasthereisanOpenSourcecompatible
implementationoftheunderlyingcodecs.VLCmediaplayeriswellknownforits
compliancetostreamingstandardsandusedbyindustryplayersinthebroadcast,
consumersandR&Dfield.ItiseasytosetupusingtheGUIwizardoroneoftheother
interfacesthatVLCoffers.
TheVideoLANwebsitehostsHOWTOdocumentsdescribingthemostusedVLC
optionsandoffersvarioussupportchannels(IRC,mailinglists,Forums).
SettingupastreamingserverandnetworkusingVLCmediaplayerrequiresknowledge
ofnetworkinginfrastructureandmultimediacharacteristics.Incaseoftroublesthereis
alwaystheVideoLANsupportchannelswherethedevelopershangout.Thebestadvise
todebugaproblemistostartsimpleandscaleupfromthere.
Page 17/17