As what as you like

  • screen titles from ssh

    I usually have at least 4 terminals visible on my screen at once. Each one is running screen(1), and each screen has probably at least 3 or 4 different things going on in it (usually sshing to servers). Once you are up to about a dozen or so shells spread across 4 terminals it can get quite interesting to remember where you left the one you are looking for. Since screen can have a status line which lists its screens, and it is possible to change their names, I figured it ought to be possible to have ssh set the title of a screen when it connects to a remote machine. This would make things a lot easier to find, as well as being a cute hack. It turns out that it is indeed possible…. to a degree. ssh lets you specify a command to be run on the local machine after a connection is established, which is the ideal place to do this kind of thing. Sadly it doesn’t help you out by setting any useful environment variables (such as the machine you just ssh’d to). You’re probably thinking “but you know which one it is, you just ssh’d there!” and while that is true, it’s not very easy to handle programatically. Mainly because it means parsing the arguments to ssh, which is no fun at all. So, rather than do that, I am making the blanket assumption that the final word on ssh’s command line is the host you are sshing to. If that is not true (e.g. you are doing “ssh someserver rm /etc/foo”) you will get whatever the last word actually is, sucks to be you. Also, if you use ProxyCommand, you really don’t want the second ssh to do this, because it will confuse the first one and you’ll never establish a connection, so detecting the type of output ssh is connected to is necessary. Thanks to the many, many people I’ve consulted in the process of figuring this out. It doesn’t seem like anyone has done this before (at least I can’t find an example on google. There are some very similar things though), so after running out of ideas myself I started polling the community and got enough nuggets of inspiration back to produce a workable solution. You will need to make sure screen is configured to show a status line (otherwise you won’t see the screen names, except in a C-A-“ or similar). Then drop this into ~/.ssh/config: ` PermitLocalCommand yes LocalCommand tty -s && cat /proc/$PPID/cmdline | xargs -0 | awk ‘{ printf (“\033k%s\033\”, $NF) }’` (yes, that is hacky and disgusting. I am tempted to look at patching ssh to provide the hostname to the spawned LocalCommand shell, but right now the above config seems to be the best way of doing this).

  • More PS3 video stuff

    I came across a python script called vepp, which aims to be a simple way of transcoding files for portable media devices. Why not also use it for very unportable media devices such as the PS3? :) Initially I’ve just added a target for fairly high bitrate 720p H.264/AVC, 1080 and MPG-SP targets still to come. If you want to track my development version, you can do so via Launchpad. You will need to use bzr thus: bzr branch http://bazaar.launchpad.net/~cmsj/+junk/ps3tools You’ll need a capable version of ffmpeg, as discussed previously. Output files will be written to the current directory (I’m looking at adapting the current behaviour to be able to automatically direct the output to either attached media that is PS3 compatible (CF/SD/MS/USB) or sending it straight to a directory you are sharing via UPnP (far more useful than ferrying things about with SD cards!) Here is my current patch against vepp: === modified file 'vepp-2.0.1.py' (properties changed)--- vepp-2.0.1.py 2007-06-09 01:01:48 +0000+++ vepp-2.0.1.py 2007-06-09 03:12:21 +0000@@ -4,8 +4,8 @@ from math import sqrt # defaults-remove = True-target = 'psp-oe'+remove = False+target = 'ps3-avc-720p' vbr = True audio = None@@ -85,6 +85,22 @@ 'qmax': 24, 'channels': (2, 1), },+ 'ps3-avc-720p': { # Only tested with firmware 1.80+ 'maxx': 1280,+ 'maxy': 720,+ 'stepx': 8, # FIXME: lower?+ 'stepy': 8, # FIXME: lower?+ 'pixels': 1280 * 720,+ 'namedfiles': True,+ 'thumb': False, # FIXME: Can this be True?+ 'ext': "mp4",+ 'video': ["-vcodec", "h264", "-f", "mp4", "-bufsize", "14000k", "-maxrate", "14000k", "-coder", "1", "-level", "31", "-r", "24000/1001", "-g", "300"],+ 'audio': ["-acodec", "aac", "-ab", "160k"],+ 'bitrate': lambda x,y: "3072000",+ 'qscale': 18,+ 'qmax': 24,+ 'channels': (2, 1),+ }, 's60': { 'maxx': 352, 'maxy': 288, It would be nice to be able to push content to the PS3 from a LAN, but I have no idea how they could do it sanely. Maybe I can push files via Bluetooth. Of course, if the rumours are true, this is going to all be immaterial shortly…

  • Installing Ubuntu on the PS3

    I’ve yet to complete this, because I stopped my attempts last night when I reached an unusual situation. Specifically, I was doing the partitioning manually, but the two visible disks had no partition tables. Not wanting to trash the PS3 disk I didn’t let it create the tables, so had to abort. After consulting with the very helpful Colin Watson, it turns out that the disk Ubuntu sees as sda is not the whole PS3 disk, it’s the Other OS partition virtualised to look like a whole disk. It is therefore fine to create a partition table and proceed with the install, which I will do tonight. (I’m not sure yet what sdb is, it smells like the PS3s internal flash and again I’m not sure if it’s wise to mess with it) UPDATE: The disks that Linux sees are virtualised by the PS3 (they’re actually just partitions made to look like whole disks), so it is fine to make the partition tables (or indeed let the installer do automatic partitioning). The bug where the installer hangs at 15% is due to the low RAM in the PS3. Stop some services (cupsys and hplip are good candidates) and remove some things from your session (update-manager and gnome-cups-icon, for example). Removing applets from the panel is not a bad idea either, and don’t run anything else while you are installing. Of course you could plug in a disk of some kind and set up swap, but this bug makes that quite hard at the moment.

  • PS3 movie icons

    Games on the PS3 are displayed as a little icon, but it can be animated and some games take advantage of that. Strangely, the PS3 does not even attempt to automatically thumbnail or live-preview the movies stored on it (another thing Sony could easily fix if they choose to. The Cell can decode literally dozens of movies simultaneously). However, the lazyweb rides to the rescue with the news that the PS3 can generate animated thumbnails, but you have to do it yourself. I like that I can do this, but I think it should do it by default and I can choose to override it if I don’t like what it auto-captured. Basically the trick is to pause the video at the point you want the thumbnail animation to start, then hit Triangle and choose “Change Icon”. The next 15 seconds of video are rendered to a little thumbnail in not very much time. This is it running on my ps3: Full instructions and the author’s video are here. Bonus points to anyone who figures out how to replace the thumbnail of one movie with another. The reason? Movie Trailers make great thumbnails because these days they usually flash the locations and characters at you rapidly

  • Watching the PS3

    I don’t even remotely have space at the moment for a large TV (even a flatscreen one), also they are still a little expensive (I figure if it’s worth doing, it’s worth getting a 40” Sony which does 1080p, but that’s 1200 quid at the moment). I really really didn’t want to buy a small TV because they are overpriced (compared to higher resolution monitors) and the thing wouldn’t be useful to me when I eventually get a proper TV. Instead I went with the dirt cheap Dell SE198WFP 19” widescreen monitor. It’s an inch smaller than the E207WFP I use for my PC, and consequently only supports slightly smaller resolutions (1440x900 being its maximum). However, it does have some features which make it particularly well suited to the PS3. Dell SE198WFP First off, it supports HDCP (the DRM system being used in the HDtv world), so I should be able to play back protected content without the PS3 refusing to trust me or downscaling it to an annoyingly low resolution. 900 rows of pixels means the maximum resolution falls somewhere between 720p and 1080i/1080p, however, the monitor supports both. This was especially surprising to me as I had expected to be “limited” to 720p (many/most PS3 games at the moment don’t go higher than 720p anyway, and it’s still a massive leap over standard definition TV). I need to do some more exhaustive comparisons, but I think I will be going with 720p rather than 1080i (it doesn’t seem to support 1080p) because it’s an uninterlaced mode, so there is absolutely no flickering. Either way the monitor is scaling the image - the question is, which direction is better? scaling 720 rows up to 900, or scaling 1080 rows down to 900. Time will tell (as will this blog!) For anyone wondering how I managed to connect a monitor which only has DVI and VGA inputs to the PS3 which only has HDMI, component and composite outputs - fear not, HDMI is actually a combination of DVI signals, audio and probably some other gumpf), so it is entirely possible to convert the HDMI output of the PS3 to DVI. That means no analogue signal/conversion at all, so the picture quality is superb and the cables to do it can be obtained easily and cheaply online (don’t splash out on a stupidly expensive gold cable, it’s a digital signal so cable quality matters a lot less. Just avoid the inexplicably cheap ones on ebay from the far east, they look very dodgy!). If you’re looking to put a PS3 in a bedroom and don’t really care for a TV, I would thoroughly recommend this monitor, especially since you’ll still have the VGA port free for other things. I’m sure you won’t care, but it also just happens to fit exactly into the only appropriate place for it on my desk!

Complete post archive