Archive

Posts Tagged ‘Ubuntu’

How to Install NS-2 in Ubuntu

February 12, 2013 28 comments

I presume that you already know what NS-2 is. I am gonna skip the details, and show you the steps that you need to follow for NS2 installation.

Download NS-allinone-2.35 from here. And, unzip your contents to your desired location. For example:

tar -zxvf ns-allinone-2.35.tar.gz -C /home/your_user_accnt

Before you install NS-2, please install some essential packages:

sudo apt-get install tcl8.5-dev tk8.5-dev

sudo apt-get install gcc-4.4 g++-4.4

sudo apt-get install build-essential autoconf automake

sudo apt-get install perl xgraph libxt-dev libx11-dev libxmu-dev

Open OTcl make file and change CC = @CC@ to CC=gcc-4.4, and save it. i.e.

gedit /home/your_user_accnt/ns-allinone-2.35/otcl-1.14/Makefile.in

Remove  CC = @CC@ and paste CC=gcc-4.4

You are now ready to install your ns-2.

cd /home/your_user_accnt/ns-allinone-2.35

./install

Now, you need to set some environmental variables to your hidden bashrc file.

gedit ~/.bashrc

Go to the end of the file and append the following lines :

#LD_LIBRARY_PATH

OTCL_LIB=/home/your_user_accnt/ns-allinone-2.35/otcl-1.14

NS2_LIB=/home/your_user_accnt/ns-allinone-2.35/lib

X11_LIB=/usr/X11R6/lib

USR_LOCAL_LIB=/usr/local/lib

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB

# TCL_LIBRARY

TCL_LIB=/home/your_user_accnt/ns-allinone-2.35/tcl8.5.10/library

USR_LIB=/usr/lib

export TCL_LIBRARY=$TCL_LIB:$USR_LIB

# PATH

XGRAPH=/home/your_user_accnt/ns-allinone-2.35/bin:/home/your_user_accnt/ns-allinone-2.35/tcl8.5.10/unix:/home/your_user_accnt/ns-allinone-2.35/tk8.5.10/unix

NS=/home/your_user_accnt/ns-allinone-2.35/ns-2.35/

NAM=/home/your_user_accnt/ns-allinone-2.34/nam-1.15/

PATH=$PATH:$XGRAPH:$NS:$NAM

Save, close and reload the bashrc file.

source ~/.bashrc

If you have completed all the steps successfully, then you should be able to run NS-2. Try the following to see :

cd /home/your_user_accnt/ns-allinone-2.35/ns-2.35/tcl/ex

ns simple.tcl

Make sure, you replace your_user_accnt with your user name.

Cheers.


		
Advertisements
Categories: NS-2 Tags: , , , ,

Encoding a video in H264 format and use MP4 as container

November 4, 2009 1 comment

I have used ffmpeg to encode the input video into H264 format and finally used MP4 as container. The following command line I have used for encoding.

#!/bin/bash
outfile=”video.mp4″
options=”-vcodec libx264 -b 512k -flags +loop+mv4 -cmp 256 \
-partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 \
-me_method hex -subq 7 -trellis 1 -refs 5 -bf 3 \
-flags2 +bpyramid+wpred+mixed_refs+dct8x8 -coder 1 -me_range 16 \
-g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qmin 10\
-qmax 51 -qdiff 4″

ffmpeg -y -i “$1” -an -pass 1 -threads 2 $options “$outfile”

ffmpeg -y -i “$1” -acodec libfaac -ar 44100 -ab 96k -pass 2 -threads 2 $options “$outfile”

Categories: Streaming Tags: , , ,