ffmpeg streaming: udp vs. rtp when there are out of order packets.




h1         s2

    \      /      \

      s1          s6 - h3

    /      \      /

h2         s3


h1 will use ffmpeg streaming with udp or rtp method to h3. The S1 will split the traffic 50% to S2 and 50% to S3. So the out of order packets may occur when h3 receives packets sent from h1.


[mininet script:2PATH.py]



Script created by VND - Visual Network Description (SDN version)


from mininet.net import Mininet

from mininet.node import Controller, RemoteController, OVSKernelSwitch, OVSSwitch, UserSwitch

from mininet.link import Link, TCLink

from mininet.cli import CLI

from mininet.log import setLogLevel

def topology():

    "Create a network."

    net = Mininet( controller=Controller, link=TCLink, switch=OVSKernelSwitch )

    print "*** Creating nodes"

    h1 = net.addHost( 'h1', mac='00:00:00:00:00:01', ip='' )

    h2 = net.addHost( 'h2', mac='00:00:00:00:00:02', ip='' )

    h3 = net.addHost( 'h3', mac='00:00:00:00:00:03', ip='' )

    s1 = net.addSwitch( 's1', protocols=["OpenFlow10,OpenFlow13"], listenPort=6674, mac='00:00:00:00:00:04' )

    s2 = net.addSwitch( 's2', protocols=["OpenFlow10,OpenFlow13"], listenPort=6675, mac='00:00:00:00:00:05' )

    s3 = net.addSwitch( 's3', protocols=["OpenFlow10,OpenFlow13"], listenPort=6676, mac='00:00:00:00:00:06' )

    s6 = net.addSwitch( 's6', protocols=["OpenFlow10,OpenFlow13"], listenPort=6679, mac='00:00:00:00:00:09' )

    c9 = net.addController( 'c9', controller=RemoteController, ip='', port=6633  )

    print "*** Creating links"


    net.addLink(h1, s1)

    net.addLink(h2, s1)

    net.addLink(s1, s2, cls=TCLink, **link1)

    net.addLink(s1, s3)

    net.addLink(s2, s6)

    net.addLink(s3, s6)

    net.addLink(s6, h3)

    print "*** Starting network"



    s1.start( [c9] )

    s2.start( [c9] )

    s3.start( [c9] )

    s6.start( [c9] )

    print "*** Running CLI"

    CLI( net )

    print "*** Stopping network"


if __name__ == '__main__':

    setLogLevel( 'info' )



[scripts for the openvswitches:SC.sh]

ovs-ofctl -O OpenFlow13 add-group s1 group_id=0,type=select,bucket=weight:50,output=3,bucket=weight:50,output=4

ovs-ofctl -O OpenFlow13 add-flow s1 in_port=4,ip,nw_dst=,actions=output=1

ovs-ofctl -O OpenFlow13 add-flow s1 in_port=4,ip,nw_dst=,actions=output=2

ovs-ofctl -O OpenFlow13 add-flow s1 in_port=4,dl_type=0x0806,actions=flood

ovs-ofctl -O OpenFlow13 add-flow s1 in_port=1,actions=group=0

ovs-ofctl -O OpenFlow13 add-flow s1 in_port=2,actions=output=3

ovs-ofctl -O OpenFlow13 add-flow s2 in_port=1,actions=output=2

ovs-ofctl -O OpenFlow13 add-flow s2 in_port=2,actions=output=1

ovs-ofctl -O OpenFlow13 add-flow s3 in_port=1,actions=output=2

ovs-ofctl -O OpenFlow13 add-flow s3 in_port=2,actions=output=1

ovs-ofctl -O OpenFlow13 add-flow s6 in_port=1,actions=output=3

ovs-ofctl -O OpenFlow13 add-flow s6 in_port=2,actions=output=3

ovs-ofctl -O OpenFlow13 add-flow s6 in_port=3,actions=output=2



Method 1. UDP streaming




UDP Streaming-> h1:sender, h3 receiver



Decode the received video into YUV format


Compare with the original YUV to get PSNR

The result is very bad.

We can also use ffplay to see the received video.

Because there is no sequence number information. The receiver cannot handle the out of order packets well.


RTP method

H1:sender, H3:receiver



It is better than UDP transmission method.


Note. When h1 is transmitting, the h3 can also use “ffplayi rtp://” to directly see the received results.


Dr. Chih-Heng Ke (smallko@gmail.com)

Department of Computer Science and Information Engineering,

National Quemoy University, Kinmen, Taiwan.