Saturday, May 31, 2008

How to convert your video to work on your IPod in one click with linux (Gnome)

This tutorial has been done with Ubuntu 8.04 .
The problem with Ubuntu 8.04 is that ffmpeg doesn't support aac encoding by default. So we will have to compile it with support for aac.

First of all, verify that ffmpeg is not installed on your computer. If it'S installed, please, uninstall it using synaptic.

Now, open a terminal, and execute the following commands:
sudo apt-get build-dep ffmpeg
sudo apt-get install liblame-dev libfaad-dev libfaac-dev libxvidcore4-dev libx264-dev liba52-0.7.4 liba52-0.7.4-dev

sudo apt-get source ffmpeg


Now, go in ffmpeg source folder folder:
cd ffmpeg-0.cvs20070307/

Now, it's time to compile ffmpeg with the following commands:
sudo ./configure --enable-gpl --enable-libogg --enable-liba52 --enable-dc1394 --enable-libgsm --disable-debug --enable-libmp3lame --enable-libfaad --enable-libfaac --enable-xvid --enable-pthreads --enable-x264
sudo make
sudo checkinstall -D make install

If everything went well, now ffmpeg is installed on your computer with support for aac.

To allow you to convert films to mp4 supported by an IPod in a single click, you need to do the following.

First, verify that zenity is installed by running the following command:
sudo apt-get install zenity

Then, run the following command to create and edit the script used to convert vidoes in 4:3:
gedit "~/.gnome2/nautilus-scripts/Ipod Video 4:3"
Then copy the following script in the editor and save the content:
#!/bin/bash

IFS='

';

# List all files
count=0;

for f in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS;
do
count=$(($count+1));
done

pos=0;
for file in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS;
do
pos=$(($pos+1));
name=${file##*/}
ffmpeg -threads 3 -y -i "$file" -f mp4 -vcodec mpeg4 -maxrate 700000 -b 700000 -qmin 3 -qmax 5 -bufsize 4096 -g 300 -acodec aac -ab 192 -s 320x240 -aspect 4:3 "$file.mp4" 2>&1 | perl -ne '$/="\r";$| = 1;if (/Duration: (\d+):(\d+):(\d+)/) { $max=($1*3600+$2*60+$3) }; if (/time=(\d+)/) { printf "%d\n",($1/$max*100);} print STDERR $_;'| zenity --progress --auto-close --title="$name" --text="File $pos/$count" --percentage=0
done

Since I have a quad core GPU, I use the option -threads 3 to use 3 cores. Change the value to 1 or 2 if you have one or two cores.

Now, close the editor and run the following command to make the file executable:
chmod 700 "~/.gnome2/nautilus-scripts/Ipod Video 4:3"




To create the script which convert fils in 16:9 format, run the following commands:
gedit "~/.gnome2/nautilus-scripts/Ipod Video 16:9"
Then copy the following script in the editor and save the content:
#!/bin/bash

IFS='

';

# List all files
count=0;

for f in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS;
do
count=$(($count+1));
done

pos=0;
for file in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS;
do
pos=$(($pos+1));
name=${file##*/}
ffmpeg -threads 3 -y -i "$file" -f mp4 -vcodec mpeg4 -maxrate 700000 -b 700000 -qmin 3 -qmax 5 -bufsize 4096 -g 300 -acodec aac -ab 192 -s 320x180 -aspect 16:9 "$file.mp4" 2>&1 | perl -ne '$/="\r";$| = 1;if (/Duration: (\d+):(\d+):(\d+)/) { $max=($1*3600+$2*60+$3) }; if (/time=(\d+)/) { printf "%d\n",($1/$max*100);} print STDERR $_;'| zenity --progress --auto-close --title="$name" --text="File $pos/$count" --percentage=0
done


Since I have a quad core GPU, I use the option -threads 3 to use 3 cores. Change the value to 1 or 2 if you have one or two cores.

Now, close the editor and run the following command to make the file executable:
chmod 700 "~/.gnome2/nautilus-scripts/Ipod Video 16:9"



To convert a video, just right click on your video file, then left click, then go to scripts option, and choose one of the two scripts.


The you will see the conversion progress:


You can select several videos at the same time to make a batch conversion.

Now, to put your new video on your Ipod, just use gtkpod.

Friday, May 30, 2008

My new computer

A few times ago, I bought a new computer. I didn't invest more than 150$ in a computer for years (7 at least), except when I bought two new 22" Flat screens in November 2007. So it is a major change to me.
My config is quite a standard one:
  • Asus P5N-D motherboard
  • Intel Core 2 Quad Q6600 (easy to over clock in case it becomes necessary)
  • 4GB of DDR2 800 (much more than necessary since I use less than 10% in everyday use)
  • Asus Nvidia 8800 GT PCIE video card (don't buy this one choose a 8800GT from any other supplier. I will explain why later)
  • Antec Sonata III (silent, good power supply and low price)
  • 750 GB Seagate hard drive
  • A hold 70GB hard drive
  • Simple DVD player/writer from LG (no need for Blue Ray at this time)
  • Microsoft Confort Curve 2000 keyboard (it's the keyboard I prefer for typing)
  • Logitech G5 v2 mouse
Regarding software it's quite simple:
  • Ubuntu 8.04 as main operating system (on the 750 GB hard drive)
  • Windows Vista Ultimate (just in case and for gaming) (on the 70GB hard drive)

My old computer (I bought it one year ago for 150$) is now used as Mythtv backend and frontend for my TV and videoprojector.
The config is:
  • AMD Athlon 2500+ with quite big and silent heatsink
  • 1GB of ram
  • 500 GB hard drive (I bought a new one because I need a lot of space for recorded programs, and it's more silent)
  • I added a hauppauge PVR 150 with Windows media center remote and receiver (I'm desappointed since I find the image very blurred)
  • Nvidia 6600 GT AGP (disappointing since most of passive fans on the market do not support this card)
  • everything is in a unkown box..
  • Mythbuntu is the operating system. I made some configurations to allow the computer to stop and restart automatically to record programs