Friday, October 30, 2009

Using Apple Keyboard with Linux, Command Key Swap

I like using linux and also using Apple Mac OS X. I hate those horrible keyboard that come with the low budget computer and figure I would use my Apple Aluminium Keyboard with Linux. Now mind you this worked just fine plugging it into my Dell. I want it to act just like my Apple Computer. Here is what I did, this is way to cool.

I am using Ubuntu 9.04 in 64-bit mode (32-bit should work as well).

First I changed the keyboard type in:

System > Preferences > Keyboard

Then in the window choose:

Layouts > Keyboard model > Apple > Macintosh

Magically the volume controls worked and the number pad worked as well. I am so close to having that Mac experience. Let's now map the CNTRL key to the Command Key

Staying in the Keyboard Window and Layouts, click on the "Layout Options..." button:

Alt/Win key behavior / Control is mapped to Win Keys (and the usual Ctrl keys) (click the radio button)

Now close everything out and open your text editor and try it out all of you mac heads. This will save those dreaded hand cramps and make things much easier. Go Mac and Linux.

Wednesday, October 28, 2009

Converting MKV to iTunes Compatible [m4v/mp4]

If your like me you like processing videos. I recently got a few MKV videos that are really awesome in quality and from what I can tell looks like the main format for Blu-ray videos. Now I am not saying that this post it aimed at converting videos illegally. You do what you want with this. I also am not giving you the end-all-be-all solution for every single MKV video. If your smart and work with this stuff then you will be able to figure out the videos that don't quite work by tinkering with the settings.

First thing first, I have an Ubuntu 9.04 system running in 64-bit. I installed my ffmpeg from my posts (search ffmpeg, last posting). I am using an Intel Core2 Dou (not that this should matter).

Ok let's get started. Let's say my video is called Transformers2.mkv (Again, this is just an example, I love this movie). Also I am doing everything on the DESKTOP [/home/USER/Desktop]

Step 1. Installing additional apps using apt-get
sudo apt-get install mkvtoolnix gpac hexedit mplayer
Step 2. Reading the MKV file to see what you have.
mkvinfo Transformers2.mkv
NOTE: write down the FRAME rate of the video it might be weird like 23.976 or whatever, you will need it at the end.

NOTE: When you run this command you will see which tracks the video has. Let's say in my case Track 1 is the h.264 portion and Track 2 is the audio.

Step 3. Separate the tracks. This will not eat up your CPU but your disk will run wildly.
mkvextract tracks Transformers2.mkv 1:video.h264 2:audio.ac3
Step 4. HEXEDIT the video file to be compatible with iTunes [m4v/mp4]
hexedit video.h264
On the first line you should see this number combination:
"67 64 00 33"
change this to:
"67 64 00 29"

NOTE: This might not be exactly what you see but close. In my case let's say it was already what it needed to be changed to.

Step 5. Converting the Audio to AAC3 compatible. MKV's typically encoded with audio that just won't work with iTunes so we need to convert it to the something that it will understand. I am going to use ffmpeg to convert the audio.
ffmpeg -i audio.ac3 -acodec libfaac -ar 48000 -ab 448k -ac 6 -threads 0 audio.m4a
Step 6. Combining the video and audio tracks. Now here is where you need the frame rate from above.
MP4Box -add video.h264 -add audio.m4a -fps 23.976 Transformers2.mp4
Now once this is finished you should have a compatible video that will drag and drop right into iTunes. The video will not be much smaller then the original MKV as we did not convert or shrink the video just the audio. Check the beginning of the video or sync of sound and then the end of the video. It took me a couple of tries to get it in sync and also sounding really good. Have fun and hope this helps everyone out there.

Just a reminder I do not endorse stealing movies or ripping them, I just like to solve puzzles.

Tuesday, October 20, 2009

Rake problems in Ubuntu 8.10/9.04

So I just had a problem with the RAKE command in Ruby On Rails on an Ubuntu system. It appears as though there is some kind of duplicate program execution.

Here is the error that I had been getting
undefined method `reenable' for <Rake::Task db:schema:dump => [environment]>:Rake::Task
Here is how I got it working on my system

1. Uninstall the rake using apt-get
apt-get remove rake
2. Update the rake gem
gem install rake
3. Create a sym link to usr/bin
cd /usr/bin
ln -s /var/lib/gems/1.8/gems/rake-0.8.7/bin/rake
That should do it.

Ubuntu Gems Path

For what it is worth I needed to find the path of my gems in order to create sym links for executing them. The path of my gems were

Raspberry Pi Zero W - Wireless Configuation

create the file under "boot" folder wpa_supplicant.conf country=GB ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev u...