Friday, December 28, 2012

Linux: Killing multiple similar processes all together

kill -9 `ps -ef | grep /libexec/abrt | grep -v grep | awk '{print $2}'`

kill all processes that have "/libexec/abrt" in their run path. Do not kill grep command since it will be alos included into the output.

Saturday, December 15, 2012

Linux: Remove all JPG files older than 5 days

 find . -name *.jpg -mtime +5 -print -exec rm {} \;

# starting from the current directory
# also print the file path

# note spaces around rm and {}

Saturday, December 08, 2012

How To Install ffmpeg on CentOs 6.x (6.3)

I installed ffmpeg on a dedicated CenOs 6.3 server. The installation mostly follows the instrcutions given by the eFFMPEG group here, but there are few important twists if you want to get it done.

1. Login as root

2.Pre-set:
# remove older installations
yum erase ffmpeg x264 x264-devel
 
#verify you get all teh tools:
yum install gcc git make nasm pkgconfig wget
 
#create a working folder
mkdir ~/ffmpeg-source
 
3. Installations
 
#install yam 
cd ~/ffmpeg-source
wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar xzvf yasm-1.2.0.tar.gz
cd yasm-1.2.0
./configure
make
make install
 
#install x264
cd ~/ffmpeg-source
git clone git://git.videolan.org/x264
cd x264
./configure --enable-static
make
make install
 
#install mp3 encoder
cd ~/ffmpeg-source
wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar xzvf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure --disable-shared --enable-nasm
make
make install 

#install libogg
cd ~/ffmpeg-source
wget http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz
tar xzvf libogg-1.3.0.tar.gz
cd libogg-1.3.0
./configure --disable-shared
make
make install
 
#install libvorbis
cd ~/ffmpeg-source
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz
tar xzvf libvorbis-1.3.3.tar.gz
cd libvorbis-1.3.3
./configure --disable-shared
make
make install 

#install libvpx
cd ~/ffmpeg-source
git clone http://git.chromium.org/webm/libvpx.git
cd libvpx
./configure
make
make install
 
#install zlib
cd ~/ffmpeg-source
wget http://zlib.net/zlib-1.2.7.tar.gz
tar xzvf zlib-1.2.7.tar.gz
cd zlib-1.2.7
./configure
make
make install 

#FFMPEG did not want to work well in /tmp
mkdir ~/tmp
export TMPDIR=~/tmp

#you might also need to add to PATH /usr/lib
export PATH=$PATH:/usr/lib

#and probably add (I did it, but not sure it is a must)
export LD_LIBRARY_PATH=/usr/local/lib

#now install ffmeg from GIT repository
cd ~/ffmpeg-source
git clone git://source.ffmpeg.org/ffmpeg
cd ffmpeg
./configure --enable-gpl --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libx264
make
make install
 
#this should work now! type 'ffmpeg' to try
ffmpeg
ffmpeg version N-47639-g0110108 Copyright (c) 2000-2012 the FFmpeg developers
  built on Dec  8 2012 22:03:48 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
  configuration: --enable-gpl --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libx264
  libavutil      52. 12.100 / 52. 12.100
  libavcodec     54. 79.100 / 54. 79.100
  libavformat    54. 48.100 / 54. 48.100
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 26.100 /  3. 26.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'