September 21, 2009, 12:14 am
I recently bought a new camera (Canon Legria HFS10). Really neat little device but, how do you use it with your Free software operating system? Well, the camera records in a new standard set my Sony and Panasonic called AVCHD or Advanced Video Codec High Definition.
What this is is a directory structure, container format and codec specification. AVCHD uses MPEG4 (or H.264 if you will) to encode video and AAC to encode audio both of these codecs are well supported in FFMpeg but the container format (called MTS) is a bit more problematic as some information appears to be missing from it. Luckily it is still possible to copy the data over and do something useful with it!
My camera records in 1080i50 default (that is 50 fields or 25 frames per second) and my computer is just not fast enough to decode that realtime, let alone edit it. This is why I resize the video to 720p and encode it as lossless motion jpeg with uncompressed PCM audio to trade CPU usage for disk bandwidth and space. The command looks something like this:
mencoder -of lavf -demuxer lavf -vf yadif,scale=1280:720,harddup -oac pcm -ofps 25 -ovc lavc -lavcopts vcodec=ljpeg /media/CANON/avchd/bdmv/stream/00000.mts -o 00000.mkv
This command will use libavformat’s demuxer and muxer code instread of mplayer’s own to be able to properly read the mts file and write the mkv file. I use MKV because the AVI container has given me many problems with editing video, seeking also seems to be much faster with MKV containers. This command will also deinterlace the 1080i50 video to end up with a 720p25 video. This is the format in which I edit my videos.
Please note that if you use the NTSC model the camera will record in 60i instead of 50i and the ‘ofps’ parameter should be set to 30 NOT 25.
If you do not need deinterlacing remove the ‘yadif’ from the -vf (video filter) same goes for scale.
And some still frames from some of the videos I’ve shot (and get with the above command line) (click for full resolution image)



March 17, 2009, 6:42 pm
Ever needed to batch-resize some pictures and convert just didn’t cut it? Imagemagick apparently tries to ‘optimize’ images, so this means that a 32bit bitmap file will always end up in 24bit format later.
Well, as it turns out The Gimp is very scriptable! By creating the following file and calling it ‘resize.py’ you can now make your dream come true! ;
SCALE = 0.5
DIR = "/path/to/images"
from gimpfu import *
import gimp
import os
for root, dirs, files in os.walk(DIR):
for file in [f for f in files if f.endswith(".bmp")]:
try:
fullname = os.path.join(root, file)
print “processing”, fullname
img = pdb.gimp_file_load(fullname, fullname)
pdb.gimp_image_scale(img, img.width*SCALE, img.height*SCALE)
layer = img.layers[0]
pdb.gimp_file_save(img, layer, fullname, fullname)
pdb.gimp_image_delete(img)
print fullname, “done”
except:
print fullname, “Failed!”
pdb.gimp_quit(True)
It’s not the prettiest code ever written, but it does the job. Run it like so:
gimp-console -i -n –batch-interpreter=’python-fu-eval’ -b - < resize.py
I hope this will be useful to someone else some time
March 10, 2009, 6:34 pm
After being more than mildly frustrated with my employer’s ‘Test Lab’ I decided I wanted my own test lab… In one box, and under 2000 euros. Here’s the result:

The specs of the machine are as follows:
- ASUS KFN32-D SLI Motherboard
- 2x AMD Opteron(tm) Processor 2352
- 8×2 GB ECC memory
- 2x 750GB Harddrives
- Asus EAH4870 DK 1G
The build was relatively easy, once I got the part-list together properly which was less of an easy task. None of that hardware turned out to be very ‘readily available’ sadly, but in the end it all turned out quite nicely. The 8 core machine gives a lot of oomph when I need it (especially when testing out customer setups at home with KVM virtual machines) and 16Gb of memory is extremely nice to have.
Some placement issues with the motherboard did make me curse the entire bloodline of the designer at Asus though. Marvels such as this :

or This… What’s that Molex connector even DOING there?

And this GREAT place to put an onboard audio connect

somewhat detracted from an otherwise wonderful project. For the full build-process pictures see this gallery
March 10, 2009, 4:09 pm
I’ve just hired another server for TMM enterprises inc
(if you are in need of cheap open source game server hosting, apply below!) ok, shameless plug, forgive me.
Anyway, this new server is equipped with CentOS and no way of changing it to a .deb based distro on purchase, which is highly inconvenient for me, since ALL my other systems are .deb based. Who can live without apt-get, seriously?
There was this tool called ‘debtakeover’ but this hasn’t been maintained since 2004, so I decided to do a little experimentation. The result can be read on my wiki at the following address: http://wiki.tmm.cx/index.php/Installing_Debian_on_a_system_from_another_distro
I hope this will be useful for anyone else, but don’t forget: TRY THIS IN A VM FIRST!