First of all got to the following link
and open the Read-me
According to the Read-me file download the mpeg4_traffic.cc
and place this file in the folder where the .cc files of ns exist.
Then add the following lines
Application/Traffic/MPEG4 set rateFactor_ 1
Application/Traffic/MPEG4 set initialSeed_ 0.5
to the file placed in
Here rateFactor tells how much you want to scale up (or down) you video
input and the intialSeed is used to start generating the first frame in the model.
After including it in the Make-File compile the MakeFile.
And when the compilation is successful then download the following four files and save then in the file where you are going to run the .tcl script.
Save these files in the folder named as video_model.
When you are done with above mentioned steps then add the following lines into your .tcl script where you want to add mpeg4 traffic.
set source [$ns node]
set udp0 [new Agent/UDP]
$ns attach-agent $source $udp0
set vdo [new Application/Traffic/MPEG4]
$vdo set initialSeed_ 0.4
$vdo set rateFactor_ 5
$vdo attach-agent $udp0
$ns at 1.8 "$vdo start"
After following all the above mentioned steps run the code and you will see the mpeg4 traffic in your simulation.