Sep 12, 2010

Automatically convert AVI to MP4

Posted by Knick

I have ordered my new Apple TV and while I wait the 3ish weeks for it to arrive I have been working to get my Movies library converted from AVI to a nice apple friendly MP4 format. I did a bunch of searching and exploring and found the best solution was to use the HandBrake Command Line Interface and run a batch process through the terminal on my entire movies directory and convert all my files without individual file interaction.

What the following process will do is scan the "source directory" for all AVI files and one by one re-encode them from AVI to MP4. This is a timely process but completely unmanaged as once you get the files in the proper source directory and start the batch process you can walk away.

I have started the batch on my AVI directory of 204 items and am waiting for the final results. The files that have been converted thus far have been perfect.

Follow the process below to run the script:

Download the HandbrakeCLI from here

Place the HandBrakeCLI file in the "Source Directory" where you have the movies you want to convert.

Create a new directory for the destination files to go

Copy and paste the following lines into a terminal window changing the source and destination directories to match your directory structure.

sourcedir="~/Movies/source"
destdir="~/Movies/destination"
cd "$sourcedir"
for i in *.avi; do
./HandBrakeCLI -i "$i" -o "$destdir/${i%.*}.mp4" --preset="Normal"
done

Read more...

Jun 4, 2010

Fun with Linux

Posted by Knick

After several failed attempts to read the ext2 partition on my old NAS drive I decided it was time to go to the old Linux partition and copy the files from there. It was a fun adventure that took me back to my college days of multiple terminal windows and text flying down the screen Matrix style. All in all I hope it will be worth it.

I wanted to get a Linux partition without doing a full install. I downloaded a neat app called Universal USB Installer and then downloaded a KNOPPIX V6.2 image. This allows you to do a full install of Linux on the USB drive. Booting to the drive will give you a fully functioning copy of Linux allowing me to do my file copy with ease.

First step was to make the USB boot drive. I grabbed my spare 4GB thumb drive and launched the Universal USB Installer application. When you run the installer it will ask for the ISO image you want to install, I selected the Knoppix image i downloaded and created a boot flash drive.

Second Step was booting to Knoppix, this went very smooth for my desktop, after booting to the USB drive it came up right away and detected my network card and grabbed an IP all without issues.

Now it was time to mount the old hard drive, mount the network drive, then copy the files. To accomplish this I did the following:

First, find the source drive by running the following command:

fdisk -1
I found that the disk I wanted was /dev/sdc2

Now I create a mountpoint for the drive by running the following command:
mkdir /mnt/sdc2
Then I Mounted the drive to that mountpoint. I had an issue when I tried to just run the basic mount command. The drive was part of a mirror and Linux refused to mount it, after some Googleing I found that I had to specify the file-system in the mount command and it worked no problem. I ran the following command:
mount -t ext2 /dev/sdc2 /mnt/sdc2
Next I created the mountpoint for the network share:
mkdir /mnt/network
Then I mounted the network share:
/smbmount //192.168.1.32/Volume_1 /mnt/network
Finally, I ran the Rsync command that would take everything from the source and move it to the destination. The source was /mnt/sdc2 and the destination was /mnt/network
rsync -auv --delete /mnt/sdc2 /mnt/network

I am letting this run overnight to see if it will finish the copy. Since Linux fully supports the ext2 file-system and since it has already gone further then it did in windows I fully expect it to finish. I will post again with final results.

I have lots of movies to watch this weekend, it better work!

*edit - 8 hours later and it is still copying!

Read more...