Plex Transcode, Vex Commode

What good is a streaming media server if it doesn’t stream media? No good, that’s what.

Some time after installing the Plex Media Center plugin on my FreeNAS file server, I tweaked some settings. One of those was “Transcoder temporary directory”, which I set to be some folder I created inside my Plex chroot jail. A few days later, after forgetting all this, I attempted to play some movie through the PlexWeb player, and the player just sat and spun forever. So I opened XBMC and attempted to play; that worked just fine. On a Windows machine, the Plex standalone player worked just fine, also — until I changed the streaming settings to disable Direct Play and Direct Stream and have Plex standalone request a lower bitrate (to go over my cable modem). Playback ceased to function. So, what gives?

Turns out, the transcoder was failing silently, so it wasn’t feeding any lower bitrates to either the Plex standalone or the PlexWeb player. So among the list of settings I was jabbing at I cleared the Transcoder Temporary Directory setting and boom the playback started working again. Huh? It took several minutes of digging into the jail chroot to figure out that the problem all along was a Unix file permissions issue — the folder that I had created through FreeNAS to store the temporary transcode files was owned by a user that wasn’t the Plex software’s user and by a group that the Plex software was not a member of, and the “other” permissions were read-only. Huh! So I chmodded the folder o+w and tried again. Success.

This simple fix was a slap to the forehead after monkeying around with settings for weeks, trying to find logfiles, restarting the jail, even reinstalling the Plex plugin in FreeNAS. It seems the obvious fixes are not so obvious to the oblivious.

Numb Dive Thumb Drive Dumb Live

A few days after purchasing my 2012 Honda Civic, I’m beginning to learn a few of its quirks. The car comes stock with an audio unit that plays AM/FM, CD, Line-In, as well as USB support for thumbdrives and iPod. “How cool is that?” I asked. So I loaded up one of my spare thumbdrives with a miscellany of tunes from my collection, hopped in the car, plugged it in, and started scrolling through the list.

What I found was an unsorted collection that had neither rhyme nor reason in its sort order. Tracks from Tool were sorted before Combichrist. All the tracks on The Knife’s “Bleeding the Habitual” were completely out of order. The hell?

I did some digging around. Apparently, the MP3 playback feature sorts all of the files on the thumbdrive according to when they were copied onto the device. Yeah, you read that right. The thumbdrive must be formatted FAT32, an old hard disk format written by Microsoft before it made NTFS the default in all its OSes. If you open a command line window and change drives to one with a FAT32 format and then do ‘dir’, what you’ll find is a somewhat unordered directory listing. Why is that?

Under the hood, FAT32 stores references to all its files one-by-one in a data structure on the disk; when you add a file to a FAT32 directory, the reference to that file is appended to the end of that data structure. When software gets a directory listing, it will, in the very least, get an exact copy of this list. The indexes, you see, are exactly as written: one-by-one, appended to the end. If you want to sort the files on any kind of criteria such as modification date or alphabetical by filename, you must first read in this directory list and sort it yourself with your own software. This is very low-level stuff.

I can understand where the Honda firmware designers opted to sort files based on FAT32 directory entry; it’s cheaper, processor-wise and memory-wise, to query the directory structure and run with that instead of having to read it in and then create the data objects in memory to sort things alphabetically. It takes less time and memory for the radio to do so, and it requires less software engineering talent and money to write and test the code. However, it’s a rather lazy thing to do so, considering that even the smallest of modern embedded computer systems can have as much power and space as necessary if the engineer is crafty enough.

All told, I think it was a budgetary decision on Honda’s part; if their engineers can save $5 per unit for however many millions of units sold, then they’ve made their upper management very, very happy. Someone’s getting bonuses. The downside is that the end user gets a higher degree of confusion which is exactly the kind of thing nobody needs when they’re behind the wheel. To find their music in their collection, they’d have to move their eyes from the road to the screen to scrutinize page-by-page to find the music they want. This is a bad thing — distracted driving kills.

So. How do we work around this shortcoming? Well, luckily for us there is a Linux command-line utility called Fatsort. You can use it on any FAT32-formatted partition to rewrite all of the directory entries so that they’re in alphabetical order. A typical invocation is as follows:

fatsort -f -I -c /dev/sdg1

What this does is to apply an alphabetic sort while (-c) ignoring case, (-I) ignoring prefixes like “a” and “the”, and (-f) forcing the reorder on the mounted filesystem at /dev/sdg1. Your invocation will most likely differ.

After dumping all the music I could fit on the thumbdrive, I processed it with fatsort and plugged it into the head unit. Now all my artists, albums, and songs are sorted alphabetically so I can keep a mental map of where to scroll without taking my eyes off the road too much. I can now know with confidence that King’s X is just before KMFDM.

I wonder if Honda has an updated firmware ROM that fixes this sort of problem. One can only hope. Then again, asking a specialist mechanic at the dealership might be like talking to a wall. Not everybody pays attention to low-level details.


Car’s gone. Got hauled off today. Check is in the mail.

Today’s been one of those days where you pick up your shoes three times and drop them every damn time.

Extremities are tingling; I think I have circulation problems. Or a pinched nerve. Or too much caffeine on a daily basis. Caffeine’s a vasoconstrictor. Or I’m just old.

Strange times at work. Still figuring my ass from a hole in the ground. Everybody’s busy, nobody’s helping. Actually, help is there if I’d actually break silence and ask for it.

Changes. Changes are happening. Not at all welcome, but shit happens to force my hands. Best I can hope for is to push through with grace in these times of friction.

Intransitive Introspectre Interrogator

I’m currently intoxicated and trying to edit instrument definition files in Sonar for this music project. Making minor mistakes, and it’s hilarious. Fan is in the screen door blowing in, but the breeze is blowing through in the opposite direction, making things funny. I just don’t care. So far, no neighborsmoke blowing into my house, so that’s good. Eventually, I’ll finish this music project and publish it. Eventually, I’ll move out of this apartment. Eventually, I’ll live in the world again with people I trust. Eventually, life will begin again. Eventually, I will hope.