Sunday 21 April 2013

EvalVid on NS-2 on Ubuntu 12.04

In my previous posts I have given steps to install NS-2 on Ubuntu 12.04 and also given a few details on EvalVid. Now Here's how to use EvalVid on ns-2 to evaluate video over a simulated network.

Before using the tools to evaluate a video a few modifications must be done to a few files in ns-2 for integrating EvalVid into it. Use the steps provided by the following paper to do these modifications and insert the module into ns-2.

Chih-Heng Ke, Ce-Kuen Shieh, Wen-Shyang Hwang, Artur Ziviani, “An Evaluation Framework for More Realistic Simulations of MPEG Video Transmission”,
Journal of Information Science and Engineering (accepted) (SCI, EI).

Once these steps are done we need to create the network topology to do the simulation.
This network is created using a tcl script. The tcl script has the number of nodes, the link details between the nodes, etc.

1. Next we need to download a yuv sequence which has to be converted to a m4v file. This can be done using  'ffmpeg' It will create a compressed raw video. For example download akiyo_cif.yuv which is available online.
 
$ffmpeg -i akiyo_cif.yuv a01.m4v
 
2. Next we need to get the .mp4 file. Following command lines create ISO MP4 files containing the video samples (frames) and a hint track which describes how to packetize the frames for the transport with RTP.
 
$./MP4Box -hint -mtu 1024 -fps 30 -add a01.m4v a01.mp4
 
3. Now that we have the mp4 file, we need to generate the trace file required to sent into the network. The mp4trace tool from EvalVid is able to send a hinted mp4-file per RTP/UDP to a specified destination host. The output of mp4trace will be needed later, so it should be redirected to a file. The trace file thus generated is st_a01.st
 
$./mp4trace -f -s 192.168.0.2 12346 a01.mp4 > st_a01.st
 
4. For example use the be_a01.tcl from the link mentioned above to create the network and run this tcl file.
 
$./ns2 be_a01.tcl 

5. This now runs the tcl script thus sending the trace file into the network and create two files
sd_a01 and rd_a01. The file sd_a01 is to record the sending time of each packet while the file rd_a01 is used to record the received time of each packet.
 
6.  The next step is the reconstruction of the transmitted video as it is seen by the receiver. For this, the video and trace files are processed by etmp4 (Evaluate Traces of MP4-file transmission):
 
$./etmp4 -f -0 sd_a01 rd_a01 st_a01.st a01.mp4 a01out

This generates a possibly corrupt vido file in which the lost frames are deleted.

7. decode into the .yuv format and then calculate the psnr

$ffmpeg -i a01out.mp4 a01out.yuv
$./psnr 352 288 420 akiyo_cif.yuv a01out.yuv
 
Done!
References: 
http://140.116.164.80/~smallko/ns2/Evalvid_in_NS2.htm
http://140.116.164.80/~smallko/ns2/myevalvid2.htm
http://www.isi.edu/nsnam/ns/

Research in field done by:
Mr. Abhishek Thakur and team,
Department of CS & IS
BITS-Pilani, Hyderabad Campus,
India.

No comments:

Post a Comment