我正在使用Mininet-Wifi使用VLC媒体播放器将实时视频从服务器(station1或sta1)流传输到客户端(主机1或h1)。
问题是两个VLC窗口没有显示。 “此示例基于以下视频:https://www.youtube.com/watch?v=_C4H2gBdyQY”
要流式传输实时视频,我使用了:
sta1.cmdPrint("cvlc -vvv v4l2:///dev/video0 --input-slave=alsa://hw:1,0 --mtu 1000 --sout \'#transcode{vcodec=mp4v,vb=800,scale=1,\
acodec=mpga,ab=128,channels=1}: duplicate{dst=display,dst=rtp{sdp=rtsp://10.0.0.10:8080/helmet.sdp}}\' &")
h1.cmdPrint("cvlc rtsp://10.0.0.10:8080/helmet.sdp &")
这是代码:
!/usr/bin/python
"This example is based on this video: https://www.youtube.com/watch?v=_C4H2gBdyQY"
from mininet.node import Controller, OVSKernelSwitch
from mininet.log import setLogLevel, info
from mn_wifi.node import OVSKernelAP
from mn_wifi.cli import CLI_wifi
from mn_wifi.net import Mininet_wifi
import os
def topology():
"Create a network."
net = Mininet_wifi( controller=Controller, switch=OVSKernelSwitch,
accessPoint=OVSKernelAP )
info("*** Creating nodes\n")
sta1 = net.addStation('sta1', wlans=2, ip='10.0.0.2/8')
h1 = net.addHost( 'h1', mac='00:00:00:00:00:01', ip='10.0.0.1/8' )
ap1 = net.addAccessPoint( 'ap1', ssid='ssid_ap1', mode='g',
channel=6, position='70,25,0' )
ap2 = net.addAccessPoint( 'ap2', ssid='ssid_ap2', mode='g',
channel=1, position='30,25,0' )
ap3 = net.addAccessPoint( 'ap3', ssid='ssid_ap3', mode='g',
channel=11, position='110,25,0' )
s4 = net.addSwitch( 's4', mac='00:00:00:00:00:10' )
c1 = net.addController( 'c1', controller=Controller )
info("*** Configuring wifi nodes\n")
net.configureWifiNodes()
info("*** Associating and Creating links\n")
net.addLink(ap1, s4)
net.addLink(ap2, s4)
net.addLink(ap3, s4)
net.addLink(s4, h1)
sta1.cmd('modprobe bonding mode=3')
sta1.cmd('ip link add bond0 type bond')
sta1.cmd('ip link set bond0 address 02:01:02:03:04:08')
sta1.cmd('ip link set sta1-wlan0 down')
sta1.cmd('ip link set sta1-wlan0 address 00:00:00:00:00:11')
sta1.cmd('ip link set sta1-wlan0 master bond0')
sta1.cmd('ip link set sta1-wlan1 down')
sta1.cmd('ip link set sta1-wlan1 address 00:00:00:00:00:12')
sta1.cmd('ip link set sta1-wlan1 master bond0')
sta1.cmd('ip addr add 10.0.0.10/8 dev bond0')
sta1.cmd('ip link set bond0 up')
# 'seed'
# net.seed(12)
'plotting graph'
net.plotGraph(max_x=140, max_y=140)
net.startMobility(time=0)
net.mobility(sta1,'start',time=20,position='20,50,0')
net.mobility(sta1,'stop',time=79,position='135,50,0')
net.stopMobility(time=80)
info("*** Starting network\n")
net.build()
c1.start()
s4.start( [c1] )
ap1.start( [c1] )
ap2.start( [c1] )
ap3.start( [c1] )
sta1.cmd('ip addr del 10.0.0.2/8 dev sta1-wlan0')
os.system('ovs-ofctl add-flow s4 actions=normal')
sta1.cmdPrint("cvlc -vvv v4l2:///dev/video0 --input-slave=alsa://hw:1,0 --mtu 1000 --sout \'#transcode{vcodec=mp4v,vb=800,scale=1,\
acodec=mpga,ab=128,channels=1}: duplicate{dst=display,dst=rtp{sdp=rtsp://10.0.0.10:8080/helmet.sdp}}\' &")
h1.cmdPrint("cvlc rtsp://10.0.0.10:8080/helmet.sdp &")
info("*** Running CLI\n")
CLI_wifi( net )
info("*** Stopping network\n")
net.stop()
if __name__ == '__main__':
setLogLevel( 'info' )
topology()
我的问题:上面的代码是否会生成SDP文件,还是应该从从互联网下载的视频文件中生成SDP文件,并将其与python代码文件放在同一文件夹中? >