Friday, August 29, 2014

Split and merge pdf’s with pdftk in linux

Link.


Pdf Tolkit (pdftk) is a tool to split and merge the pdf’s.

First you need to install the pdftk with following command.
$ sudo apt-get install pdftk

An example to merge pdf’s
$ pdftk input1.pdf input2.pdf cat output merge-output.pdf

Above example is to merge input1.pdf and input2.pdf and create new output file with name merge-output.pdf

An example to split pdf(split from page 10 to 20)
$ pdftk A=input1.pdf cat A10-20 outpout split-output.pdf

Above example is to get only page number 10 to 20 from input1.pdf to split-output.pdf
Read more ...

Monday, August 18, 2014

Converting mp4 to mp3 in Linux

Link.


To convert Upd_Sanity.mp4 to Upd_Sanity.mp3

$ sudo apt-get install ffmpeg && sudo apt-get install libavcodec-extra-53

$ ffmpeg -i Upd_Sanity.mp4 -vn -acodec libmp3lame -ac 2 -ab 160k -ar 48000 Upd_Sanity.mp3
OR (as ffmpeg is deprecated)
$ avconv -i Upd_Sanity.mp4 -vn -acodec libmp3lame -ac 2 -ab 160k -ar 48000 Upd_Sanity.mp3

Description

   -i        input file name
   -vn       disable video recording
   -acodec   force audio codec to libmp3lame
   -ac       set the number of audio channels
   -ar       set the audio sampling frequency

If you need to use it frequently,

STEP 1 : Create a bash function that performs conversion
## utilities.sh
convertMP4toMP3(){
echo -n "Enter source mp4 file : "
read sourceFile

echo -n "Enter destination mp3 file : "
read destFile

avconv -i $sourceFile -vn -acodec libmp3lame -ac 2 -ab 160k -ar 48000 $destFile
}
STEP 2 : source that bash file
 $ source utilities.sh
STEP 3 : start conversion calling above function convertMP4toMP3
 $ convertMP4toMP3
 Enter source mp4 file : Upd_Sanity.mp4
 Enter destination mp3 file : UPd_sanity.mp3
Read more ...

How to be a Google power user


Read more ...