In my never-ending quest to rid the house of anything to do with Microsoft, I decided time was up for the Core 2 Duo, circa 2006, that had been doing Sterling service as our Media Center, first running Windows 7 Media Center and then upgrading to Windows 8 (plus the paid-for Media Center addition).
It’s worked quite well, but has occasionally hung (and inevitably, it hangs just when a really good TV program needs to be recorded). and exhibited other, sporadic and quite rare, weird behaviours. The PC itself was an old rack-mounted monster and was beginning to show signs of its age. All things considered, therefore, I felt it was time to put it out to pasture.
What to replace it with? Well, my first choice might have been another PC running something like MythTV… but ToH has to be taken into account, which rather rules out anything requiring more than an on/off switch, to be honest. I wouldn’t call myself a MythTV expert, either; and the one thing I know about it for sure is that it can be scarily complicated… so no thanks! Something more “consumer electronic good”-like, and less PC-ish. Something that just works. Something that doesn’t cost the earth.
Well, the picture at the top of this post gives the game away: after exhaustive minutes of online research, we bought a Panasonic DMR-HW220. It comes with WiFi built-in, plays MKVs, has a 1TB hard drive, twin HD tuners… and thus seemed to fit the bill perfectly, especially because it was only $340.
If only I’d read the small print (or the online reviews that spell it out!): whilst the machine is Wifi-aware, it has no concept of mapping network drives. It can’t see Samba shares. It’s network capabilities are, in fact, limited to acting as a DLNA server and/or client.
DLNA?? Someone of my age and upbringing probably thinks it’s a splinter Irish terrorist organisation, but in fact it stands for “Digital Living Network Aliiance”, and it’s a set of standards built around UPnP to determine how different electronic media devices play nice with each other. In my home media center context, it means that the Panasonic is a DLNA Client, and that means something on the PC has to be running as a DLNA Server (and Samba or NFS don’t count).
Immediately, therefore, things are more complicated than I’d like: how to run a DNLA server on the CentOS box that’s hosting all my movies, music and photos?
Happily, such a beast does exist and it’s relatively painless to set up: MediaTomb. I could also have installed miniDNLA, which works very simply, too. You can obtain it with a simple “yum install mediatomb” once the RPMForge repository has been added to your list of software sources. Once it’s installed, you need to start the thing with a service mediatomb start -and a chkconfig mediatomb on to make it re-start automatically at every subsequent server reboot. Once it’s running, do a service mediatomb status to find out what port it’s running on: by default, it’s 49152, but a status check will make certain.
Once you know the port, just fire up a browser and type in an address of http://<server IP>:49152 (or whatever port you’ve determined is in use). You should see a pretty bare-bones interface. Select the Filesystem link and you’ll see a tree-like representation of your server’s hard disk structure. Navigate to where your media files are then click the ‘Plus-in-a-Circle’ button on the top right:
Here’s where you get to mark a directory (and it’s sub-directories, if you tick that ‘Recursive’ option) for inclusion in the list of what this DLNA server can, er, serve. Scoot on over to the Panasonic, select the correct option to act as a DLNA client and… bingo! The appropriate directories are now browseable.
Erm… except that none of my MKV files were actually playable! I could certainly see them on the Panasonic, but they were greyed out. I checked the box: “MKV Playback” was definitely there in big, bold letters. So why my MKVs couldn’t be played, I couldn’t quite fathom. Until I read up on DLNA a bit more and discovered that MKV is not a supported container format for DLNA. Some clients can deal with them, but most can’t… and the Panasonic certainly doesn’t.
Had I read the ‘Cons’ column at the top of this product review before purchase, I don’t think I’d have bothered with the Panasonic at all, to be honest: “Can’t play MKV over network”. Plain and simple.
My plans to workaround this awful limitation consisted of copying my MKVs onto a USB hard disk, plugging that in and having the media play from there. Except that when you plug in a USB disk like that, you have to “register” it with the Panasonic device …which means “format” it, and with some sort of file system the likes of which none of my Windows or Linux boxes have ever met before. Once the Panasonic has touched the disk, nothing else can, basically. Too late I discovered that the ability to plug in USB devices is intended to get stuff off the internal 1TB hard disk by way of backup, but not to let you put stuff on to it via a PC, for example. DRM rears its ugly head, therefore, and makes an obvious way of media ‘injection’ non-viable.
(I believe that the on-box claim for MKV playback relates to the ability to play from an SD card. Not exactly what I had in mind, though).
At this point, I fear it’s obvious that I haven’t done my homework, and I am accordingly saddled with a machine which barely meets any of my functional requirements (it can record two TV channels at a time in HD, but that’s about it).
There is one saving grace: MKV is a container, not a video encoding. It’s therefore possible to extract the contents of an MKV and re-pack it in an MP4 container (which the Panasonic does play over the network, because the DLNA spec says it must), without any re-encoding effort. (That’s important, because with a couple of thousand video files to deal with, re-encoding is not an option!)
Various tools can do this re-packing trick: on my Fedora box, perhaps the simplest is Avidemux. You open your MKV, set the Video and Audio Outputs to “Copy”, select “MP4v2 Muxer” as the output format and then click Save. Done locally, a video file is thereby converted from unplayable MKV to playable MP4 in a matter of seconds. Done by pointing Avidemux to my network shares over the wire, however, and it takes a couple of minutes per movie… which is too long to be practical.
The obvious trick is to perform the re-packing on the server itself, for which a command line tool would be good. There is actually an Avidemux command line tool (avidemux3-cli, if you’re trying to yum install it), but scripting it is a nightmare and even invoking it file-by-file is a pain in the butt. So, in the end, I created this little shell script as a file called movieconvert.sh:
IFS=$(echo -en "\n\b")
ffmpeg -i "$f" -vcodec copy -acodec copy `basename "$f" .mkv`.mp4
The …IFS… lines are there to deal with the fact that a lot of my movie files have spaces in their names, which would result in ffmpeg trying to convert files called “2001″, “A”, “Space” and “Odyssey” instead of a single file called “2001 A Space Odyssey” (which would be wrong, of course, and thus just lead to runtime errors). Otherwise, the main action is done by invoking ffmpeg with a bunch of switches which demand the video file be copied, not re-encoded, but re-packed as an MP4, not an MKV.
I stuck that in /usr/bin (so it’s in my path), and now I can cd to any directory containing a movie file and do ./movieconvert.sh and everything then just happens automatically. Sure enough, the Panasonic can play the MP4s just fine, too.
So we settle down for the evening to watch one of the movies I’d converted into MP4, and all was going swimmingly. Until suddenly a pop-up appeared informing me that a scheduled TV recording was about to start and therefore the DLNA connection would have to be terminated. What??? Yup. It turns out that you can’t record a program in the background whilst watching a film over the network. Which makes this particular Panasonic a piece of crapola that got taken back to the store that sold it the very next day. Happily, a full refund was received with not too many questions asked.
So what am I using now? Funnily enough, exactly the same kit that the Windows Media Center originally replaced: a Western Digital WD TV Live, which does movies and music very well, using plain old Samba shares to which it connects without drama. And for the live and recorded TV, a relatively ancient Topfield TF-7100 (now about 4 years old, upgraded by yours truly to a 500GB hard disk some years ago, still going strong).
The only pain points in going back to this arrangement are that it would require 4 remote controls (WD TV LIve, the TV, the receiver/amplifier and the Topfield). Happily, a Logitech Harmony all-in-one remote control takes care of that. Which leaves just one real pain-point: the TV listings in Windows Media Center are clear and speedy to navigate. The Topfield equivalent is hopeless, displaying just one channel at a time and taking an age to load or move through. A many-channels-at-a-glance view would be good, but no such beast exists. Not even the paid-for ICE TV gives what is needed. For the moment, I have no answer to this one, then.
Whether we persist with this retro setup, I can’t say. However, I can say that the Panasonic DMR-HW220 is completely hopeless -and, indeed, that anything relying on DLNA is not something I’ll be letting into my house again any time soon! I am really surprised that there isn’t a single box which can do dual-channel live TV, multi-channel recording, Samba connections, MKV and FLAC playback, with a decent, synoptic program guide. But as far as I can tell, there simply isn’t: and that seems a curious gap in the market at this stage of the game!