Category Archives: Multimedia

Medion MD 86162 Media Player remote codes

I’ve got a Medion MD 86162 Media Player (AKA e85015, or MD86162) and I couldn’t find the remote codes anywhere on the Internet. I cobbled up some hardware and discovered that it uses the NEC protocol when I coaxed these codes out of my dying infrared remote control, and I got the following IR codes for it:

Continue reading

Replace a missing remote control with an Arduino and a laptop

I recently found myself without a remote for my WDTV Live media player, and limited resources to do anything about it – but I did have an Arduino, a breadboard and the local Jaycar had an IR LED.  Controlling IR devices is common practice with an Arduino. I would even be able to hack in functions that didn’t exist on the manufacturer’s remote – like creating a three minute skip by switching to 16x speed for 12 seconds.

The first port of call was to obtain Ken Shirriff’s Arduino IR remote control protocol library – as opposed to communications protocols, of which there are quite a number; did you know the first cut of WiFi included an infrared version? Without the remote, I wasn’t able to record and playback the IR signals sent to the WDTVLive, as you would with a learning remote. I had to find what to transmit from my custom remote. I little googling and I found the WD TV Live infrared remote control codes, which also helpfully reveals that the protocol is NEC.

I knocked up a quick proof of concept, installed it and watched it not work. Given I can’t see in infrared, I didn’t know if my circuit was working. I hooked a red LED up in parallel, and it didn’t light up; I thought I had cathode and anode swapped around, so flipped the red LED – and it didn’t light up. I pulled the IR LED, and then the red LED worked… I was shorting out the red LED. I couldn’t – with the bits I had lying around – confirm the device was transmitting anything. Rather than put the LEDs in series, I got a cheap camera-phone with video function, and it could see IR just fine. And it turns out the IR LED was transmitting something, but the WD TV Live media player wasn’t listening. Why?

The NEC infrared control protocol transmits 32 bits in one of two formats, one old (as in elderly) format encodes for 256 devices with 256 commands each, and the other encodes for ~64K devices with 256 commands each. The first 16 bits encode the device, and the second 16 bits encode the command. 16 bits for one of 256 commands, you ask? Well, one byte of the second 16 bits is the command, and the other is – for error checking purposes – the one’s complement of that. Further details of the pulse timing and protocol contents are available in various places, but they neglect to mention the extended addressing format. There are many IR control protocols. To use Ken’s IR library you need to know which protocol is used (which the google search revealed), and you can determine the protocol from the timing data found in the LIRC definition of a protocol, in this case the LIRC infrared control protocol for WDTV Live media player remote. The LIRC protocol defintion format is described by WinLIRC, so you can see what the timings are. In this case, the NEC protocol is revealed by the header, one and zero definitions, along with the fact that each code has 16 bits of ‘pre-data’ and 16 bits of data (a 32 bit package). Everything I could see was showing that the two, separately arrived at sets of command codes that were empirically sampled from the real world were compliant with the spec. One of the things the spec taught me was to transmit the NEC code twice, and to wait 70ms between re-transmissions.

I wasted time finding other codes for the remote, in other formats; I checked for byte ordering issues. Nothing worked.

The actual problem was the unsigned long for the command was previously an int; failing to notice this simple error led me to spend a long time trying to figure out why nothing was happening when I transmitted a command. One of the problems with the C language is the guarantees about data sizes aren’t worth much.  My entire life has been spent programming on architectures that have 32 bit data words; C compilers on these machines have all defined an int as 32 bits, but I’ve always been aware that the language spec says that an int is at least as wide as a short, which is at least as wide as a char with actual widths being up to the compiler implementation (although why you’d have different words for things of the same size is beyond me).  The AVR microcontroller in question has an 8 bit word; mathematical operands typically yield an 8 bit result (multiply is an exception) with compilers needing to implement more instructions to yield greater data widths. The defines express the codes as four byte values, which were then wrangled into a two byte int, and then again into unsigned four byte integer when passed to the IR library. Truncated bits in a protocol like this were the cause of inactivity.

Even with this fundamental problem solved, confusion was added by the fact that one of the memory cells in my Arduino is faulty. Once IR control code transmission was working, I noticed that sometimes it didn’t work. I decided to echo the command to the serial port, and the command being transmitted didn’t match that for the key pressed – the second byte was wrong. I added code to work around this memory corruption (not shown in the code below, because this is a pretty unusual). I’ve never come across this kind of problem before, recognising and then solving something like that is pretty old-school.

/*
Pin 3 is hard-wired into the IR library as the emitter
 */
#include <IRremote.h>
//#define DEBUG

IRsend irsend;

#define btn_enter  0x219E10EF
#define btn_right  0x219E906F
#define btn_left   0x219EE01F
#define btn_down   0x219E00FF
#define btn_up     0x219EA05F
#define btn_option 0x219E58A7
#define btn_back   0x219ED827
#define btn_stop   0x219E20DF
#define btn_rew    0x219EF807
#define btn_ff     0x219E7887
#define btn_play   0x219E50AF
#define btn_prev   0x219E40BF
#define btn_next   0x219E807F
#define btn_eject  0x219E08F7
#define btn_search 0x219EF00F
#define btn_home   0x219E609F
#define btn_power  0x219E48B7

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
const int onboard_led = 13;
const int retransmit=2;
unsigned long play_after=0;

void setup()
{
  pinMode(3, OUTPUT);     
  pinMode(onboard_led, OUTPUT);     
  Serial.begin(9600);
  Serial.println("WDTV Live serial controlled IR remote");
  Serial.println("~ Power    Eject ^ & Search   Rew - + FF");
  Serial.println("  w         Back q e Enter   Play  P");
  Serial.println("a s d (Arrows)     x Stop    Last < > Next");
  Serial.println("3 - FastForward three minutes");
}

void loop() {
  unsigned long cmd=0;
  if (Serial.available()) {
    switch (Serial.read()) {
      case 'E':
      case 'e':
      case ')':
      case '0':
      case 'O':
      case 'o': cmd=btn_enter; break;
      case 'q':
      case 'Q': cmd=btn_back; break;
      case 'P':
      case 'p':
      case ' ': cmd=btn_play; break;
      case 'S':
      case 's': cmd=btn_down; break;
      case 'W':
      case 'w': cmd=btn_up; break;
      case 'A':
      case 'a': cmd=btn_left; break;
      case 'D':
      case 'd': cmd=btn_right; break;
      case '-':
      case '_': cmd=btn_rew; break;
      case '=':
      case '+': cmd=btn_ff; break;
      case ',':
      case '< ': cmd=btn_prev; break;
      case '.':       
      case '>': cmd=btn_next; break;
      case '/':
      case '?': cmd=btn_option; break;
      case '~': cmd=btn_power; break;
      case '!':
      case '1': cmd=btn_home; break;
      case '^':
      case '6': cmd=btn_eject; break;
      case '*':
      case '8': cmd=btn_search; break;
      case 'x':
      case 'X': cmd=btn_stop; break;
      case '3': 
        if (!play_after) play_after=4; break;
    }
  }
  if (play_after > 0) {
    if (cmd) {
      play_after=0;
    }
    else if (play_after > 5) {
      if (play_after < millis()) {
        cmd=btn_play;
        play_after=0;
      }
    }
    else {
      cmd=btn_ff;
      if (--play_after == 0) {
        play_after=millis()+12000;
      }
    }
  }
  if (cmd) {
    digitalWrite(onboard_led, HIGH);   // turn the LED on to indicate activity
    for (int i = 0; i < retransmit; i++) {
      irsend.sendNEC(cmd, 32);
      delay(70);
    }
#ifdef DEBUG
    Serial.println(cmd, HEX);
#endif
    digitalWrite(onboard_led, LOW);    // turn the LED off - we're done transmitting
  }
}

In other links, How-To: IR Remote Control your Computer

Windows Media Center Edition 2005 doesn’t need wmlauch.exe

For those of you installing Windows Media Center Edition 2005 off MSDN disk 2429.4 (November 2005) and freaked out by it asking for a Windows XP Service Pack 2 (Windows XP SP2) disk, don’t worry: Just select the “skip this file and continue anyway” option because the install doesn’t need wmlauch.ex_ or wmlauch.exe – and I’m lead to believe that Windows XP SP3 will add it, or if not, Automatic Updates will. Just relax, and go with the flow.

I think that’s enough keywords, searching ought to find this now. Oh, hang on: Windows MCE 2005.

BTW, your XP Professional disk with integrated SP2 doesn’t hold the requested file, so don’t bother looking.

No more Pinnacle

It’s this kind of thing that Geekrant was devised for.

I’m boycotting Pinnacle products from here on in.

Pinnacle Studio 10 Plus is pretty good. Good enough that I don’t feel the need to upgrade to the latest and greatest. It handles all the video formats I use quite well. It grabs a lot of resources, but video editing always does. I’m happy with it.

BUT… the Pinnacle 310i capture card I have… it’s never worked well. As I have written before, the media centre program that came with it was horribly slow. The capture results were good, but I always had to keep an eye on the CPU usage, or it would start dropping frames.

(I bought it in the first place because Australian Personal Computer noted it in its Best Tech column. I’ve read that magazine for decades, and generally trust its opinions, but won’t be using that particular column for a recommendation again.)

Eventually I got it running with Virtual VCR, which is analogue only, but gave consistently better results.

Then a couple of weeks ago it died. Completely. No response.

After wrestling with drivers for a bit, I disabled it and went and looked for the Pinnacle 60e USB tuner I’d got as a freebie with Studio.

I tried it with some of the Pinnacle software, which was underwhelming. It’s DVB only, so wouldn’t work with Virtual VCR. So I looked around for freebie PVR programs, and found GB PVR.

GB PVR is one of those freebie media centre applications someone’s written. It’s reasonably responsive, if a bit bare-bones in places. It has some quirks, like it’s totally not designed to handle people operating it without a remote control… so for instance I haven’t found a way to record live TV manually; have to program it. And the timer only does 10 minute increments. Annoying.

Interestingly it seems to record the DVB-T stream directly onto the disk, leaving you with a TS file. This can be played using the K-Lite codec pack/Media Player Classic (VLC should play it too), and you can convert it using HDTVtoMPEG2 into a standard MPEG file to use in Virtual Dub and other applications. All good. (Well, as long as I tuned to the channels with the AC3 audio; some of the others required more fiddling to work.)

Once I figured out the quirks in GB PVR, I got absolutely outstanding quality recordings out of it. Really really clear, as you’d expect when working directly with the DVB stream. Fantastic.

Then the 60e stopped working. Un-#$&#ing-believable! Just stopped. GB PVR stopped doing what I asked of it. The logs revealed it couldn’t start the capture. Nothing would talk to it, tried uninstalling and re-installing, nope. Error 10 starting it up, whatever the hell that means. And the config screen reported there was now no capture device on the computer.

Dead.

Jeez.

Now, I might normally assume it was a problem with the PC. So I installed it on the other one. It worked for a couple of days, then also stopped.

So no more Pinnacle products for me.

Some of the Hauppauge capture cards look good. Alternately there are some new TVix products which double as standalone PVR/media player units.

Dave’s suggestion of going via Firewire is a good one that I’ll look at. Unfortunately my cheapie firewire video camera doesn’t have an input.

Home Improvements – Here endeth the lesson

For the story so far see Part 1 and Part 2. If you’re totally bored, then please don’t read on… this is the longest post yet!

So I got my Linksys NSLU2 home. I thought I’d fire it up and make sure it worked. There’d be nothing more frustrating than flashing it with the Linux OS, find it doesn’t work and then wonder whether the issue is with the new Firmware or the actual hardware.

Plugged it in, fired it up, plugged in and formatted a blank external drive I dug out of the cupboard. All good so far! I can’t plug in a disk with anything on it because the LinkSys requires disks to be formatted with EXT3.

Hmmm… what’s this… a firmware upgrade to the NSLU2 that allows it to read NTFS! That’d make the device usable until I get my head around the Linux options!

Loaded up the upgrade, all went smoothly. Plugged in my external hard drive to see if it works. Get “Drive not formatted” message in the NSLU2 admin screen, so it must not support NTFS after all. Oh well. Plugged the external drive back into my desktop PC.

“This disk is not formatted. Do you want to format it now? Yes/No”

My

heart

stopped.

An entire disk’s worth of data… gone. Video from when the kids were little, lots of photos… gone. I know what you’re all thinking… why wasn’t this data backed up? I have two responses to this. 1) It’s not that easy to back up a 14GB video file. 2) Part of the reason I was setting up this solution is to make automated backups more accessible!

Some have said that I shouldn’t have trusted the device with my data, but in my defence, it’s a shrink wrapped consumer device that’s designed to have drives plugged in to it. If I can’t trust this device with my data, I don’t have much use for it!

I kicked off a File Recovery scan and went to bed very sad.

In the morning, the file recovery had found a bunch of deleted files, but none of the files that were not deleted at the time of the corruption! I tried loading the drive up in a couple of EXT3 file viewers, but they couldn’t read the drive either.

I’d pretty much given up hope of getting my data back.

Then my neighbour nonchalantly suggests I try a partition table repair tool. I load one up and run it. It tells me “The partition table on the disk is incorrect. Would you like to fix it?” I click “Yes”. Bang. All my data is back!!!

Yay! Waves of relief! Not to mention proof that the Linksys had screwed up the disk. The partition table was written for an EXT3 disk, even though it was still formatted in NTFS.

Yesterday I took the Linksys back to Harris Technology and threw it at them as hard as I could. Actually I didn’t and they were incredibly helpful, giving me a full refund without any hassle.

So back to the drawing board. Now that I realise how precious that data is to me, I’m going to have to get a proper, RAID based network drive solution. More money :( I’ll probably go for a Thecus N2100.

Lesson the First
Imagine losing all your data that is not backed up. How do you feel about that?

Lesson the Second
No, really. Losing it. Right now. Seriously, how do you feel about that?

Weigh your reaction to the above questions against the cost of getting dedicated backup.

Here endeth the lesson.

Update: I was talking to Josh last night and he said it wasn’t clear that I hadn’t installed the funky open source firmware on the LinkSys box yet. It was running the latest official firmware release. I probably also didn’t emphasize enough that I wouldn’t recommend anyone buying one of these pieces of junk

Home Improvements

I’ve annexed a room at my house to be my ‘den’. First order of business is getting some entertainment in there.

Requirements:

  • Watch DVDs
  • Watch other media from my computer
  • Reasonably inexpensive

My current solutions contains the following components:

  • Xbox running XBMC as a games/media streaming console (just purchased from Global Consoles)
  • Some sort of network storage so I don’t need to have my PC running constantly.

The network storage decision is narrowing down. I considered solutions such as the Thecus N1200. I dismissed this as being overpriced and probably overkill for my needs.

My current front runner is a Linksys NSLU2. It doesn’t have any internal disks, but has two USB ports to plug in external drives. The real beauty of the device (affectionately known as the ‘slug’ by fanboyz) is that there is an open source Linux based operating system that can be installed to it. This adds lots of extra functionality like all sorts of servers (print, bittorrent, iTunes, media/photos). I was even thinking I could install svn on it and it can be my source control repository.

I’ll let you know how my plans proceed. Any advice/comments would be very welcome!

The easy way to record any audio playback in Windows

People jump through all sorts of hoops trying to record audio direct from the source, which is particularly tricky when it’s a WMA or Real streaming cast.

But it’s actually dead simple to do this, at least for short periods: (Instructions for Windows XP)

Windows XP volume control1. Double-click on the Volume Control speaker in the taskbar. The full Volume Control will open up, with lots of different levels.

2. Click Options / Properties. Then in Adjust Volume For, choose Recording. Then make sure either Mono Mix or Stereo Mix are turned on. (Obviously Mono is sufficient for streaming of AM radio stations, for instance.) Then click OK.

3. The recording levels will then be displayed. Click on Select for the Mono or Stereo Mix option you’re going to use, and adjust the volume to something sensible. This will tell Windows which of the many “inputs” you wish to record audio from.

4. Leave the recording levels visible, and go and open Sound Recorder, as well as whatever sound source you want. When you click Record in Sound Recorder, you should find it successfully records whatever sounds are outputting from the computer at the time. Adjust the volume level to suit.

As many know, Sound Recorder will only record up to 60 seconds at a time. So it’s not perfect, but it is built-in to Windows, so everybody has it, so it’s a good quick’n’dirty solution for short recordings.

I’d assume that other recording tools that can record for longer periods would also use the Volume Control applet to choose which input they’re taking. At least I hope so.

Mediagate MG35 media player

Many of us watch video on our computers. But I reckon most of us would prefer to be reclined on the couch watching them on our TV instead. Sure, you can burn the content onto a DVD, but it’s time-consuming, and not really worth it for once-off viewing.

There are solutions though: Apple TV is one, though it’s been criticised for its poor picture quality and of course it’s somewhat tied to the iTunes ecosystem. And as far as I can see the most popular torrent formats such as DivX/XVid aren’t supported. (For when you’re playing those… umm… public domain movie torrents…)

The killer for me though is that it needs a widescreen TV. Call me a luddite, but I don’t have one yet. I’ve got a 5-year-old 4:3 TV that is doing just fine thanks, and I’m not planning on replacing it for a few years yet.

Mediagate MG35Someone put me onto the Mediagate MG35, though admittedly I was primarily looking for a network shared drive at the time. This turns out, in a way, to be both a shared drive and a media player. Bonus. And when Zazz had it on special, I threw caution into the wind and ordered it. You can get them either without a drive (just install an IDE drive yourself) or with one already installed. I was feeling lazy and went for it with a 250Gb drive pre-installed (which beats the crap out of AppleTV’s 40Gb version…)

It’s got a white Apple-like front, which doesn’t fit in brilliantly with my livingroom setup (mostly black, which I prefer, it fades into the background while watching telly) but given it’s not large, and the sides/back are black, it looks okay. A bright blue light goes on when it’s running, but you can choose to turn this off. It’s quiet, and fairly easy to setup. You either plug it via USB directly into your computer, or use an RJ-45 and plug it into a router. It picks up an IP address, and you’re away. (Note the manual warns against both USB and Ethernet connections simultaneously).

USB it happily sees the device as a drive, and you can copy files to/from it. By Ethernet you have to install a driver (which I’m fast realising is a disadvantage with most domestic-grade network drive devices) before you can copy files. USB is faster than Ethernet, but the other advantage of the Ethernet connection is that it can play files off a computer over the network, onto your TV, by creating a Shared Drive on your computer. There’s also a Wireless version if you prefer not to have blue cables trailing around your house.

(The manual is a bit vague about it, but it turns out the share needs to be accessible to one of the following username/password combinations: Guest / (blank); Administrator / (blank); Media / gate.)

It supports numerous formats including MPEG 1,2,4 and XVid, as well as various music formats and JPEG photos. I had some trouble with a couple of MP4 file I tried (an ABC “Vodcast”); it recognised them but wouldn’t play them, so that requires further investigation (and possibly the latest firmware). You choose which file(s) by browsing the device or a shared drive using a nice little remote control, powered by a watch battery.

Connection to the TV/stereo is by S-Video, optical, component or olde fashioned RCA/Composite.

And the playback quality? Well I’m no videophile, but I reckon the quality is pretty nice; very watchable, and the sound is good. Provided the source file is good, of course.

So all in all I’m very happy with it.Thumbs up!

The downsides? Not as many supported formats as the rival DLink DSM-320. In particular no WMV or MOV support, so protected legal movie/TV downloads will remain stuck on the computer.

Priced from A$190 (without HDD). Other cheaper variants such as the MG-25 (which is USB-only) are also still available.

Technology lets down playback

I can think of two examples where digital media has limitations which affect the fidelity of playback in a major way: with music it’s gapless playback, often noticeable on MP3 players and with CDs on some players. With DVDs it’s layer changes, again, worse on some players than others.

This shouldn’t be the case, of course. Digital media of course is meant to be better than analogue, in every respect. I don’t know if there are standards mandated in the relevant formats, but perhaps there should be… or at least some documented workarounds, such as recommending where DVD authors place layer-changes.

After all, these kinds of things can ruin the enjoyment of a movie or piece of music if handled badly.

Have iPods peaked?

You’ve probably heard of Peak Oil.

Have we also reached Peak iPod? MP3 functionality is now available in most mobile phones, and the bulk of people probably don’t particularly want to be carrying a separate music player around.

Meanwhile, there are suspicions that iPod shuffle isn’t totally random. Shades of the Tivo that thought its user was gay?

Antenna saga

As part of the ongoing antenna saga, the weekend before last I acquired some coax from Bunnings (I thought 20m would be plenty – wrong! Just enough), and a mast. I mounted the mast on the facia and strung the coax up in the roofspace, and left it at that.

This weekend it rained cats and dogs Saturday and I was out of the house until mid-afternoon Sunday, so I wasn’t left with much time to finish the job before sunset Sunday. But, like a fairly well oiled machine I managed to disconnect the antenna, loosen all the bolts that needed loosening, cut it down, fold it up, drag it to the manhole, try putting it through, pull it back out again, fold it up better, put it through the manhole, drag it outside and up to the roof, mount it (very cool that the mounting bolts were still hanging on the antenna even though it had originally been hung in the roof space), realise there wasn’t a hope in hell I was going to hook up the coax with the antenna floating out in the air like that, dismount it, hook up the coax (noticing of course how easy it is to slice through the braiding when slicing through the plastic sheath and having to do it again), discover that the weather sheild for the connector was knackered and ‘repaired’ it with a metre of electrical tape, remount it, discover the mounting bracket was on back-to-front, remount it, tighten up all the bolts, tape down the coax to the mast and return to ground level just as the sun set.

A very tidy piece of work, which only required me to attach the other end of the coax to the splitter and away we’d go. My figuring was, hook what we’ve got into the splitter and I’d see how the picture was and make adjustments later; worst case scenario was that our TV reception for a week would consist of bunny ears. Except the modern coax differs from what’s already in the house in two ways: firstly, it’s aluminium shielded instead of copper; secondly it’s smaller and thus the mounting clamp in the splitter wouldn’t actually grip the de-sheathed coax. I ended up creating a solid mechanical connection by restoring the sheath on the top half of the coax.

Testing revealed a miraculously improved analogue picture quality, including rock-solid SBS reception and Channel 31 visibility. Some negative ghosting was evident, and the Channel 31 picture could improve a little more, so perhaps there will be some fine tuning of the direction next weekend utilising the advanced technolgoy of our radio phone. The splitter doesn’t seem to be detracting too greatly from the signal, so it could be staying. I ought to get some 75 ohm resisters ‘tho. I think there are only two active leads from the four-way splitter.

Signal strength reported by the HDTV cards on all channels has improved to the 95-98% range.