Skip to content

Simulation of Realistic Video Traffic under ns-2 using Video Trace files

Introduction

In this mini project, a video streaming traffic model will be simulated under ns2 for simulating realistic video. The model will be tested with “Video Trace Files” which are encoded dummy video sequences available for such kind of video related researches. The proposed idea is to be validated through simulation using ns-2.

The Video Trace file format used for Streaming Simulation

A previous work provided a publicly available library of frame size traces of long MPEG- 4 and H.263 encoded videos in the QCIF format resulting in low bandwidth video streams. These traces can be used for the simulation of 3G networks. Some future communication systems, such as the WLAN systems, offer high data rates and therefore high quality video can be transmitted over such higher speed networks. Because the preencoded video sequences are encoded by different users they differ in the video settings in terms of codec, quality, format, and length. The advantage of user diversity for encoding is that it reflects very well the traffic situation in upcoming WLANs. Thus, the new traces are very suitable for the network performance evaluation of future WLANs.

The following lines shows the format of the video trace file proposed to be used in this project. (3 Second Video)

#Time[ms] Frametype Length[byte]
#______________________________________________
 0 I 687
 80 P 380
 160 PB 1987
 560 PB 5113
 1000 P 38
 1040 P 1148
 1280 PB 1767
 1440 PB 1734
 1760 PB 1937
 1920 PB 1889
 2240 PB 1833
 2320 PB 1795
 2720 PB 2243
 2800 P 627
 2880 P 828
 3000 P 625

Important Sections of the Tcl Script Written for this Simulation

Parameters of the Simulation

 set val(chan) Channel/WirelessChannel ;# channel type
 set val(prop) Propagation/TwoRayGround ;# radio-propagation model
 set val(ant) Antenna/OmniAntenna ;# Antenna type
 set val(ll) LL ;# Link layer type
 set val(ifq) Queue/DropTail/PriQueue ;# Interface queue type
 set val(ifqlen) 50 ;# max packet in ifq
 set val(netif) Phy/WirelessPhy ;# network interface type
 set val(mac) Mac/802_11 ;# MAC type
 set val(nn) 12 ;# number of mobilenodes
 set val(rp) DSR ;# routing protocol
 set val(x) 1000
 set val(y) 1000

 

Configure and Create Nodes

$ns node-config -adhocRouting $val(rp) \
 -llType $val(ll) \
 -macType $val(mac) \
 -ifqType $val(ifq) \
 -ifqLen $val(ifqlen) \
 -antType $val(ant) \
 -propType $val(prop) \
 -phyType $val(netif) \
 #-channelType $val(chan) \
 -topoInstance $topo \
 -agentTrace ON \
 -routerTrace ON \
 -macTrace ON \
 -movementTrace OFF \
 -channel $chan_1 \
 -channel $chan_2

#$ns node-config -adhocRouting $val(adhocRouting)
for {set i 0} {$i < 6} {incr i} {
set node($i) [$ns node]
$ns initial_node_pos $node($i) 30
$node($i) random-motion 1
set tx [$rng integer 800]
set ty [$rng integer 800]
$node($i) set X_ $tx
$node($i) set Y_ $ty
$node($i) set Z_ 0.0
set tx [$rng integer 800]
set ty [$rng integer 800]
$ns at 0.0 "$node($i) setdest $tx $ty 20.0"
set tx [$rng integer 800]
set ty [$rng integer 800]
$ns at 10.0 "$node($i) setdest $tx $ty 20.0"
set tx [$rng integer 800]
set ty [$rng integer 800]
$ns at 20.0 "$node($i) setdest $tx $ty 20.0"
set tx [$rng integer 800]
set ty [$rng integer 800]
$ns at 30.0 "$node($i) setdest $tx $ty 20.0"
set tx [$rng integer 800]
set ty [$rng integer 800]
$ns at 40.0 "$node($i) setdest $tx $ty 20.0"
set tx [$rng integer 800]
set ty [$rng integer 800]
$ns at 50.0 "$node($i) setdest $tx $ty 20.0"
}

 

$node(0) set X_ 100.00
$node(0) set Y_ 250.00
$node(0) set Z_ 0.0
$node(0) color "blue"
$ns initial_node_pos $node(0) 30.000000
$ns at 0.0 "$node(0) label Video-Server"
$ns at 0.0 "$node(0) color #6185cf3c0000"

#set node(1) [$ns node]
$node(1) set X_ 100.00
$node(1) set Y_ 750.00
$node(1) set Z_ 0.0
$node(1) color "blue"
$ns initial_node_pos $node(1) 30.000000


#set node(2) [$ns node]
$node(2) set X_ 200.00
$node(2) set Y_ 400.00
$node(2) set Z_ 0.0
$node(2) color "black"
$ns initial_node_pos $node(2) 30.000000


#set node(3) [$ns node]
$node(3) set X_ 250.00
$node(3) set Y_ 600.00
$node(3) set Z_ 0.0
$node(3) color "black"
$ns initial_node_pos $node(3) 30.000000

#set node(4) [$ns node]
$node(4) set X_ 450.00
$node(4) set Y_ 600.00
$node(4) set Z_ 0.0
$node(4) color "black"
$ns initial_node_pos $node(4) 30.000000

#set node(5) [$ns node]
$node(5) set X_ 650.00
$node(5) set Y_ 650.00
$node(5) set Z_ 0.0
$node(5) color "black"
$ns initial_node_pos $node(5) 30.000000
$ns at 0.0 "$node(5) label Video-Client"
$ns at 0.0 "$node(5) color red"

 

 

Generate the Video Traffic From Realistic Video Trace File

set original_file_name OneSecondVideo.dat
#set original_file_name Verbose_Jurassic_64.dat

set trace_file_name VideoTraceBin.dat

set original_file_id [open $original_file_name r]

set trace_file_id [open $trace_file_name w]

set last_time 0

puts $fpSent "TitleText: 6 Node Mobile Network: Graph Showing Packet Flow at Server End"
puts $fpSent "XUnitText: Time"
puts $fpSent "YUnitText: Packet Size in Bytes"

puts $fpRecieved "TitleText: 6 Node Mobile Network: Graph Showing Packet Flow at Client End"
puts $fpRecieved "XUnitText: Time"
puts $fpRecieved "YUnitText: Packet Size in Bytes"

while {[eof $original_file_id] == 0} {
 gets $original_file_id current_line

 if {[string length $current_line] == 0 ||
 [string compare [string index $current_line 0] "#"] == 0} {
 continue 
 }

 scan $current_line "%d%s%d" next_time type length
 
 puts $fpSent "[expr $next_time] [expr $length]"


 set time [expr 1000*($next_time-$last_time)]

 set last_time $next_time

 puts -nonewline $trace_file_id [binary format "II" $time $length]
}

close $original_file_id
close $fpSent
close $trace_file_id

 

Setting Up the Flows

# CONFIGURE AND SET UP A FLOW

set udp [new Agent/UDP]
$ns attach-agent $node(0) $udp

set sink [new Agent/LossMonitor]
$ns attach-agent $node(5) $sink

$ns connect $udp $sink

# read the video trace file:

set trace_file [new Tracefile]
$trace_file filename $trace_file_name

set video [new Application/Traffic/Trace]
$video set class_ 3
$video attach-agent $udp
$video attach-tracefile $trace_file

The 6 Node Scenario with Video Server and Client

      

Results with DSR Routing

Size of packets transmitted over time at the server end

 

The throughput measured at Client.

 

The packet loss rate

Results with AODV Routing

Size of packets transmitted over time at the server end

 

The throughput measured at Client.

 

The packet loss rate

Conclusion

A Tcl script based video streaming support for ns2 was successfully simulated and tested in ns2. For that a standard traffic agent (Traffic/Trace) was used in a different manner to support video trace traffic. The experiments were repeated with DSR, AODV protocols available in ns2 Since the video trace generation will not consume so much traffic, the video streaming simulation produced results similar that of a CBR traffic and it was observed that the packet loss during the video streaming simulation is same as in the case of CBR. AODV produced good results and there was no packet loss during most of the trials. But while using DSR, packet loss was observed during the initial stages of communication. We have tested the video traffic trace with only one transmitter and one receiver.

 

For Assistance in Protocol Implementation, Simulations & Analysis of Industrial as well as Scholarly Research Works, you may Contact Us.

WhatsApp chatDiscuss Through WhatsApp

Call 91 9843779735

Send an e-Mail Message.




This site is protected by reCAPTCHA and the Google
Privacy Policy and
Terms of Service apply.

WhatsApp Discuss Through WhatsApp