Sunday, July 15, 2012

Ubuntu 12.04 install ffmpeg with amr support

1)Install the source package
apt-get source ffmpeg


2) install dependencies to build the package
apt-get build-dep ffmpeg


3) Install dependencies for custom options (confflags)
apt-get install libopencore-amrnb-dev libopencore-amrwb-dev

4) ffmpeg is on of the components of libav so apt-get source ffmpeg will create /usr/src/libav-0.8.3 with the source so cd to that location
cd /usr/src/libav-0.8.3

4) change confflags to enable some extra options for ffmpeg
vim debian/confflags
add following lines in '# Common configuration flags' section
confflags += --enable-libopencore-amrwb
confflags += --enable-libopencore-amrnb
confflags += --enable-version3

5) Build the package
dpkg-buildpackage -rfakeroot -uc -b

6) Install the resulting deb package(s)
cd /usr/src
dpkg -i ffmpeg_0.8.3-0ubuntu0.12.04.1_all.deb

7) Using ffmpeg to convert mp3 to amr
ffmpeg -y -vn -i in_file.mp3 -y -acodec libvo_amrwbenc -ac 1 -ar 16000 -ab 7.4k -f amr -map_metadata  -o out_file.amr

Friday, July 13, 2012

Generate wallpaper slideshow xml for gnome/Unity


#!/bin/bash

start='<background><starttime><year>2009</year><month>08</month><day>04</day><hour>00</hour><minute>00</minute><second>00</second></starttime>';
end='</background>';
static='<static><duration>1000.0</duration><file>%s</file></static>';
transition='<transition><duration>5.0</duration><from>%s</from><to>%s</to></transition>';

echo $start
echo
prev_file='';
ls | grep -i -e .jpg -e .png | while read line
do
   file=$PWD/$line;
   if [[ $prev_file == '' ]]
   then
      printf $static "$file";
      echo
   else
      printf $transition "$prev_file" "$file";
      echo
      printf $static "$file";
      echo
   fi
   prev_file=$file;
done
echo $end

1) In ubuntu precise the xml which provides the wallpaper slideshow is located here
/usr/share/backgrounds/contest/precise.xml

2) In order to create your own xml file you have to cd to the directory which contains the images and run this script and recirect the output to an xml file

3) After createing the xml file (eg: myshow.xml) backup the original file comes with precise and replace the newly created file to its place with the same name (precise.xml)

4) Go to system settings > appearance and select your slide show there

NOTE: make sure to keep your image filenames without spaces or use following script to replace spaces with underscores

#!/bin/bash

ls | grep '[a-zA-Z0-9]\ [a-zA-Z0-9]' | while read line
do
mv "$line" $( echo $line | sed s/' '/'_'/g )
done

Wednesday, June 6, 2012

How to retrieve contacts from android CWM backup

1) Connect the phone to PC in USB storage mode and get the data.img from the cwm backup
 cp /media/clockworkmod/data.img . 

2) compile and build unyaffs which is need to retrieve the files from data.img 
download unyaffs.c, unyaffs.h from http://code.google.com/p/unyaffs/downloads/list 
wget http://unyaffs.googlecode.com/files/unyaffs.c
wget http://unyaffs.googlecode.com/files/unyaffs.h
gcc -o unyaffs unyaffs.c 
unyaffs data.img 

3) after extracting the image browse the contact database location
cd data/com.android.providers.contacts/databases 

4) use sqlite3 command line client to read the table of contacts 
sqlite3 contacts2.db 
sqlite> select number,name from view_v1_phones;

Intel Corporation XMM7360 LTE Advanced Modem in ArchLinux

The required packages are available in ArchLinux User Repository (AUR) so it will be easier if you can use an AUR helper package like yay . ...