Tuesday 13 April 2010

Getting Trim

Some weeks ago I was browsing the interwebz (puh-lease! When am I not?) and one of the discussions I was following mentioned that a film called 99F was worth watching if I could ever find it. Now, as it happened, one of the open directories I'd seen just that day had a copy of the very film - it's quite likely the discussion came up because of that. So I grabbed a copy to view later. There were various other films I would have liked (for example: Juno), but since they were all dubbed in French, I felt there was little point in downloading a film created in the US, dubbed in French and then adding the subtitle file so I could understand it.

Of course, since the open directory was clearly owned by someone whose first language is French, and anyway, 99F is a French film, it was clear that I needed to find some subtitles in order to watch it. Thankfully there is a whole world of subs out there, and it was easy enough to find an SRT file for 99F.

In a little aside, I'd like to point out that not all subs are created equal. And by equal, I mean of equal quality. Since watching many Japanese and Korean dramas, not to mention the Chinese, Taiwanese and, I seem to remember, one Thai film, I've come to rely on some really good fan-subs over the last year or so. In fact, many of the Animé I've watched have some extremely comprehensive subs, detailing not only the voice translations, but also extra writing in the background, as well as providing encyclopaedic information on many terms/words used during the show. Since I have very little knowledge of any of these languages, I have to trust that the translations are pukka, and that is, in fact, what the people are saying. And since it's usually a labour of love for these people, I'll believe it. All this said, the translations for 99F are, well, somewhat loose, is probably the nicest way to put it. My French is not really good enough to watch a film without the subs, but it's certainly adequate to the task of being able to pause a movie and say "Hang on! That's not what he said!"

The main problem, though, is that the subs I downloaded, and the film I grabbed, do not match up. It became clear within a couple of minutes that the subs were 10 seconds ahead of the actual words. This is where a small knowledge of the language comes in very handy - had it been an Oriental language, I'd have had no clue until quite some way into the film, and would have been totally freaked out by the fact that sometimes the subs came on when no one was speaking.

Now, a typical .srt file is editable in any friendly (and indeed unfriendly) text editing tool. The difference is that even if you've got an unfriendly one, you probably don't use it very often. Probably never. Anyway, the file usually looks like this.

00:00:56 - 00:01:02
'Allo? 'Allo? I will say this only once!

And thus, when the video's been running for 56 seconds, the line "'Allo? 'Allo? I will say this only once!" will be displayed on the screen until you get to 1 minute and 2 seconds. At which point it'll stop showing. As you can see, it's easily editable. However, can you imagine going through a whole 1 hour and not quite 40 minutes of dialogue, changing the timings so that everything comes up 10 seconds later? Well, so can I, and I didn't even want to go there (I did actually start editing it, which is how I came to this conclusion.)

And so I started to think that finding a way to trim off the first 10 seconds of the film might actually be easier. After all, if it was an MP3 file, I'd put it into something like Audacity, trim off those extra seconds, and save the file. Simple doesn't cover how easy it is. After a quick grope round the interwebz, I decided I'd see if VLC could do it - after all, there have been many discussions on how totally awesome VLC is. In fact, it's so awesome that I use it in preference to any other video viewing program. And Windows Media Player isn't even on the long list, let alone the short list here!

Using the Convert option that VLC has, I was able to specify that I wanted it to convert my video to the same format, but start 10 seconds into the film. Yay!? Well, no, not yay. It did, indeed, trim the first 10 seconds off the video, but all it did was to play audio for 10 seconds, and then spring into video window after then - and the subs were still out!

So I went back to my old mate, Google (how many times have people kindly told me that "Google is your friend." when I've asked dumb questions on forums (fora?)), and had another try. And this time I clearly entered a better search phrase. This was the result. Ignore the beginning of the thread, you need to work your way down to the first comment by perspectoff - this is the user who solved the problem for me. I did exactly that at a command line, and shaved off those precious 10 seconds. And thus my subs sync successfully!

But the reason I had to come here and talk about it was because of the discussion which came after - the rest of the thread is like a super-tutorial for ffmpeg, as two forum users (perspectoff and FakeOutdoorsman) discuss the best command line switches to get the exact result required, in the shortest length of time! In many places they've expanded on what each switch they use does, discussing how best to enter the command in order to achieve optimum speed and efficiency while converting/shaving your video.

And once again, I love the internet!

Saturday 10 April 2010

A little bit of Trumpeting

I know that society frowns on blowing one's own trumpet. However, there are days when you're so pleased with yourself that you can't help but tell the world what you've been up to.

As you know, I do a little bit of support for friends, family, friends of family, and complete strangers recommended by anyone in one of the aforementioned groups. I also alter my pricing according to the people for whom I'm working, charging the most for complete strangers. Not so long ago I was called upon to help an old chap who wasn't at all computer literate sort out his internet connection - this was a guy who had a really lovely computer, specced up by his much more computer literate friend, but who didn't want to spend the money for broadband (and it has to be said, he wasn't going to use it), so was consequently still using a dial-up connection. What a blast from the past! Now, I didn't want to have to charge the old dear too much, so after I'd succeeded in getting his internet working correctly, and I'd shown him how to use email, and written him extensive, long hand and fully verbose notes, I tried to leave. I'd been there an hour, at this point. However, the chap, who was rapidly becoming a right pain in it, insisted I stay for a further hour to walk him through starting up everything again. And again. And again! In the end I felt fully justified in charging him the full price for the whole, soul-searing two hours, at my top price, too!

But this story's not about him, it's about my most regular customers. They're parents of a mate of mine who married a Canadian and moved over to Canada some years ago. We'd finally met up, after I don't know how many years, at Lego Land. We had a lovely day out, and during the course of the day, her parents asked me,
"So, Sian, what do you do for a living?"
"Oh, I support computers."
"Really? You could have a look at ours then?"
You know that sinking feeling? Yeah, that one!
"Oh, I suppose..." reluctantly.
"We'd pay you!" Sinking feeling gone!

Now, they don't pay my full on rate, partly because I like them a lot, but mostly because they're my most regular customers, and come back time and again for my own, unique brand of abuse.

And so it was that I found myself back at their place last Tuesday, for a look at all their ailing machines.
"There's a problem with the kitchen laptop."
"Oh yes? Remind me, I've not been on my computer in days, and I can't remember what the email said."
"Well, it doesn't start up properly."
"OK - let's have a quick look..."

I pressed the power button, and was presented with a message which said something to the effect of,
"Your hard drive is in imminent danger of failure. Please backup your data and replace the drive." I was exhorted to press F1 to continue.
"Oh, there's your problem then." I said.
"What is?"
"Your hard drive is about to fail."
"Oh dear. What do we do?"
"Back up all your data and replace the drive..."

At which point it dawned upon me that, just maybe, styling myself the IT Goddess could have a few drawbacks - like someone believes that you can, in fact, produce miracles out of thin air. I suggested, with some trepidation, that we could replace the disk relatively cheaply, and continue to use the PC (it's a not too old Sony Vaio with an 80Gb drive and 500Mb RAM), but after finding some disks on the internet for about £90, they decided that they'd be better off putting the money to a replacement PC with a web-cam built in, so they could use Skype in the kitchen. At which point they offered me the PC, to see if I could maybe do something with it.

And this, dear reader, is where the trumpeting can begin!

I brought the laptop home, and attempted to boot from a Linux (Ubuntu) cd, but somehow the PC didn't want to do that - the errors thrown up gave me the hint that the drive was really on the point of failure. At this point I had a look on Amazon, and found a 160Gb disk for a whole-lot-more-palatable-than-£90, £46, including delivery. I ordered that, and when it arrived the next day (some of the sellers on Amazon are pretty damn swift!) I proceeded to put my plan into action!

I did have some trouble, initially, getting the new OS onto the new disk. When I first removed the old disk and inserted the new (and Oh-dear-God, how many itty bitty screws are there to remove and replace when you change disks in a Vaio?), the Ubuntu CD booted nicely, but I, possibly foolishly, chose the option to check the disk. Apparently this meant "Check that there's an OS on it", and when it failed to find one, it refused to boot up with the CD again. I ended up having to put back the old drive (9 itty bitty screws, that's how many), booting the CD, shutting down, removing the drive again, putting in the new one (all 9 screws again) and was finally able to boot from the CD. And this time I wasted no time in choosing the "Install Ubuntu onto this PC, please" option. Actually, I seem to remember that it doesn't say please. Software is so impolite, nowadays!

But that's child's play. While I can't claim to be anything but a total noob where Linux is concerned, installing Ubuntu hardly qualifies as Rocket Science. Nah, that's not where I'm proud. I wanted Spotify, but they don't make a Linux version. On Googling "spotify on linux", I was presented with a bewildering array of possibilities, from running the actual Spotify installer under a windows emulator, to downloading and installing one of the open source Spotify clients out there. That second option seemed, initially, to be the better of the options shown, so I started trying to work out how to download any of the packages, but was completely stumped. Which is somewhat surprising, 'cos I'm a serious downloader, if you know what I mean ;)

So, Windows emulator it was to be!

And while it may be my own trumpet I'm blowing here, I'd like to acknowledge the massive teaching resource that is the whole internet. I can possibly claim some credit for being able to phrase a search query to obtain best results, or a little credit in being totally fearless when it comes to messing with the command prompt - after all, what's the worst that could happen? Well, I suppose I could end up messing up the whole disk and having to re-install Ubuntu again. With all the attendant itty bitty unscrewing... But digression is occurring, and I'm here to tell you that I succeeded!

I found someone who'd put down the command line commands, complete, to get, install and configure the Wine software. I was able to google the error messages which came up, and found solutions to them (OK, I found a solution just before I found someone else saying that it wasn't really an error and not to worry about it). And eventually, after a few re-boots (this is very like Windows in some respects), I was able to run Spotify successfully. Finding and installing Chrome and VLC was a breeze in comparison.

I was particularly pleased to find an old laptop memory SIMM (512Mb) laying round the house, which installed perfectly, allowing me to run Ubuntu with a whole gig!

So my "new" laptop is humming away, and I'm feeling as if I did something really clever! Do you think this is how a normal person feels when they achieve something everyday in Windows?