Converting MP3 Into iPod M4B Audiobook Format

Jan
08
2008

Back a couple of weeks before Christmas, an unfortunate series of events resulted in my 4GB iPod nano going through the washing machine. And, as is the case with many such incidents, it rendered the device entirely non-functional.

I bit the bullet and picked up a replacement because it's fairly critical to my mental well-being. I need to be able to throw on a bit of music or a podcast when I'm driving or need to drown out the outside world. So, I ordered a new 4GB nano video.

Then, a couple of days after getting that nano and using it, the consulting company that I'm subcontracting through gave all of the consultants on my project a 30GB Zune.

That, of course, caused a quick re-org of my portable media strategy. I ended up making the nano a purely podcast and audiobook device and moved all of my music (and hopefully some video when I get it cooperating) to the Zune.

Unfortunately, revisiting nearly any process in one's life can quickly shine a light on previously ignored problems and make you re-question your solution. Such was the case with my podcasting listening. When I switched over to the nano, I missed the ability to listen at faster-than-normal speeds for spoken word podcasts. However, the other benefits outweighed that downside, so I moved on.

However, last night, I wondered if I couldn't just convert some of those podcasts into iPod audiobooks (the ones with .m4b as the extension). Several of the podcasts already distribute in that format and you get things like bookmarking of where you were in the audio as well as the ability to speed things up.

I'll leave it as an exercise for the reader to guess what I think about a device that allows only the speeding up of a specific class of audio files to the exclusion of other classes of audio files.

Regardless, I checked if the Swiss Army knife of audio/video: ffmpeg would be able to handle it and was happy to see it would. So, I wrote a really simple C# console app to convert these .mp3 files into .m4b files. The workflow is still a bit lacking as it doesn't easily tie in to the iPod/iTunes functionality of putting "the 1 latest unplayed" podcast from each feed on the device, but I can quit hoping that the people speaking would just hurry the hell up.

There were a couple of oddities that needed to be coded around. Most noteable is the proper quoting of file paths (which still might not work in all cases) and the fact that you need to actually convert from MP3 to M4A and then rename that M4A to M4B in order to be done.

At any rate, the code is below the fold if you would like to mess with it yourself. You call it by running

MP3toMB.exe input.mp3 128

It also works if you just drag an MP3 onto the exe by assuming a 96kbps bitrate. Obviously, this is coded for Windows, but the same principle could easily be accomplished on Mac with Applescript or Linux with shell scripting or just batch files on Windows given a commandline copy of ffmpeg.

I've also got a Windows app that combines lots of MP3's into a single audiobook file, but I wanted something that I could use to automate and run on a more nightly basis to convert stuff, which this gives me.
Read the rest of this entry »

Building a Single Site Browser/RSS Reader with Adobe AIR

Nov
06
2007

Lots of the web applications I build or work on are replacements for desktop (often terminal-based). A few years ago, one of my clients asked if it would be possible to wrap their suite of intranet applications in something other than the standard browser.

They wanted a regular Windows menu with links to the individual pieces, like: Time Entry, Address Book, Order Queue, etc.  Many of those apps were written at different times and that approach gave them an integrated application that had its own place in the Windows menu. For them, we built a C# application that wrapped Internet Explorer to accomplish it and they were pretty happy.

I re-used that wrapper several times, including as a way to give clients a way to test sites that were in progress without having to deliver URL's that were likely to change as well as a custom sidebar to help them go through the site.

Fast forward to more recent days and you'll find me frustrated with how long it was taking Firefox to launch a new tab or switch between them. Shortly after killing the tab containing Google Reader everything became snappy again. The next time Firefox was sluggish, I checked the memory during the problem and killed Google Reader again with the same results.

That's when I flashed back to my browser wrapper as well as several articles I'd bookmarked over the last year or so regarding "single site browsers". Since my RSS reading is usually just a background activity, but is nearly always open, I don't really like taking a performance hit during things like web testing as a result of a background activity.

While I could have resurrected the old application to make a Google Reader-specific app, I have no idea where the code is at this point. I thought this might be a perfect task for trying out Adobe AIR. I'd installed the tools and tried a basic test run back in August. I figured this could also serve as an example of how to build a quick and easy single site browser that runs on Windows and Mac (at this point, with Linux in the works).

Read the rest of this entry »

DLL's In The Mirror

Oct
17
2007

A while back, I mentioned how .NET Reflector can save your hide if you, say, compile a .NET DLL and then accidentally lose the associated source code and need to retrieve that new method you added. Then, today, I solved another messy problem by using Reflector and I thought the solution might be of use to others as well.

Here's the basic scenario where this problem exists. I had a DLL from production that I needed to modify. I went to the SVN repository to get the source, built it and tried running the application locally, only to run into all kinds of problems, even without making any changes.

I swapped out the production DLL and things worked OK (or at least *more* OK than the one I was building). Theoretically, the latest version of the SVN trunk should have been what was used to build the DLL that I grabbed from production.
Read the rest of this entry »

Taking the Zend Framework for a Spin

Oct
03
2007

Last night, I found myself with a bit of free time and mental energy for the first time in quite a few weeks. I headed over to my backlog of "interesting crap" for something I'd marked for later review and took notice of a real-world project using the Zend Framework.

A couple of months ago, I dipped my toe into the Zend Framework for some specific tasks, but hadn't really had time since to look at it in a more general way.

Given that the Zend Framework differs from many of the others out there in being more of a set of libraries that are designed to work together and less of the magic "do it for me" stuff that, while it feels good at first, always tends to make me uneasy.

The linked article about building fav.or.it with the framework does a good job of showing the breadth of components. I was mostly interested in some of the bits that I often put off too long in building applications: logging, exception handling and caching.

That's the stuff that lets you write your own code, your own way, but helps you do it correctly. I wrote a quick test app to try out those features: a basic podcatcher for podcasts.

I used the Zend HTTP Client (instead of CURL or wget) to fetch files, with proper exception handling and logging of the activity. I also used the RSS bits for obvious reasons and included the Cache to keep from hammering the remote sites' RSS every time the app loaded data.

Other than a few early glitches with include paths (why is it that pointers to libraries are a pain in the butt in every mainstream language?) it came together fairly easily.

Of the pieces I was trying out, the Cache is the one that I dug the most. I'm a HUGE proponent of caching stuff whenever you can. There's no reason that data that changes once every six months is fetched on each and every page request.

The Zend Cache module lets you not only cache normal "files", but, by including " 'automatic_serialization' => true" in your options for the cache, you can serialize pretty much any object/variable you want. You pretty much only need to provide a unique name for later retrieval and you have handy caching of whatever you need.

Since a lot of the stuff I write doesn't fit neatly into the CRUD (Create Read Update Delete) mold that many of the frameworks like Rails, CakePHP and company tend to impose, having a framework that's a little more laid back and free about how to do things is a handy thing to have in your toolbox.

Tracking Accomplishments with PHP, Google Calendar and Zend Framework

Jul
22
2007

A couple of months ago, I pointed out the utility of keeping track of the things you accomplish on a daily basis. I've been keeping mine in just a notebook. However, making something that can be used to extract reporting information for the eventual inclusion in resume's, status reports, etc.

It struck me that keeping track of that stuff on Google Calendar would be a reasonably good way to centralize it and make it accessibly from any of the computers that I work on (Windows, Linux, Mac, etc.) without depending on software. So, I took a quick look at the PHP API for using GCal's information.

It requires the Zend Framework, so this was an opportunity to install that as well. The instructions on installing the Zend Framework were a bit vague. What it boils down to is this. The "Zend" directory inside the "library" needs to be on your "include_path" for PHP. On my Ubuntu development boxes, that means putting that Zend directory as "/usr/share/php/Zend" and the existing configuration picked it up.

I then grabbed the Calendar.php sample file. There's lots of stuff in there I'll (and you'll) want to change in it for ongoing use (like lots of the defaults). However, it works well to get up and running. I stripped all of the stuff at the end of the file (the stuff that wasn't inside a function), thus turning the Calendar.php file into more of a library to be included.

After including that file in my "createaccomplishment.php", I set up a really basic form for creating an entry.
Read the rest of this entry »

« Older Entries  

J Wynia

For better or worse, I'm the guy who runs things here. I'm a web consultant, software developer, writer and geek from Minneapolis, MN. This site is a fairly wide cross-section of the things I'm interested in and enjoy writing about.

Oh, and if you happen to be looking for hosting for your Subversion repositories or just web hosting in general, take a look at Dreamhost. It's what I use for Subversion and your signup helps me out.

Latest Microposts

Follow Microposts on Twitter | Subscribe to Microposts

My Attendance At the Gym

Feeds and Links


www.flickr.com
This is a Flickr badge showing public photos from J Wynia. Make your own badge here.

Search


Pages

Archives

Computers Blog Directory
© 2003-2008 J Wynia. All original content is licensed under the terms of the Creative Commons Attribution license unless otherwise noted. Content from other sources is licensed under its original terms.