DVD Backup Software

Macworld published a great comparison of DVD copying software for the Mac, detailing the two major competitors, Roxio’s Popcorn ($50) and DVD2OneX ($65). While I find that both programs work well, I disagree slightly with their buying advice.

It should be noted here as well, that neither of these programs can directly backup commercial DVDs because of the CSS encryption and Macrovision encoding used to protect the discs.

Popcorn has it’s ease-of-use advantages, particularly in that it has fewer steps than DVX2OneX. One of the drawbacks of this, as with just about anything that makes complex processes easier, is that you sacrifice some control. And when it comes to encoding video, I like to have total control. When you compress and burn a full DVD with Popcorn, you don’t have the option of disabling certain audio tracks with other languages. Normally this wouldn’t be a problem, but since you are limited to about 4.4 GB of usable space on a DVD±R, any space used for extras like foreign audio take valuable (and sometimes very noticeable) quality away from the video. However, both Popcorn and DVD2OneX have the option of removing language tracks if you choose to compress the main movie title only.

Before writing this, I was under the impression that there was no way to preview a movie compressed with Popcorn before it was burned to disc. After tinkering with Popcorn a little, I discovered that once you’ve entered all your settings, you can choose File -> Save as Disc Image, and your video will be compressed and written to a .toast image. You can then open that image and preview it with DVD Player as if you inserted the finished disc. This is one “feature” I thought previously available only with DVD2OneX, as it produces just a VIDEO_TS folder that can also be played with DVD Player by choosing File -> Open VIDEO_TS Folder.

DVD2OneX offers the ability to define the size of your output, which I sometimes need to do because the usable space on DVD±R discs varies just a little. You could also compress a movie to fit on a mini DVD disc if you so desired. DVD2OneX has several different encoding methods, although I don’t notice a whole lot of difference between them. With mkisofs installed, you can also create a disc image, but I find that this time is better spent previewing and burning the VIDEO_TS folder with DVD Player and Toast, respectively.

The number one advantage of DVD2OneX, is speed. As the MacWorld article noted, DVD2OneX is significantly faster than Popcorn — 19 minutes faster for the title they encoded. Since both applications need to compress data and burn it, you should be able to spend those extra minutes burning your compressed movie.

Popcorn is still at version 1.0, and will likely jump up in speed with future releases. Until then, I prefer DVD2OneX.

DVD Backup Software

Return of the Mac

Just days after I posted my little blurb about Hackers and Painters, Paul Graham published a great article on the return of the Mac.

“If you want to attract hackers to write software that will sell your hardware, you have to make it something that they themselves use. It’s not enough to make it ‘open.’ It has to be open and good.”

This is where the Mac is headed.

Return of the Mac

Apple ADB Mouse Conversion

Here’s a little hack I did not long ago during the course of a weekend. I opened up an old, blocky Apple ADB mouse and swapped the internals with that of a newer USB mouse.

Unlike today’s injection molded, glued together, snap shut technologies, the Apple ADB mouse was no problem to open, with just had 4 standard Phillips screws on the corners of the underside. With the mouse open, two small circuits are visible. The circuit near the front of the mouse is where the pushbutton for clicking resides, and the other board tracks mouse ball movement and the ADB interface. Interestingly enough, the chip inside the Apple ADB mouse was made by Logitech, whose 2-button wheel mice I swear by today. I separated the two boards so that I could use the same pushbutton on the “new” mouse guts — the Apple ADB mouse has a distinct click, and I wanted to maintain that classic feel after the conversion.

Opening the USB mouse (an IBM one I bought a while back but didn’t like the feel of) was just as easy. After locating the left-click pushbutton and tracing the wires to the main board, I marked the points with a permanent marker and cut the ribbon cables, separating the USB mouse’s two boards as well.

The next step was to combine the old Apple pushbutton with the main board of the USB mouse. Since I marked the two points where the USB mouse was expecting a left-click switch to be attached, I soldered wires from the Apple switch to those points. In hindsight, I should have checked and made sure that both switches (old and new) were normally open or normally closed, but I got lucky — they matched.

The hardest step in this whole hack was cutting the right size and depth hole in the bottom of the Apple mouse plastic so that the optics of the USB mouse could fit and work properly. After much dremeling and hot glue, I was able to get the USB main board in a place that was stable and could “see” the desk. After testing the optics and mouse pushbutton, it was time to close the little guy up. I dug up a USB cable left over from another project that actually matched the Apple mouse color, attached it, and routed it through the hole used by the old ADB cable. A little more hot glue to keep everything in place, and I closed it up and put the original screws back. It’s not very pretty on the bottom, but it works. Not bad for a two or three hour weekend hack, I think.

Apple ADB Mouse Conversion


When it comes to encoding video on the Mac, you have lots of options. You can spend as much or as little as you want. Since we don’t all have hundreds of dollars to spend on video applications, there is a nice selection of cheap video tools out there. One of the ones I’ve recently started using is D-Vision. Not only can D-Vision encode ripped DVDs to various multimedia formats, it also includes a handful of useful tools for segmenting/joining/repairing AVI files, converting audio, joining VOB files (commonly found on DVDs), and extracting DVD subtitles. I’ve found D-Vision to be an easy one-step application for backing up my DVDs onto my Xbox, making for quick access while maintaining high quality audio and video.


Sharing Media to XBMC

Following two posts on MacOSXHints.com, I felt I should mention the easiest way I’ve found to get content over your network to Xbox Media Center.

For those who don’t know what it is, Xbox Media Center (XBMC for short) is an Xbox program that plays just about any kind of multimedia you can throw at it. It’s like the turbo-charged VLC for your TV. Not only does it play standard MPEG-1 (.mpg) video and audio files, is plays MPEG-4, DivX, XviD, WMV, Audio CD, AAC, MP3, AC3, DTS, M4A, JPG, PNG…the whole alphabet soup of media types. The best part is that it all happens behind the scenes. You don’t have to worry about telling it specific information about what kind of file you’re dealing with. It just works. And here’s where this tip comes in – XBMC can also use the Xbox’s built-in networking to access computers on your network via Samba sharing (and various other streaming protocols, too, like XNS) and iTunes sharing (DAAP).

So how do you share media from your computer to your Xbox? You can follow one of the two tips above, but the way you’re about to learn is much quicker, and the program you use to accomplish it is quite handy. A great little tool called SharePoints lets you create Windows and Mac network shares without making a new user for them, as the network sharing is built into the OS, but there is no Apple-provided solution for managing them. With SharePoints open (either the preference pane or the application), fill in Share Name with a short name like “Movies”, set the Owner permissions to “r” for read-only (the Xbox has no reason to write to that directory), and choose a Directory for the new share. The Directory that you set is where the share actually pulls files from on your computer, so you would want to pick something that matches what your Share Name indicates – Movies for movies, Photos for pictures, etc. Then, under the “Windows (SMB) Sharing” popup menu, choose “Shared (+)”, and click “Create New Share.” Now that you have a folder available to your Xbox from your computer, it’s time to tell your Xbox how to get to it.

If you’re previously set up Xbox Media Center, this step should be easy. Inside the XboxMediaCenter.xml UserData/sources.xml configuration file, add a new block of code the line inside the appropriate section (photos, movies, or music). 8/1/2006 Update: See this post regarding changes to the way XBMC handles network shares.

XboxMediaCenter.xml Config Example

Give the share a short name within the name tags, which will be shown onscreen. Then replace username, password, ip, and share above with your Mac user’s username and password, your Mac’s IP address, and the Share Name you created in SharePoints. Save the modified file to your Xbox via FTP, and reboot your Xbox. When XBMC starts, you should be able to browse files on your Mac using your Xbox, and play them right over your network.

Sharing Media to XBMC

Hackers and Painters

Hackers & Painters: Big Ideas from the Computer Age is a compilation of brilliant essays by author and Viaweb creator Paul Graham. Covering everything from startups, programming, open source software, web-based software, and more, Graham details the ideas behind technological innovation and the people that make them happen. Hackers and Painters is written in a very down to earth style and clear manner than anyone, not just computer people, can understand.

If you’re at all interested, read the essay “Hackers and Painters” at Paul Graham’s website, and you’ll be hooked. That single essay is what convinced me to buy the book. If you’re still unconvinced, another of his essays, “Great Hackers”, is available in text form and in audio form at IT Conversations.

Hackers and Painters is a fantastic book that covers a wide spectrum of topics in technology, but links them all together seamlessly. It’s one the best I’ve read in a long while and has significantly impacted my views of programming, business, and design. Here are some choice quotes from the book:

“What do hackers want? Like all craftsmen, hackers like good tools. In fact, that’s an understatement. Good hackers find it unbearable to use bad tools. They’ll simply refuse to work on projects with the wrong infrastructure.”

“What worries [Bill Gates] about Google is not the power of their brand, but the fact that they have better hackers.”

“It’s a mistake to try to baby the user with long-winded expressions meant to resemble English. Cobol is notorious for this flaw. A hacker would consider being asked to write ‘add x to y giving z’ instead of ‘z=x+y’ as something between an insult to his intelligence and a sin against God.”

“It is by poking about inside current technology that hackers get ideas for the next generation.”

“[I]f function is hard enough, form is forced to follow it, because there is no effort to spare for error.”

“In the desktop software business, doing a release is a huge trauma, in which the whole company sweats and strains to push out a single, giant piece of code. Obvious comparisons suggest themselves, both to the process and the resulting product.”

“I think [programming] language designers would do better to consider their target user to be a genius who will need to do things they never anticipated, rather than a bumbler who needs to be protected from himself. The bumbler will shoot himself in the foot anyway.”

Hackers and Painters

DVD Studio Pro Markers

Recently, I needed an easy way to get chapter markers into DVD Studio Pro without re-encoding my video with embedded markers, and I ran across an interesting tidbit of information. DVD Studio Pro has an “Import Marker List” command, but I wasn’t sure what kind of file it was expecting…another multimedia file with embedded markers? A CSV file? A proprietary format marker list? After much searching, I found this site which shows you exactly how to import a plain old tab-delimited file into your DVD Studio Pro track. Slick.

Update: Saved PDF version just in case the site goes away.

DVD Studio Pro Markers

My Recent Tunes Code

Here is the code that I use to power my Recent Tunes list seen at right. It’s a little messy, but at least commented so you have some clue what each part is doing. The cover_update.php script is what does most of the work. You shouldn’t have to change anything in the amazon folder – that’s all there to talk to the Amazon.com API, which you will need access to. I also recommend Recent Tunes for updating your tracks from iTunes. Note that I use the current tune, not the list of recent tunes, as it makes managing the MySQL database easier and lessens the load put on Amazon’s API (which I imagine has a ~1000 query per day limit). If you have questions about using it, post a comment so that others can benefit from the conversation as well.

My Recent Tunes Code

BitTorrent Info Scraping

After using TorrentSpy on Windows for a while, I wanted a Mac version to do some of the same functions. TorrentSpy’s main feature is that it allows you to see the current number of users on a .torrent file in real-time. I was curious how it worked, so with a little traffic capturing with Ethereal, I was able to see that TorrentSpy was contacting the tracker listed inside the .torrent file at a specific address that was similar to the actual web address of the tracker. This special address, I figured, must hand real-time data back to TorrentSpy. After a minute or two of wandering around on Google (have I mentioned yet how much I love Google?), I came up with the protocol to be followed for transforming torrent announce URLs into “scrape” URLs on a Yahoo groups post. With this information, I started doing some coding in PHP to see what I could come up with.

The next problem presented was that of decoding a .torrent file so the information could be pulled out of it. A great open source project called TorrentParse came to the rescue here, as it provides PHP code for encoding and decoding BitTorrent metainfo files. As I would find out a short while later, these libraries are also pivotal in decoding the real-time information retrieved from the tracker server.

The code I wrote has only a small few parts. The first handles the uploading of a torrent file and checks to make sure it is of the required file type. The next partdecodes the given .torrent file with TorrentParse and extracts the announce URL (the address that the BitTorrent client notifies to show the new seed on the tracker). I wrote a small function called makescrape() that transforms the announce URL into a scrape URL per Bram’s post, linked to above. Upon requesting this new scrape URL, you are returned a BitTorrent-encoded chunk of data containing the real-time information about the torrent. Run that through TorrentParse’s decode function, and pull out the data you want to display.

I would post a demo of the code, but I’m afraid it would be automated and/or abused. However you’re free to download the code and try it out. It still needs some work, especially in handling and managing uploads, but it all works well enough to display basic real-time torrent information. It’s not exactly the Mac version I had in mind from the start, but it could be adapted to a Mac OS X widget with a little work. Get the code here. Enjoy.

BitTorrent Info Scraping

My Recent Tunes

A number of people have asked me how my Recent Tunes list works. It’s a little complicated, but here’s how.

First, you need to get track info from iTunes to your website in a fairly timely basis to keep the information accurate. Freshly Squeezed Software, makers of the popular Mac newsreader PulpFiction, has a nice freeware application called Recent Tunes which does exactly that. It can upload a list of recent tracks as well as the current track, all formatted according to a template you design. I don’t use the recent tracks list, and you’ll see why very shortly.

With the current track info on the website, it’s time to actually do something with that data. You could stop here and simply include the HTML file in your design with a small PHP command, and the current tune info would show up, but with no artwork or links. The next step is to create a timed or invoke-able script that will open up that current track HTML file, split apart the various chunks of information (artist, album, title, etc.), and go from there. Now, I should mention at this point that the current track HTML file that Recent Tunes uploads does not have to be a fully formatted HTML file, by which I mean all the standard tags can be left out — it will make your life easier while writing the script that splits up the data.

In Recent Tunes, I set my template to show the album, artist, title, and rating, each separated with a simple few asterisks *****. This string of asterisks is what your code will look for when splitting up song info. Do note that if one of your current tracks has five asterisks in one of those four pieces of information, your script will break unless that possibility is accounted for. PHP has a wonderful and amusing function called explode(), which separates data however many times is necessary, given a string to split at. In this example, you would do list($artist, $album, $title, $rating) = explode(“*****”,$trackinfo); After that, you could do some error checking to make sure none of those fields are empty. If one or more is empty, it might not be worth your while to even bother continuing with the script, so have it exit cleanly now.

Now that you have the song info from your computer, to your website, read in with PHP, and split apart into usable bits, you are ready to start looking up artwork, links, and more. Amazon.com has a very nice web service interface that provides just about every bit of info they have on a product, including artwork. This is where the album images will come from. The only problem presented, aside from the task of writing the code that will be communicating with Amazon’s infrastructure, is that their artwork isn’t a consistent size. They offer “small”, “medium”, and “large”, but the sizes in each category vary slightly. If we’re going to go to the trouble of doing all this, it should look good. The obvious answer is to make the album artwork the size you want.

Since the “small” artwork is already low in detail, it would look even worse if resized — any manipulations you make will lessen the quality each time. The best way to approach this would be to use the biggest available image and scale it to the size you want in one shot. Enter GD, an open source image library capable of handling common image formats. PHP must be compiled to use GD, but it’s quite common. I’ve found that most web hosts provide it. It is not built into PHP that comes with Mac OS X, however it is available as an installer package from Marc Liyanage‘s site. I always use his releases for local development and never have problems with them.

Once you retrieve the artwork from Amazon by matching artists and album titles, use GD to scale the image to 50×50 pixels and save it (just write it to a file with a unique name, say, an MD5 hash of the song info with “.jpg” tacked on). Amazon’s API also provides the product URL too, so hang onto that as well. The iTunes Music Store addresses are relatively easy to create. Using information I dug up on NSLog();, I was able to create a small function that returns an iTunes link. Once you’ve collected all this information and media, you’re ready to save it all to a database. MySQL runs WordPress, so it was only fitting that I use the same database only a different table. Do a MySQL “INSERT” command and log the song title, artist, album, rating, time (if you want), cover artwork path, Amazon product URL, and iTunes Music Store URL.

A good chunk of code to add here is one that will read the ID of the tenth newest row, and remove all rows and images that were before it. I found a good way to do it was read out the rows first, unlink the images using the paths set in the image path column, then MySQL “DELETE” that row, and continue until there are no more rows older than that tenth entry. In this way, you will keep your list of songs down and not gradually run yourself out of disk space by keeping ancient artwork files around.

Finally, when a visitor comes by, read out the last 5 or so rows (no more than your limit set in the previous paragraph) from the table and format them using some CSS. And last but not least — error checking everywhere. If artwork is not found or broken, or if the scaled image file doesn’t exist, or GD chokes on a corrupted Amazon image, simply don’t add that tune to the database and skip to the next one. It’s just a song.

I would release the code I wrote now, but it’s a little sloppy. I hacked it together in two days time, so I can’t guarantee anything! Let me know if you see any problems. If it continues to work well, I’ll surely hand it out.

Known Bugs: Albums with single quotes in any of the info cause the iTunes link to break. They are stored using the HTML entities ON for quotes, yet that seems to stop iTunes from understanding them. Not yet sure why that is.

My Recent Tunes