< | >

Hacker's Diary

A rough account of what I did with Emacs recently.

February 28
Ok, that's annoying. We watched a fine episode of Inspector Gently and then noticed that the current collection of seasons is almost done: there are only 4 seasons present. I'd swear when we started watching this that there were 8. This isn't the first time Prime Video has pulled this stunt, either: The Blacklist used have all 10 seasons, albeit with season 8 and onward tagged "not available to you"; then after a while it was reduced to 6 seasons.

February 27
Ok, so the thumbnail thing? If I have a video, foo/bar.ts and I put a jpeg file at foo/@eaDir/bar.ts/SYNOVIDEO_VIDEO_POSTER.jpg, then browse the DLNA server, it'll do a once-off conversion of the jpeg to fit a 160x160 box and save it as SYNOVIDEO_POSTER_JPEGTN.jpg and, more importantly, ship it over the wire as the thumbnail. Cool!

Further poking around reveals that Synology's MediaServer stores metadata in the mediaserver database in the video table; this may be handy to update e.g. the name of the movie (rather than relying on it using the filename) but it's also possible that the next indexer run will nuke any changes.

ANYWAY. Getting back to my four questions of some months ago:Right, three down, one to go.

February 26
So of course the first thing I did was broke my code while trying to clean it up without keeping a working copy. And I wound up littering it with debug statements before finding the very obvious bug. (It's C: it was more-or-less "shouldn't have used that pointer after freeing" as opposed to the other C bug, "shouldn't have written off the end of that array").

I still have one tiny mystery to figure out: older ripped videos show up on the TV with proper durations and thumbnail images. Recent rips show up with no thumbnails and nonsensical durations. I suspect this might actually be some DNLA server shennanigans.

Solved: Synology stashes a bunch of stuff in the extended attributes, including SYNOINDEX_MEDIA_INFO and SYNOVIDEO_POSTER.jpg which I'll need to poke with a stick I guess. Interestingly these seem to be leftovers from the defunct Video Station.

Oh hey I can reindex the folder. Clicks the button. DNLA server stops listing anything because it's thrown out the old index before building the new one.. Well that was fun.

February 25
It's tempting, while I'm mucking about with this subtitle code, to introduce a deliberate error that'd make the TV overrun a buffer or some such, just to see what'd happen; of course, I'd likely end up bricking the TV, so I'm not gonna do that.

February 24
Back to where I can actually test the files on the TV... swapping the location of the CLUT does not fix the problem, so I'll need to make my bit-twiddling work instead.

VICTORY!

It's not a pleasant hack, but it works: forcing the CLUT to at least 16 colours makes the TV happy. I could probably submit this as a patch to ffmpeg but I'll need to port it forward (I'm working against a snapshot right now) and maybe add a little more error checking for people less cautious than my good self.

Of course, now I have to re-rip everything that has a 4-colour CLUT...

February 23
Fiddling with the CLUT bits-per-pixel is a bit more complicated than rearranging the blocks, since there are no less than three places that all do the same "if CLUT size is this, bpp_index is that" and I don't want to go on a refactoring jaunt in pursuit of a questionable hack.

Hmm, tweaking the computed BPP is insufficient (in a Segmentation fault sort of way) so I guess I get to hack the actual number of colours instead.


February 22
"Are you showing the rugby upstairs?" "Game's not starting until later"

Oh yeah. I'm in London. "the rugby" is the England/Scotland game, not the Ireland/Wales game. Found an Irish pub to watch Wales give Ireland a bit of a scare.

February 21
I am always amazed at how terrible the British Airways app/website is. Here's a simple example: I'd like to check the status of my flight. So I go to the app, and it tells me my upcoming flight, and I tap the hamburger menu, and select flight status, and ... it asks me to enter full flight details. Even an option to autofill with my next booking would be an improvement. It gets better, though: I clicked "manage my booking", and it took me to the website - embedded in the app - without passing through the booking information, so I got an error page. Maybe the website will be better? I log in, select "Manage" from the menu, and ... it wants my booking details. I'm logged in.. Now, if I scroll to the bottom of the page, there's my booking with a big "manage booking" button, but it's Not. Front. And. Centre. When. I. Log. In. I guess they want "engagement".

Ok, moving the CLUT around turns out to be fairly straightforward, and it looks like fiddling with the bit-depth might also be easy enough. I'm away from the target platform for a few days so I'll probably just try a few variants and test them when I'm back.

Interesting. The brute-force move of the CLUT code I did seems to have changed the colouring of the subtitles somehow, possibly by not setting the background? I'll need to dig into this some more.

February 20
Also! Found some sample files with subtitles on them which play on the TV. So now I need to figure out what's different. Immediately obvious differences: 4-bit colour, segment ordering (CLUT before or after REGION), multiple regions vs. a single region, regions of 720x34 vs 320x77. I think I could probably trivially hack FFmpeg to reorder the segments, but boosting the CLUT to 4-bit might be a bit more aggro.

Ooh, interesting. The encoder has a comment that some decoders do not support 2-bit colour correctly.

Foundation Season 2: Definitely still a solid sense of WTF here.

February 19
Wrapped season one of Foundation. It wasn't a particularly satisfying wrap in as much as I still have questions, and not of the "let's watch Season 2" sort. But we'll be watching Season 2 in any case.

I am, of course, now building CCExtractor from source so I can insert some more debug info into it.

Current conclusion: the TV is failing to parse the bitmap data correctly, but I can't quite tell in what way - wrong bit depth, can't parse the provided data, etc. The colour look-up table looks like about as simple as it can get - 2 bits per pixel, so four colours - which suggests either the TV is looking at the wrong data or it's parsing it wrong. Given the TV is displaying something I'm inclined to believe it's correctly identifying the Object segment, it's just not sure what to do with it. Probably the next thing to do here is to fiddle randomly with the Object segment and see what the TV does with it.

February 18
A modicum of success: CCExtractor is able to pull the DVB subtitles as images out of the TS file, confirming that at least the format is correct, even if it's not compatible with the TV.

Office dinner out because some people are visiting. That was nice.

February 17
Inching closer to making sense of the subtitles... I've managed to extract the DVB subtitle stream by itself and I'm now trying to figure out how to dismantle it without resorting to pen, paper, and hex editor.

February 16
Back to my DVD adventures. I have established that the TV can play MPEG2 PS as well as TS but frankly there doesn't appear to be much advantage to one or the other on the surface.

Hmm, ok, a critical difference appears to be that I can't get subtitles into the MPEG2-PS files, which is why I'm even having to poking at things with pointy sticks in the first place. I say "appears to be" since finding definitive statements about this stuff tends to be a trawl-through-5,000-identical-posts task, and empirical tinkering so far has led me to No Subtitles In The Output File (although somewhat annoyingly it appears to claim it's putting them in).


February 15
Episode of Gently in which he actually cracks up laughing. Most excellent. Oh look, there's Dublin Castle in the North of England again.

February 14
George Gently continues to be excellent. He really is Morse with a sense of humour. (Morse had a sense of humour, but no-one was intelligent enough to find it funny.)

February 13
A brief fight with an online transcription service: a timeout while listing source contents, the source bucket is not in the right region, the source is too large, I gave up.

February 12
Slightly at a loss as to how the bank who phoned me in San Francisco in the early morning (timezones, eh?) a mere 24 years ago are claiming they don't have a number on record for me and I must therefore engage with their customer service (and, implicitly, an incomprehensible phone tree with horrifically distorted hold music).

I just ran brew install php. I feel dirty twice over.

After about an hour of tinkering I have (a) achieved my goal and (b) become freshly annoyed with PHP.

February 11
I've given up for now on making sense of the Java-based protocol code I was looking at, not least because I'm not really trying hard to follow it and instead looking for a quick hack. The problem is that trying anything out with it is a fairly heavyweight process, so even if a quick hack exists, implementing and testing it is likely to be a royal pain. So, back to good friend ozwcp to reset the broken nodes and hopefully get the network back on track.

February 10
In which I find myself tinkering with PHP for reasons. Oh boy.

Thanks to some assistance obtained on Mastodon I put in a simple filter on my mail server to refuse email from unauthenticated connections claiming to be my domain. Surprisingly it's actually picked up almost 20 hits in its first week in action, each of which would've been spam for me to deal with one way or another. So that's nice.

February 9
Foundation is holding our interest nicely so far.

Dealing with a website hosting company's "easy" site editor. At some point I rolled back changes by restoring a backup and it regenerated all the HTML element IDs ... which I'd been using in javascript to reference said elements. Lovely.


February 8
Daleks' Invasion Earth 2150 A.D. is another brutal experience of how bad 60s sci-fi could get. The effects are ... non-existent, the acting has more ham than a pig farm, and the musical score actually made me laugh at one point where they went into a weird percussion-heavy lounge-music number of a big fight sequence. Groovy! For some mysterious reason this fared poorly at the box-office.

Parkrun, Sanctuary Runners: there was cake. Also coffee, tea, water, biscuits, fun-size snacks, cupcakes, balloons... and lots of fun!

February 7
I tracked down one of the messages in the zwave logs relating to a device with a node ID that isn't on my network, and it turns out to be a bitflip error. A checksummed bitflip error, at that.

February 6
Sancutary Runners: 7 years old today. Happy Birthday! There's probably a group near you: come find us this Saturday at Parkrun or wherever and help us celebrate! There may be cake...

Foundation: I did not see that episode ending coming. I do not know where this is going, but I'm intrigued.

February 5
New TV bubblegum: Foundation. I did not realise this was at least partly filmed in Ireland.

February 4
Final episode of Rizz and Is was ... banal. Other than being heavily laden with schmaltz and a bit of a montage, it was basically the same as any other episode.

February 3
School night, so back to Rizzoli and Isles. We're down the last few episodes and will need to figure out what we're watching next; George Gently is good but the episodes are 90 minutes long so it's like watching a feature film every night, which isn't really our thing.

Got an email from someone thanking me for a reverse-engineering hack I did 20 years ago and in which he found a bug. I am bemused that it's still a going concern, to be honest. Still, I've updated the docs. I've also updated the code, I think, except I don't have anything it'll build on any more, or the hardware to test it...

February 2
Looks like the car charger is back online: a burp a little after midnight, then full data from about 04:45. I'm actually slightly disappointed as I was going to check if it was functional while allegedly offline. I suppose I could just block it from WiFi and see what it does.

Why I dislike Homebrew, in general: just now I asked to to install something, then went and fiddled with some other stuff. When I checked back it was building bash from source. I refuse to believe that the version of bash shipped with the system is not sufficient to requirements.


February 1
More George, wherein I recognised the gate of Dublin Castle due to the presence of a Unicorn on top of it. Apparently the series was at least partially filmed in Ireland, which I find highly amusing, given the thickness of some of the Geordie accents and the completely over-the-top Oirish Character, sur. (named China, no less, a very common Irish name...)

previous month | current month| next month


Waider
No leapday bugs this year