Jan 19 2010

doorbell alert with Arduino


My brother and sister-in-law were generous enough to get me an Arduino kit for Christmas. It took me some time to think up a good starting project, but, while I was waiting for a package, it occurred to me that it would be nice to be able to hang out in the basement playing guitar and not have to worry about missing the doorbell when the UPS guy rings. It’s nearly impossible to hear the bell from the basement and I have missed more than one signature-required package just because I couldn’t hear it. While there isn’t an extra doorbell chime in the basement, I do have a computer down there, so I thought this would be a great opportunity to test out my Arduino skills.

Materials (as seen above):

  • Arduino (any version should do)
  • LED (any LED, but have the specs handy)
  • Photoresistor
  • Some resistors
  • Diode (I used a 1N4001; just make sure yours can handle your doorbell’s voltage)
  • A foam earplug
  • Electrical tape (black is probably best)
  • Something to put the circuit on (PCB, breadboard, protoshield, whatever)

(As a bonus, most of the materials, except a resistor, can be found in the Advanced Arduino Starter Kit I got)

The idea behind this project is to have an extender for the current doorbell system. While it would be fairly simple to replace the doorbell altogether (just wire a button to the Arduino), I wouldn’t to add on to the current system without interrupting it. For that, I had to do a little research. Doorbell circuits, as it turns out, use alternating current (AC) coming from the house, at least here in the US, which would be problematic with the Arduino. Whereas direct current (DC) sends a constant signal, AC alternates between positive and negative voltage. Remember sine waves from math class? That’s what AC looks like. If you try to hook that to an Arduino pin, it will read the signal as constantly switching between on and off many times a second. With DC, the Arduino only sees “on” when there is voltage and “off” when there isn’t, so it is much more convenient. It’s fairly simple to convert AC to DC using a diode, but it doesn’t eliminate the on/off problem, at least not the way I did it. A diode only allows positive current to flow, so when you run AC through it, it chops off the bottom half of the sine wave (it’s known as a half-wave rectifier). Unfortunately, that still leaves a bunch of humps on top that the Arduino will read the same as if you hadn’t done anything to the AC signal. You can use a couple more diodes to create a full-wave rectifier, which, while not perfect, would be good enough for our purposes; however, we only really need a half-wave rectifier for the circuit I created. It’s entirely possible to achieve the same results using a full-wave rectifier and a voltage divider, but I think my solution is a little simpler. You can read more about rectifiers on Wikipedia if you want to go that route.

After asking around on the Arduino forums, someone suggested I try an opto-isolator instead. That sounds pretty complicated, but an opto-isolator is really nothing more than an LED and a photoresistor in one package (they make up the “opto” part of the name, short for “optical”). When the LED lights, it triggers the photoresistor. The idea behind an opto-isolator is that you can have two separate circuits interact with one another without interfering with one another (hence “isolator”). In our case, we don’t want to take too much current from the doorbell circuit or it won’t ring very well. We also don’t want to overload the Arduino and we don’t want to have to deal with AC any more than we have to. Unfortunately, an opto-isolator isn’t something I have lying around and RadioShack doesn’t seem to sell them, so I thought I’d test my knowledge and build one myself. Like I said, it’s really nothing more than an LED and a photoresistor, both of which I do have, so I just need something to put them in. I decided to use a foam earplug, which turned out to be more of a pain than I had hoped, but it does a good job of blocking out external light. You’ll probably want to cut a little off the end to shorten it, but it will need to fit both the LED and the photoresistor (not the leads, just the main part). After that, stand it up and squish it down, like this:

We want to poke a big enough hole in the middle to fit our components in. I first tried an awl, but the hole kept closing up when the earplug puffed up, so I needed something bigger. I decided to use the end of a pen, though you could probably use a piece of tubing or a straw. You’ll need to hammer it to push it all the way through, so make sure whatever you use is sturdy.

Clear the gunk out of the hole and wait for the earplug to puff up again. Now that you’ve got a hole, start by shoving the LED into it. It’s kind of a pain to get it in there, but it should go most of the way in. Leave some room on the other side for the photoresistor.

You’re now going to shove the photoresistor into the other side of the earplug. It’s an even bigger pain than the LED was, but you want it to be right up against the LED so that the LED’s light output is the only thing effecting the photoresistor. When you’re done, you should have this goofy looking contraption:
Spider plug!
Just to make sure no extra light gets in anywhere, wrap it with the electrical tape so that it looks even more ghetto.
You should probably just buy a real one.
Is it elegant? Hell no! But it does exactly what I want it to do. What we’re going to do with our DIY opto-isolator is attach the LED side to the doorbell circuit and the photoresistor side to the Arduino. When someone pushes the doorbell, the LED will light. The Arduino, through the photoresistor, will detect the change and send a signal to the computer. You might remember earlier that I said we would be just fine with a half-wave rectifier. If you’ve read through Getting Started With Arduino, then you might remember reading about pulse width modulation (PWM). Using PWM, you can change the brightness of an LED by changing how fast on and off signals are sent to it. The same thing applies to our little circuit. While we are still sending only half of the AC sine wave, the signal switches so fast that the LED appears to remain lit (it may actually stay lit, for all I know, but you’ll want to look that up), so neither we nor the photoresistor can tell the difference. That means that when the photoresistor triggers the Arduino, the Arduino is only seeing one consistent on signal. Pretty neat, huh?

Before we hook anything up, you’ll need to see how much voltage your doorbell’s transformer is putting out. Take the cover off your doorbell’s chime and notice what a simple circuit it is. If you have a simple chime bell like I do, it is nothing more than an electromagnet and some rods. When you send current, it creates a magnet that slams the rod into a piece of metal, creating one chime sound (ding!). When you let go of the button, there is no electricity to create a magnet, so the rod goes back to it’s normal position, overshooting a bit on its way and smacking the other metal plate (dong!). For more on that, read this article. Anyway, the important thing here is to figure out what each of the terminals are connected to. On my chime, there are 3 terminals: front, transformer, and rear. Front is connected to the doorbell (front of the house), transformer connects back to the transformer, and rear would connect to a second doorbell if I had one. Set your multimeter to measure AC voltage and put the positive poker thing on the terminal connected to the doorbell and the negative poker on the terminal connected to the transformer. Have someone push (and hold) the doorbell while you look at your multimeter. My doorbell puts out around 10v, but yours might be different. Use the voltage you get to figure out the size resistor you will need for your LED. Look at your LED’s specifications and see what voltage and current it is rated for. Mine was a Vishay LED that could take a maximum of 3v and somewhere around 30 mA. I decided to play it safe and go with 2.5v and 20 mA. Using Ohm’s Law (voltage = current x resistance), I discovered I needed a 375 ohm resistor, which, as it just so happens, doesn’t exist. You want to play it safe and go higher rather than lower, so the next closest value is a 470 ohm resistor. Using a higher value than necessary will make the LED glow dimmer, but it really makes no difference for my circuit, so 470 is just fine.

Now, how are we actually going to hook it up? The LED needs to be hooked up a specific way or it will break. The longer lead of the LED is the positive lead and will connect to the doorbell side of the chime. Well, not directly. Since the purpose of the resistor is to limit current before it hits the LED, we want to connect the resistor to the terminal and the LED to the resistor. The other side of the LED will connect to the transformer terminal of the chime circuit. But remember that we still haven’t converted the voltage to DC yet, so we will need to add one more thing to our circuit: the diode. Connect the diode before the resistor; that is, it should connect to the terminal, the resistor to the diode, and the LED to the resistor. Like the LED, the diode also needs to be connected a certain way (the resistor does not). On one end of the diode, you should see a colored band (silver on mine) that runs around the body of the diode. That end should connect to the resistor. Think of it like an arrow with the point being the band; current will flow only toward the point and not in the other direction, so we want to point the arrow in the direction we want current to flow.

Now we get to connect it all to the Arduino. You’ll need to use a breadboard or a protoshield for this part (you can use it for the other part, too). Connect one end of the photoresistor to +5v on the Arduino and the other end to a spot on the breadboard. Connect a 10k resistor from ground to the same row on the breadboard, then connect a jumper wire from that row to analog pin 0 on the Arduino. The resistor keeps the Arduino from getting a bunch of wonky signals that would throw of its readings. That’s it! The completed circuit will look something like this (the two loose wires will connect to the doorbell circuit):
Yup, still kinda ugly.
Here’s a schematic of the same circuit:
Not nearly as ugly as the real thing.
Time to program the Arduino. The code is pretty simple; all you need to do is tell the Arduino which pin the photoresistor is connected to and tell it what to do when the photoresistor reacts to the LED (i.e. when the doorbell rings). I decided to have it print a little message (“ding dong!”) over the serial port. The important part of the code is here:

if ((lightLevel >= 500) && (oldLevel < 500)) {
Serial.println("ding dong!"); }

In English, that says that if the photoresistor detects light, print the message to the serial port (and if you watch the serial monitor, you will see the message). I wrote some test code to determine the light levels read by the photoresistor when the LED was on and off. It read about 0 when the LED was off and above 600 (usually closer to 700) when it was on. Since there is plenty of wiggle room in between those extremes, I decided to give myself a little space and use 500 as the sweet spot. The code says that if it reads a value greater than or equal to 500 from the photoresistor AND the value taken before the current reading was less than 500, then it should print the message. That little trick means that it will only print the message the first time the button is pressed instead of printing it over and over again when the button is held down (when the button is held, both values will be above 500). It also means that when the button is released (current value less than 500, old value greater than 500) or not being pressed (both below 500), it won't print the message. You can download the code here. Upload it to your Arduino. You may want to test it with a simple button setup like those illustrated in Getting Started With Arduino before you hook it up to the doorbell. Here's what my final doorbell test looked like:
Probably not the safest way to do it.
It works! If your doorbell is as crappy as mine, you may find that it doesn't always work perfectly. You may need to play with the light level threshold (in the "if" statement) to match your opto-isolator setup or change the delay time. The delay is in there mostly as a debounce precaution, but you may find that you need more or less for your doorbell.

Improvements, had I the money and skill to implement them:

  • Shrink it down and make it permanent. If I were going to keep this installed, I would probably use a Nano and solder everything onto a PCB so it would fit in the chime housing
  • Make it wireless. It isn't that useful if you have to be sitting next to it with a USB cable to use it. Adding an XBee unit or using a bluetooth Arduino would make it much more practical.
  • Add useful alerts. No one wants to sit there with the serial monitor open all day. Having a Growl plugin to notify you when the doorbell rings would be ideal.

If you can think of any other improvements, feel free to share. You could also, as stated earlier, simply replace the whole doorbell circuit with an Arduino. You could hook up a camera or have it send Twitter alerts (or both). I leave the rest up to you.


Aug 21 2009

site update and a quick how-to for xbox live

First, you’ll notice that I updated the site to a new theme. Why? I was using an older theme that didn’t support some of the newer WordPress features. Now there should be threaded comments and some other nice things. I still have some things to work out, like making the main column wider, but I have to figure out how first… I think it will require some image modification, which I don’t really feel like doing right now.

Second, Xbox Live has always annoyed me because I always had to call in if I wanted to stop them from charging me for another billing cycle. If, like me, the only time you use Xbox Live is when someone gives you a free month, that gets to be quite annoying. Turns out that it is now possible to stop them from automatically renewing your subscription right from your computer. Go to xbox.com and sign in (or click on your account name at the top if you are already signed in). From there, the easiest way to get where we want to be is to click “Contact Information” next to your avatar. On the next page, click “Membership Level” on the left. Finally, you should see in the middle box on the right a description of your current membership level, including this text: “Automatic renewal: ON.” Just click on “ON” and you are given the option to turn it off. I’m glad they finally allow us to do this.


Aug 21 2009

a comprehensive guide to pc/ps3 media streaming, part 3

[part 1 (streaming)] [part 2 (DVD ripping)]

Alright, now we can finally move on to the good stuff: HD DVDs and Blu-rays. I don’t have a Blu-ray drive, so my guide will focus on HD DVDs, but according to this Gizmodo post, the process is basically identical. I’ll point out the differences when we get there, but you can also check the Gizmodo post for help. Personally, since I use my PS3 for movies anyway and HD movies take up a lot of space, I wouldn’t bother ripping Blu-rays.

So why would we want to rip HD DVDs? Well, because it’s a dead format and it seems silly to have a whole extra player hooked up to your TV just to play movies you can’t buy anymore. By putting HD DVDs on your computer, you should be able to free up some space in your entertainment center and, if you were using a standalone player, you will also free up an input on the TV. However, this guide uses the Xbox 360 HD DVD add-on drive, so you’ll need to get a hold of one before we continue. If you are on Windows XP, you may also need additional drivers for the HD DVD drive; Windows Vista and 7 come with everything you need. You’re also going to need a big hard drive (you’ll need about 35 GB or more for each movie) and two programs:

  • Slysoft AnyDVD HD, for decrypting the discs and copying them to your computer–this is not free software, but you can download a 21-day free trial, which should be more than enough
  • RipBot264, for converting the files into a more usable format–RipBot needs a couple of codec libraries to run, but it’ll tell you where to get them when you run it (if you don’t already have them)

Download everything and install AnyDVD, then run RipBot264 (it doesn’t need to be installed) and get any of the libraries you don’t already have. Before we get started with the ripping process, be warned that it will take a good 12 hours or so per movie. It would take longer if you were following some other guides, but newer versions of the software we are using allow us to skip a lot of those steps. Also, I would again like to stress that you should only be ripping movies that you legally own. Hollywood, please don’t come after me.

Alright, now that that’s all out of the way, grab your HD DVD drive and plug it in to your computer. Windows should start installing drivers for it. Remember, if you are on Windows XP, you will likely need to follow these steps to make sure everything works (AnyDVD might take care of that for you, though, so you might want to just wait and see what happens first). Once everything is installed, pop in an HD DVD. AnyDVD should pop up a little balloon above your taskbar:

AnyDVD pop-up

It will probably also remind you that you’re using a free trial. Get used to it. That window pops up every time you do anything with AnyDVD. But hey, at least you didn’t have to pay for it, right? When it finishes scanning (it won’t really tell you, but the balloon will disappear and it should only take a couple seconds), open up AnyDVD’s settings so we can make sure everything is set. The first settings panel that shows up will show the status of your optical drives, so you can verify that your HD DVD has been read. Under the “Video HD DVD” section, have everything set like this:

AnyDVD settings

You can probably also have it remove menus and delete script files if you want. I think those are all the default settings because apparently it doesn’t save settings once you exit the program unless you pay for it. Oh well, the defaults are fine. If you are working with Blu-rays, you might want to check the boxes (under the “Video Blu-ray” section) for removing trailers, prohibited user operations, and region codes, though those options are mainly for people copying the disc to another disc and won’t make any difference for our purposes. Hit ok to close the window and ignore the warning it gives you if you changed anything. Right click the AnyDVD icon in your system tray (the far right side of the Windows taskbar) and select “Rip Video DVD to Harddisk.”

AnyDVD rip

It will ask you where you want to save everything, so pick a directory and hit “Copy DVD.” It will (again) remind you that you are using a trial version. Hit “Continue” and it will start copying the files. It is basically just copying over everything on the HD DVD, but it is also removing the encryption so that other software can actually use the files. For instance, if you try the next step without first using AnyDVD, it will read the HD DVD just fine, but will warn you that it can’t do anything with it until you decrypt it. Everything would be so much easier if we didn’t have to worry about copy protection…

Once AnyDVD is finished (it’ll probably take about 20-30 minutes), open up RipBot264. When you run RipBot, it scans your computer to make sure you have all the libraries installed. Assuming you already took care of that, the first window you will see is the queue window. The queue is nice because you can put a bunch of movies in the queue and just let the program encode them all one after another instead of you setting them up one at a time. HandBrake also has this feature, but we didn’t use it in the guide. Anyway, click “Add” in the lower right corner and you will be presented with a new window that will allow us to configure lots of options about our encoding, most of which we will be ignoring. Click the “…” button next to the video field. A browse window will pop up. Navigate to the directory created by AnyDVD (it’s probably the name of the movie). Open up the HVDVD_TS folder (for HD DVDs) or the STREAMS folder (for Blu-rays). This folder contains all the video files for the movie, but we are looking for the main feature. On HD DVDs, this is usually named FEATURE_1.EVO or PEVOB_1.EVO (the number is there because it is also usually split into two files); on Blu-rays, the extension will be .m2ts instead of .evo, but I’m not sure what the name will be (all of the guides I can find are exactly the same). For either format, you are basically looking for the largest file (since the feature will be the longest video). If it is split into two files, select the first one and hit “Ok.” It will analyze the file for a couple seconds, then present you with a couple options. The first, the “Playlist,” shows you the files you will be encoding. If the feature is split into two files, you should see that both of the files are part of the active playlist. Under “Chapters,” you can tell it to include chapter information or to ignore it. Under “Video,” you can tell it not to include the video in the encode, but that seems counterproductive for our purposes. Under “Audio,” you can select the audio stream. Some movies have both Dolby Digital Plus and Dolby TrueHD; it’s up to you which one you pick, but the TrueHD option will result in a larger file size (though the audio quality should be better). You can also select whether or not to include subtitles, but I don’t think there is a way to turn them on and off easily while streaming, so I recommend not including them unless you need them. The most important option here is the checkbox for “FLAC” above the audio selection (circled in the picture below). Check that box. Doing so will enable you to directly copy the audio stream rather than compressing it during the encoding process, resulting in better audio. However, if you don’t have a receiver that accepts 5.1 Linear PCM signals (and thus an HDMI input), you’ll need to uncheck the “Keep DTS audio in stream” option in the PS3 Media Server. Yes, that means that the server application is transcoding the audio, resulting in a lower quality signal, but if you upgrade your receiver later, you won’t have to re-encode your movies for better audio. Update: The reason the receiver needs to be able to decode Linear PCM instead of, say, the actual TrueHD or Master Audio stream is that the PS3 doesn’t fully support those codecs and has to decode them internally, so it sends them to your receiver as 5.1 Linear PCM. However, the new PS3 slim may support TrueHD and Master Audio streaming (though your receiver will still need to support those). That was a lot of talking without any pictures, so here’s a picture of all those options to help you understand:

RipBot add options

Alright, now that we’ve got all that squared away, click “Ok.” RipBot will take some time to Demux the files. Don’t worry if you don’t know what that means. I don’t either. Basically, it’s just going through the files and figuring out what’s in there. When that’s finished, you’ll see our original list of options, but this time you can actually change some of them. First, at the very bottom, select .MKV as your format and browse to where you want to save the file. Make sure the “Profile” (located under the video selection) is set to “[High 4.0] HD, BluRay, Consoles” (I’m pretty sure it’s set that way by default). Below that, you will see options for “Mode” and “CRF.” You can leave “Mode” set to “CQ,” but you’ll want to set the “CRF” to 18. “CRF” is basically how much compression will be applied to the video. The larger the number, the more compression, so if we want better quality, we want to use the lowest number. That will result in a larger file size, but what’s the point of HD video if you’re settling for lower quality? The “Properties” button will allow you to configure the encoding even more, but you shouldn’t need to and I have no idea what the options mean. You can also set the “Mode” to “2-pass,” which will enable you to select the bitrate for the video encoding so you can get an even better quality video. Personally, I have found “CQ” to be just fine. Under the audio half of the window, you’ll see another “Profile” option. Here is where you can select whether you want RipBot to compress the audio or simply copy the stream. If you didn’t select the FLAC option in the previous window, you won’t be able to select the copy stream option with the MKV format, which we are using. Personally, I like to select “x.x COPY STREAM,” which just copies the audio stream available on the DVD, thus resulting in no quality loss, but you can also have RipBot compress the audio, allowing you to leave the “Keep DTS audio in stream” option enabled in the PS3 Media Server utility. Finally, you’ll want to turn the “Normalize” option to “OFF.” Normalizing basically just makes everything louder, but I don’t like things altering my audio signal, so I turn it off. If you notice that your videos are significantly quieter than when you watch straight off the disc, you might want to set it at 100%, but I think they’re about normal with it off. Here’s how your options should look:

RipBot options

Ok, now you just have to hit “Done” and it will add the encode to the encoding queue. You probably want to uncheck the “Low Priority” option. If you leave it checked, RipBot will use fewer system resources, but it will also take longer to encode. You can add some other movies to the queue if you want, but it takes about 10-12 hours for each movie (on my machine, which is pretty fast). When you’re ready, just hit “Start” and let it run. When it’s finally finished, you have HD movies ready to stream to your PS3 or watch on your computer!

That wraps up my guides. If you’re confused about something or think I left something out, please let me know and I will update the post.


Aug 18 2009

a comprehensive guide to pc/ps3 media streaming, part 2

[part 1 (streaming)]

This part of the guide focuses on ripping DVDs to your computer for streaming to your PS3. You can also watch the videos on your computer, but most of the steps here are unnecessary if you only want to watch that way. These steps will leave you with a PS3-compatible video file. If you want to watch the video on your computer, you will likely need a good media player like VLC–the default players in most operating systems simply don’t have the right codecs.

Before we begin, you’re going to need some software. For all platforms, you will need HandBrake. If you are using Windows, you will also need DVD Shrink or a similar DVD decryption tool like Slysoft AnyDVD (we will be using AnyDVD HD later for HD DVDs and Blu-rays). I happen to like DVD Shrink best because it’s easy to use and allows you complete control over the what you copy over from the DVD, but it doesn’t work with some copy protection on some DVDs (I’ve noticed it most with Sony DVDs). If you’re using a Mac, you don’t need anything other than HandBrake. HandBrake is also available for Linux, but you may need additional software to decrypt the DVDs first. As a final note, remember that these procedures are only for DVDs you legally own. I do not condone illegal copying.

After you’ve installed the software, pop in a DVD and, if you are on Windows, open up DVD Shrink. HandBrake doesn’t decrypt DVDs on Windows, so we have to go through a couple extra steps first. If you’re on a different platform, hold tight while we get through decrypting. Let’s change some settings before we start ripping DVDs. Here’s how I have my settings:

DVD Shrink preferencesDVD Shrink output filesDVD Shrink stream selectionsDVD Shrink file i/o

I think most of those settings are the defaults, but it doesn’t hurt to make sure we’re on the same page. You can probably enable burning with Nero if you want, but I don’t have Nero, so there wasn’t any point for me to do so.

Now that are settings are set, click “Open Disc” and select your DVD from the drop-down menu. Hit ok and it will start analyzing the DVD. Once that’s done, you’ll see the main DVD Shrink window again, this time populated with a lot of options. We don’t need all the menus, so we’re going to reauthor the DVD. Click “Re-author” and you will see that the left pane is now empty. You want to drag over the main title (the main movie, as opposed to the extra features) from the right. It will be listed under the “Main Movie” section, like this:

DVD Shrink step 1

In this case, there is also a “Title 2″ under “Main Movie,” which could be a set of alternate angles or something. Ignore it; we only need the original version. Click the “Compression Settings” tab and you will see a list of languages for both the audio and subtitles. DVD Shrink is very nice about telling you what language each audio file represents. Uncheck all of the things we don’t need, like this:

DVD Shrink step 2

Make sure the top option is set to “No Compression,” as we want to keep the video at the highest quality possible. Click “Backup!” and a window will pop up. You shouldn’t need to change much, but tell it to save it to a folder and where to save that folder, like so:

DVD Shrink step 3

Your settings should be all set from earlier and most of the other settings can’t be changed now anyway (most of the settings available here have to do with compression and we aren’t compressing). Hit ok and wait for it to finish (it could take a while). I recommend that you not do anything else on your computer while DVD Shrink is doing its thing. I have had problems with videos skipping when I try to play them later if I try to do much else while DVD Shrink is working.

If you aren’t using Windows, you can join us again. The next steps apply to everyone. Open up HandBrake. If you’re on a Mac, it will immediately prompt you to choose your video source, so select your DVD and hit ok. It’ll take a couple minutes to analyze the DVD, much like DVD Shrink did, before you can select options. On Windows, click “Source,” then “DVD/VIDEO_TS folder.” Find the folder you just created with DVD Shrink and hit ok. We’re going to need to change a bunch of settings. Start by selecting the PS3 preset on the right. The presets menu may be hidden if you are on a Mac; if it is, click the button to show it and select the PS3 preset. Under “Destination,” click “Browse” and navigate to where you want the final video file to be stored. Enter a name for it and hit ok. Now, under “Output Settings,” change the format to “MKV file.” As I understand it, the MVK format has the best support for AC3 audio, which is what we will be using. Under the “Video” tab, you may wish to enable “2-pass encoding,” which should–theoretically, at least–give you better quality video, but it takes longer and you may not notice any difference anyway. I have it enabled, but I haven’t actually tried leaving it disabled, so I don’t have much in the way of comparisons for you. The most important setting is under the “Audio & Subtitles” tab. On Windows, change the “Audio Codec” option to “AC3.” This leaves the original audio intact, preserving the surround sound that came on the DVD. Technically, you could get surround with a different setting, but Dolby Pro Logic II isn’t as good as having discreet channels like you do with Dolby Digital. On Mac, you have to enable AC3 passthru by selecting “AVC/H.264 Video/AC-3 Audio” from the codecs drop-down menu, next to the “MKV” option we selected earlier. Now you can go back to the “Audio & Subtitles” tab and make sure that “Track 1″ shows “English (AC3) (5.1 ch)” and that “Track 1 Mix” shows “AC3 Passthru.” Here are pictures of what your final settings should look like (Windows first, then Mac):

HandBrake WindowsHandBrake Windows audio

HandBrake Mac

Now just click “Start” at the top and wait for it to finish! On Windows, a command line window will pop up showing you how far along the encoding is; on Mac, you’ll just see a progress bar at the bottom of the HandBrake window. The encoding process can take a while, so you probably don’t want to sit around waiting.

That’s all there is to it! You should now be able to access the movie files you created from your PS3. In part 3, I’ll show you how to put all your useless HD DVDs on your computer.

[Continued in part 3]


Aug 17 2009

a comprehensive guide to pc/ps3 media streaming, part 1

There is a lot of information out there about how to stream media from a computer to a PS3 or Xbox 360, but most of it is scattered across several web sites and doesn’t cover all the steps. Even when I found the right information, a lot of it was geared toward more experienced users, leaving me to do some experimenting until I got things right.  This guide aims to collect all the information a put it in one location with steps that are as newbie friendly as possible. With my guide, you will learn how to:

  • Rip DVDs to your computer
  • Rip HD DVDs  and Blu-rays to your computer
  • Encode videos to a streaming-friendly format
  • Stream video from your computer to your Playstation 3

Before we begin, let me say that I do not condone illegal copying of movies. This guide is intended for use only with movies that you legally own.

Why would you want to bother setting up streaming? That’s a good question. It takes a long time to rip all your movies to your computer, especially HD movies. However, there are definitely some advantages. If you have a lot of movies, they take up a lot of space in your entertainment center. If you put them all on your computer, you can put them all in a box and put them out of the way. On top of that, you will have easy access to your entire library without having to leave your couch to put in a disc.

Why bother streaming when the PS3’s internal hard drive is so easy to upgrade? Well, unless you have an extra 2.5″ hard drive sitting around, it costs money to upgrade the PS3’s hard drive. Chances are, you already have a big hard drive in your computer, so streaming doesn’t cost you anything. Also, the PS3 is kinda picky about how videos are encoded, but those limitations can be overcome by streaming, which automatically transcodes videos so that they are compatible. It is much easier to set up videos with surround sound for streaming instead of storing them on the PS3’s internal disk.

Why not use the Xbox 360? Personal preference. I’m not a fanboy, but I already use the PS3 for movies, so it just makes sense to use it for movie streaming, too. It also supports a larger variety of formats, though I could be mistaken about that.

Now that all the questions are out of the way, let’s get started. I will be using a PC with Windows 7 for this guide, but most of the steps are identical on a Mac since the software I use is compatible with both. I will try to point out the differences as they come up. The last part of the guide, the part about ripping HD movies, will not work with a Mac. The software used for that is all PC-only.

The first thing you are going to want to do is download PS3 Media Server. This utility works on Windows, Mac, and Linux, and it is very easy to set up and use. It’s supposed to work as a Windows service as well, but that option doesn’t seem to work very well, so I don’t bother with it. It’s easy enough to just run it when you need it or to set it to run when you log in. One thing to note is that if you rip movies that start with “the,” such as “The Matrix,” you might want to name them like this–”Matrix, The”–to keep them sorted alphabetically. After you’ve installed it, you’ll want to play with the settings a bit. Here’s how I have my settings. Under “Navigation/Share Settings:”

Navigation/Share Settings

The most important things to set on this page are your shared folders at the bottom. Make sure to add whatever directories you want to share with the PS3. I have it set to share music, but Windows does a good enough job of that by default, so I will probably remove that directory. I don’t know if it’s really necessary to use MPlayer for thumbnails, but I changed it to that when I changed the other thumbnail settings and it seemed to work better, so I left it. I find that 120 seconds (2 minutes) is a good number because it is far enough into most movies that you’ll actually get a thumbnail that you can recognize as belonging to the movie. I also like to have the extensions and engine names hidden so that I don’t have long titles (like “The Matrix.mkv [MEncoder]“) showing up on the PS3. I find it is easier to find things when I only have to see the names.

Next, you’ll want to check the transcoding settings. I don’t think I changed much under that tab, but just in case, here are the settings that I use. Under “Common transcode settings:”

Common transcode settings

I like audio, so I made sure it was set up for maximum quality and full 5.1 channels. If you choose to do the copy stream option later when we are ripping HD DVDs, you’ll want to uncheck “Keep DTS audio in stream” unless you have a receiver that can decode 5.1 Linear PCM (which requires an HDMI input). Update: The reason the receiver needs to be able to decode Linear PCM instead of, say, the actual TrueHD or Master Audio stream is that the PS3 doesn’t fully support those codecs and has to decode them internally, so it sends them to your receiver as 5.1 Linear PCM. However, the new PS3 slim may support TrueHD and Master Audio streaming (though your receiver will still need to support those). The only other settings I might have changed are under the “MEncoder” settings:

MEncoder Settings

I checked the “Enhanced mutlicore support” setting (since I have a dual-core processor), though if you hold your mouse over the option, you will notice that it may not work perfectly all the time. I haven’t had any problems with it so far, so I’m leaving it checked for now.

And that’s it! Just hit “Save” and close the window. Closing the window leaves the program running in the background (accessible from the system tray), but hitting “Quit” will actually quit the program, so you won’t be able to take advantage of streaming. If you turn on your PS3, you should see a “PS3 Media Server [your PC name]” under any of the media sections (“Video,” “Music,” and “Photo”). If you don’t, make sure that UPnP is enabled in your router’s control panel. The process for enabling that varies from router to router, but on my Netgear, it is under the “UPnP” category. You may also need to enable network sharing on your computer, as detailed here. On Windows 7, the process is mostly similar. Go to the Network and Sharing Center, as detailed in the link, click “Choose homegroup and sharing options” and check the option for “Stream my pictures, music…[etc]” under “Share media with devices.” If you still can’t get it to show up on the PS3… then I have no idea what’s wrong.

In the next installment I will show you how to rip standard DVDs to your computer and encode them so that you can stream them. Don’t worry, it’s a lot easier than it sounds.

[Continued in part 2] [Skip to part 3]