Tuesday, 26 May 2009

Skype codec selection

Ever wondered how to manually choose which codecs Skype uses when you make an audio call? Well here's how (by selecting the Skype codecs you don't want to use):
  • On Windows/Mobile you set this registry key (HKEY_LOCAL_MACHINE/SOFTWARE/Skype/Phone/Audio/DisableCodecs) to contain the codec's you don't want Skype to use (e.g. for Pocket PC you might want to disable higher CPU codecs: "ILBC G729 EG711U")
  • On Linux/OSX you add the disabled codecs inside these tags: <DisableCodecs> <\DisableCodecs> in the config.xml file (usually found in ~/.Skype/your_skype_username/config.xml). They need to be put into the (usually existing) <Call> tag which is within the <Lib> tag.
  • Furthermore you can actually force the use of a particular codec by using the <ForceCodec> tag/Reg key in the relevant place.
Skype has a wide range of codecs (e.g: SILK_WB_V3, SILK_NB_V3, ILBC, G729, EG711U, SVOPC, SILK, ISAC) which seems to get expanded every so often. Note: That disabling G729 may interfere with use of SkypeOut. Skype generally does a good job of automatically selecting the appropriate codec and its rate - unless you use this tweak - so be aware that Skype may not perform optimally when it's range of codecs is impaired.

There's also other fun stuff you can tweak - like adding a <video> section and make Skype use a particular resolution (you'll need to convert this to an appropriate Registry entry on Windows):
<captureheight>480</captureheight>
<capturewidth>640</capturewidth>

For an interesting read on Skype see columbia.edu, and for papers on performance see Politecnico di Bari and Politecnico di Torino.

[Updated: 16mar2012: More on location of Codec config tags]

Monday, 18 May 2009

Weird MagicCam error message from Google talk video device

Have you ever seen this error when attempting to run some capture software on OSX? (Note: The current process label in the error message is dependent upon which app you're running - in my case its one called vic):
[000:029] MagicCam 0: Current process: vic, Flash is loaded: no
[000:029] Error(magiccammac.cc:276): MagicCam 0: MagicCamOpen: Not an allowed process!

It is coming from the Google Talk's virtual video devices (but it's probably not actually causing any trouble directly - see below) - which are installed here:
/Library/QuickTime/Google Camera Adapter 0.component
And the MacCam related functions are in these two files:
/Library/QuickTime/Google Camera Adapter 0.component/Contents/MacOS/Google Camera Adapter 0
Run strings on it:
strings "/Library/QuickTime/Google Camera Adapter 0.component/Contents/MacOS/Google Camera Adapter 0" | grep -i magiccam)
and you get:
/Volumes/BuildData/PulseData/data/recipes/320452156/base/branches/googletalkplugin_release_branch/googleclient/talk/magicflute/magiccam/magiccammac.cc

Anyway it's not actually harmful and generally if you've a problem this is unlikely to be the cause of it. You can just [re]move the files as necessary to get rid the messages though your problem may well be somewhere else but at least you can eliminate it as a possible cause.

Friday, 1 May 2009

Just setup Time Capsule as my IPv6 gateway

So Apple have taken a lead in the drift towards IPv6 adoption (though it seems we really are getting to the end IPv4 as we know it) - their Time Capsule (TC) uses IPv6 out of the box for administration when using the AirPort Utility (Using a proprietary encrypted protocol AACP). It also has facilities for setup of an IPv6 [6in4] tunnel using IPv6 in IPv4 encapsulation (specifically IP protocol 41) as specified in RFC4213.

So to get connected to the Global IPv6 Internet (such as it is...) you need to go get a free tunnel endpoint from Hurricane Electric (or others) then use the AirPort Utility and select 'Manual Setup', then go to 'Advanced' and 'IPv6' then select 'IPv6 mode:' as tunnel and select 'Configure IPv6:' as Manually. The enter the addresses as given by your IPv6 tunnel provider. In the LAN IPv6 Address enter an address that has the same IPv6 prefix as the others but with a different host id - the bit after the "::/64" - just choose a number (well up to 8 hex digits separated by ':'s - no "::" prefix used if exactly 8 digits are used for host_id) which will form your TC's [Global] IPv6 address (e.g. your_prefix::FE:ED:CO:FF:EE). It's probably best to disable incoming connections as you could open your machine to IPv6 attacks.

If you're on a public IP address space then you're all set, however if like most of us your TC is behind a DSL router/NAT then you'll need to make hole in your firewall/NAT so Porotocol 41 gets in and out. If you're lucky enough to have a Linux based DSL router then this how to do it - login to you router. If you've got a Netgear router then you can enable telnet access by going to http://your_router/setup.cgi?todo=debug. And then telnet to the router and type the following (which I found here) - given your TC has the address 192.168.0.2:
iptables -t nat -A PREROUTING -i ppp0 -p 41 -j DNAT --to 192.168.0.2
iptables -t filter -A FORWARD -i ppp0 -p 41 -d 192.168.0.2 -j ACCEPT

You may not need to do the above on some routers - all tht may be necessary is enable pings on the external interface.

[update 2aug09]: If you've got a Thompson router then see my new blog entry.

And you should now be able to access the world of IPv6.... Check out these for starters ipv6.google.com, the old Kame dancing turtle, and quite a few others...oh and these too...

[updated/corrected 6in4 - 18nov09]

Wednesday, 29 April 2009

Encrypted Timecapsule backups

Timecapsule backups aren't encrypted which seems a little dumb - as if someone nicks your TC then they've also got all your data in the clear too. There's a simple procedure that this smart post lays out - but I've copied it here in case that page goes away as it is so handy:
  • Set up Time Machine to back up to an AFP drive. I don’t think this will work with a local hard drive.
  • Let Time Machine start backing up, then stop the back up. This will have created _.sparsebundle on the AFP drive.
  • Disable Time Machine.
  • Open a Terminal and run these commands (replace name_mac with your mac's name, and TC_drive_name with your TimeCapsule's network drive name - ls /Volumes to check):
    $ cd /Volumes/TC_drive_name/
    $ mv name_mac.sparsebundle name_mac-old.sparsebundle
    $ hdiutil convert -format UDSB -o name_mac.sparsebundle -encryption AES-256 name_mac-old.sparsebundle

    It will ask you for a password. Type in a password you won’t forget.
  • Double click the sparsebundle in the Finder (You should find it in your TimeCapsule network drive). You will be prompted for your password. Type that in and tick the “Remember password” check box.
  • Open /Applications/Utilities/Keychain Access and find name_mac.sparsebundle. Right click it and select Copy name_mac.sparsebundle.
  • Select System Keychain on the left hand side of Keychain Access and paste it in the main area. Allow this action if you are asked. Remember to lock the System Keychain when you are done.
  • If using Snow Leopard then (as suggested here) you'll need to copy "com.apple.TimeMachine.MachineID.plist" from the old to the new sparsebundle. You can do this by going to the volume using Terminal as above and then doing:
    $ cd /Volumes/TC_drive_name/
    $ cp name_mac-old.sparsebundle/com.apple.TimeMachine.MachineID.plist name_mac.sparsebundle
  • Unmount the volume and then tell Time Machine to get busy.
  • Time Machine should not have no problem backing up to the encrypted volume. If everything works as planned, feel free to delete the name_mac-old.sparsebundle
[updated: 21sept09, 21aug10]

Tuesday, 28 April 2009

Mounting a Xen .xm (xmfile) disk image file

You've probably wondered how to mount one of these pesky things. It turns out they're actually just entire disk images with a boot sector and often with multiple partitions. On Linux you can use the losetup tool - It allows one to mount a disk image on a /dev/loopX device. If it has multiple partitions then you need to find out where in the image the particular partitions are that you want to mount. Firstly you mount the entire image on a [spare] loop device e.g.:
sudo losetup /dev/loop0 diskimage.xm
Then run fdisk to check out the partition table (in sectors):
sudo fdisk -ul /dev/loop0
It will list the partitions - note down the start of the partition you're interested it and multiply it by 512 (the number of bytes per sector): e.g. If the first partition starts at 63 you multiply it by 512 and get 32256 then you use that as the 'offset' argument (i.e. how far into the disk image your chosen partition resides) to the losetup command:
sudo losetup -o32256 /dev/loop0 diskimage.xm
Next you need to determine the filesystem type - you maybe able to check this what fdisk reports, but you can also use the file command:
file -s /dev/loop0
Then mount that partition onto a spare directory on your system (e.g. ext3 filesystem on /mnt):
sudo mount -text3 /dev/loop0 /mnt
And it should then be mounted at /mnt and away you go. Thanks to this page for getting me going - plus a comment there mentions that there's simpler way to mount the image - if you're running a kernel version > 2.6.26 (You can specify modprobe loop max_part=63 and it will create the partitions automatically on calling losetup - but that only works if loop is a module - which it isn't in Ubuntu 9.04).

[corrected 2oct09]

Monday, 9 March 2009

Adding proxying to an Ubuntu Apache server

You can enable forward proxying server behaviour in Ubuntu 8.* by doing the following:
- Enable the proxy modules:
sudo a2enmod proxy
- Edit the proxy config file:
sudo vi /etc/apache2/mods-enabled/proxy.conf
- Add your allowed hosts to the section, setting ProxyRequests On and the add a new section:
<directory proxy:*>
Order deny,allow
Deny from all
Allow from my_hosts
</directory>


Restart Apache and you're done:
sudo /etc/init.d/apache2 restart

Thursday, 12 February 2009

This driver is blocked due to incompatibility issues

Yeah this kept popping up and although it told me that the Driver: Virtual PC/Windows CE Emulator was the problem it firstly didn't tell me where it was (i.e. filename) nor how uninstall the damn thing?! (just some useless 'check for solutions online' button).

Finally I tracked it down using Microsoft's (was the excellent Sysinternals) LoadOrder tool and the very handy Autoruns. I tracked it down to: "VPCAppSv Provides application services for Virtual PC. Connectix Corporation c:\windows\system32\drivers\vpcappsv.sys" which turns out to be a black listed driver for WinXP. Nice.

So I just deleted from driver list (under HKLM\System\CurrentControlSet\Services) in Autoruns, then rebooted - and no more warnings ;) Then it can just be deleted.

Sunday, 25 January 2009

Varilight dimmer remote control

Got one of these things a while back - they're neat dimmer switches with a touch control - no moving parts - get 'em from Homebase etc. They're remotely controllable (over IR-InfraRed) - and you can buy a specific remote for from about £5 upwards.

However these Varilight dimmers are smart - you can program them to do a bunch of things - depending on which model you have. It's not clear how to work that out (apart from testing it using its programming mode - see below), but all of them can be programmed to work with any remote control you have - e.g your TV remote. Just choose a spare button that you don't use and you can get the varilight to use it to turn the thing on and off! As mentioned here:

1. Tap switch 6 times - takes it in to 'learning mode' (After the 6 taps the light will go and off once more to indicate it's in learning mode).
2. Point your choose remote at it whilst pressing (for 2 secs or more) that your chosen button at it - the lights will go on and off.
3. Point the remote at the it again whist pressing the button and the lights should go on and off
4. You're done - it should work as your new remote control!