EvalVid for NS2

Evalvid is an open source video quality evaluation tool. EvalVid has a modular structure, making it possible to exchange at user’s discretion both the underlying transmission system as well as the codecs, so it is applicable to any kind of coding scheme, and might be used both in real experimental setups and simulation experiments.

Requirement for calculating data rate:

  • Sender side:
  • Raw uncompressed video
  • Encoded video
  • Time-stamp and type of every packet sent
  • Receiver side:
  • Time-stamp and type of every packet received
  • Reassembled encoded video (possibly erroneous)
  • Raw compressed video to be displayed

Architecture of Evalvid (heterogeneous wireless network):

Architecture of heterogeneous wireless network

 

Sample code for Evalvid for ns2:

This is the sample code for how to set priority traffic for video and foreman

for {set i 0} {$i < $opt(videoflow) } {incr i} {

set udp($i) [new Agent/my_UDP]

$ns attach-agent $node_(0) $udp($i)

$udp($i) set packetSize_ $packetSize

$udp($i) set_filename sd_foreman_$i

set null($i) [new Agent/myEvalvid_Sink]

$ns attach-agent $node_(1) $null($i)

$ns connect $udp($i) $null($i)

$null($i) set_filename rd_foreman_$i

 

set original_file_name($i) foreman_qcif.st

set trace_file_name($i) video($i).dat

set original_file_id($i) [open $original_file_name($i) r]

set trace_file_id($i) [open $trace_file_name($i) w]

 

set pre_time 0

set totalByte_I 0

set totalByte_P 0

set totalByte_B 0

set totalPkt_I 0

set totalPkt_P 0

set totalPkt_B 0

 

while {[eof $original_file_id($i)] == 0} {

gets $original_file_id($i) current_line

 

scan $current_line “%d%s%d%d%f” no_ frametype_ length_ tmp1_ tmp2_

set time [expr int(($tmp2_ – $pre_time)*1000000.0)]

 

if { $frametype_ == “I” } {

set type_v 1

set prio_p 1

set totalByte_I  [expr int($totalByte_I + $length_)]

set totalPkt_I [expr int($totalPkt_I + $tmp1_)]

}

 

if { $frametype_ == “P” } {

set type_v 2

set prio_p 1

set totalByte_P  [expr int($totalByte_P + $length_)]

set totalPkt_P [expr int($totalPkt_P + $tmp1_)]

}

 

if { $frametype_ == “B” } {

set type_v 3

set prio_p 1

set  totalByte_B  [expr int($totalByte_B + $length_)]

set totalPkt_B [expr int($totalPkt_B + $tmp1_)]

}

 

if { $frametype_ == “H” } {

set type_v 1

set prio_p 1

set totalByte_I  [expr int($totalByte_I + $length_)]

set totalPkt_I [expr int($totalPkt_I + $tmp1_)]

}

 

puts  $trace_file_id($i) “$time $length_ $type_v $prio_p $max_fragmented_size”

set pre_time $tmp2_

}

 

set totalPkt  [expr int($totalPkt_I+$totalPkt_P+$totalPkt_B)]

set totalByte  [expr int($totalByte_I+$totalByte_P+$totalByte_B)]

 

close $original_file_id($i)

close $trace_file_id($i)

set end_sim_time $tmp2_

puts “end_sim_time: $end_sim_time”

 

set trace_file($i) [new Tracefile]

$trace_file($i) filename $trace_file_name($i)

set video($i) [new Application/Traffic/myEvalvid]

$video($i) attach-agent $udp($i)

$video($i) attach-tracefile $trace_file($i)

 

$ns at [expr 10.0 ] “$video($i) start”

$ns at [expr 50.0] “$video($i) stop”

$ns at [expr 50.0] “$null($i) closefile”

$ns at [expr 50.0] “$null($i) printstatus”

 

}