the beautiful people

from time to time some good looking person (or, occasionally, an ugly) will state or imply, in words or through their behaviour, this sentiment:

beautiful people are attracted to beautiful people.  ugly people are attracted to ugly people.

and i die a little inside.  i only figured out why today:

cats are attracted to cats.  dogs are attracted to dogs.

when people say the ‘beautiful/ugly people attraction thing’, what i hear is:

ugly people … they’re not really human, are they?

get called “sub-human” often enough and you’d be miserable too.

half wire

this week i could have:

enabled six volunteers, living in remote villages in Uganda, to get the training they need to give life-saving medical treatment to children with malaria.

but i decided that, all things considered, it’d be better for everyone if i just spent the money on some nice sunglasses for me which are almost, but not quite, just what i was looking for.

Super-achieve! Week 43 ’09

image

Staying up all night is definitely the way forward for me. Stayed up last night and achieved…

  • First Japanese word learned in months.
  • Sent some emails I should have sent three months ago.
  • First go on Wii fit in months.
  • First cycle ride in weeks.
  • Found CDs with 400 photos I thought I’d lost forever.
  • Tucked all my loose CDs and DVDs away into folders.
  • Sorted out all my old AV and computer cables.
  • Cleared a lot of space in my room.

plus a few other bits and bobs. Woot!

And now I’m trying out posting this from my HTC Hero android phone too.

On the downside, one of the reasons for the flurry of activity is that I feel like I’ve wasted the last week or so trying to get the android SDK working on any of my Linux machines and attempting to connect the phone to Windows running in a KVM in order to update it. I’ve had to admit defeat on both of those which is why this has taken 10 minutes rather than 2 to write. Grrrr.

fun with DVDs

i’ve recently come into possession of a Playstation 3 and decided to augment it with a second-hand projector and a proper surround AV receiver.

now, because linux/pulse-audio still isn’t quite there with regards to surround sound, the PS3 is the only device i own capable of playing 5.1 nicely. it also does quite a good job of displaying the video content too.

however, most of my content is on UK or US DVDs … and this is a JP PS3. so i can’t play them direct, but thanks to mediatomb i can stream them over the network instead!

so i’ve been revisiting the vexing question – how best to rip DVDs into video files.

the main problem i’d like to solve is the difference between the television display, the DVD contents and the original film in terms of frame rate, aspect ratio and interlacing.

i’ve found another good reference on those issues here.  as with my last attempts, i’m finding that each new DVD i examine contains a different combination of problems.

so far i’ve found a number of DVDs where things are quite easy.  i can type:

mencoder dvd://${title} -ovc copy -oac copy -of mpeg -mpegopts format=dvd:tsaf -o ${name}.mpg

and ten minutes later all is well with the world.

this appears to have worked well for 月姫 (“Tsukihime” – UK), Star Wars (UK) and The Matrix (US).  But then i tried it on Spirited Away (UK) and the result has the wrong aspect ratio – it displays super-wide!  (mencoder doesn’t realise it needs to copy the aspect ratio from the mpeg headers even if there’s an aspect ratio specified in the stream as well.  specifying the 4:3 in both header and stream sorted it.)

so far i’ve been unable to sort that out without re-encoding the entire video content – which is silly.  still, it’s given me a chance to check a few other things about that DVD.  for one, there’s no interlacing (well, it’s “progressive encoded as interlaced” in effect), no telecine and no blending.  so the frames are very clean … but doesn’t that mean it’s playing a 24 frames per second film at 25 frames per second?  why yes it does.

so that should mean it’s 4% shorter – and it is!  the reported running time on the case is 120mins (actually 119:37) but the film running time reported round the net is 124 minutes.  not a big problem you might think and you’d be right .. but it still drives me up the wall.

it’s very easy to play the video at 24 fps but slowing down the audio turns out to be annoyingly fiddly .. and, so far, impossible.  each tool i use to demultiplex, convert, modify, re-convert and re-multiplex fails in new and interesting ways.  so i’ve given up for now – we’ll just have to enjoy this film slightly faster than intended.  *sigh*

so, what’s next?  that’d be Appleseed (UK).  Problems?  sure.  firstly it’s got a nice DTS soundtrack .. which the PS3 refuses to play.  Apparently there’s a trick to it where you can add fake PCM headers to the file to fool the PS3 into passing the audio stream direct to the AV receiver – which spots the DTS data and plays it.  but i’ve been unable to do that either so it’s AC3 for me.  *sigh again – but not quite as much*

more of an issue with this film is that the aspect ratio is just plain wrong.  there’s plenty of nice detail about the real numbers regarding aspect ratios on wikipedia but the key thing to note is that, despite rumours to the contrary, 1.85 is not equal to 1.78!

the reason i mention those numbers is that many films (including Appleseed and Spirited Away) are filmed with an aspect ratio of 1.85:1.  Widescreen televisions have an aspect ratio of 16:9 – which is 1.78:1.  So the film is a bit wider than the telly – for it to appear correctly there should be black bars at the top and bottom of the screen – but there aren’t.  (in the Spirited Away DVD there are black bars all the way round but you can see that the ones at the top and bottom are thicker than the ones at the sides.)

again, i can make mplayer play with the correct 1.85:1 aspect ratio either by forcing it with “-aspect 1.85:1” on the command line or by doing a simple rip and applying the correct setting in the mpeg headers – but again, the PS3 (and totem) ignore that setting – so the only option i’m left with is to re-encode.

why not leave it slightly stretched?  most of the time it looks fine but as objects rotate the distortions annoy me intensely – it looks wrong in a niggling, vague way which i find more frustrating than an obvious error.

how can i be sure it’s the aspect ratio that’s the problem?  luckily there’s a nice round circle near the start of the film.  at 16:9 it’s oval but at 1.85:1 it’s properly circular:

screenshot of the view through futuristic rifle sights in the film Appleseed

screenshot of the view through futuristic rifle sights and/or night-vision goggles in the film Appleseed

i’m still not completely certain that the DVD wouldn’t play correctly (with black bars) on a regular DVD player but i don’t have one so perhaps i’ll never know!

from the work on Spirited Away i have an mencoder command which generates an XVID AVI file which the PS3 will accept:

mencoder dvd://${title} -oac copy -ovc xvid -xvidencopts bitrate=16000:qpel:cartoon:chroma_opt:vhq=4:quant_type=mpeg\
:pass=${pass}:min_iquant=1:min_bquant=1:min_pquant=1 -o ${name}.avi

the “bitrate=16000” sets the highest target bitrate (and, therefore, the largest filesize) that mencoder will create.  in combination with the three “min_?quant=1” options it forces the maximum image quality.

the “cartoon” option might be good for anime – i haven’t done any serious comparison yet.

you mustn’t use the “gmc” option or the PS3 will refuse to play the file.  “qpel” is okay though.

unfortunately, as gorgeous as it looks, the appleseed DVD is encoded interlaced with what looks suspiciously like “partial field blending”.  this is my favourite field so far:

screenshot from appleseed movie

screenshot from appleseed movie

that single field from the DVD contains two blended film frames but note the strange horizontal banding – spooky.  looks like they just pointed a 25 fps camera at the cinema screen and pressed ‘play’ and ‘record’ at the same time – like the eighties with vinyl and cassettes!  retro.

the best image quality i’ve been able to get from this DVD is by using the “-vf tfields=1 -fps 50 -ofps 50” filter option to convert each field into its own frame.  for some reason this also messes up the audio sync so you also have to add “-delay 0.3”

that little trick doubles the frame rate.  that, combined with the fantastic level of detail in this film means that my final rip comes in at 7.5G per hour – more than six times the size of the Spirited Away rip with the same quality settings, which is about 1.7G per hour – about the same as the simple ‘copy’ rip straight from the DVDs.

screenshot from Appleseed showing dust motes floating in a beam of sunlight.

screenshot from Appleseed showing dust motes floating in a beam of sunlight.

garn.