Itâ€™s been a while, a few things I need to update, but Iâ€™m going to do this one first because it will probably interest the most random people out there. Recently I got myself a new Zune so I could watch my DVRâ€™d BSG episodes while on a treadmill trying to get fit. I love the device – it has a nice big screen (about twice the size of a comparable iPod), 80G of storage and a pretty slick interface. Sadly, the PC software leaves a little to be desired though.
In any case, the Zune can only play WMV and simple MP4 video. The PC software automatically converts a bunch of different file formats for you into something the Zune can play (ie WMV) but wouldnâ€™t understand AVI files, particularly ones that use the XVid codec.
I figured it shouldnâ€™t be too hard to find something that would do the conversion for me and a quick search of Google told me there were quite a few products there that promised to make everything easy and magically do the conversion for me. They mostly cost about $30, but if I was going to spend money I really wanted something that would fit all my personal criteria:
- Zune native format â€“ no second conversion by the Zune application after Iâ€™ve done my own conversions.
- Batch encoding â€“ I want to point it at a whole bunch of files and just let it go.
- Low priority â€“ I want to be able to run the conversion in the background and not have to fight with it when I want CPU power for something else.
- Multithreaded â€“ I have a dual core CPU. Why not use it?
- MP4 format with H.264 encoding â€“ why not use the best format the Zune supports?
- Keep the original frame rate â€“ thereâ€™s no point converting 25fps to 30fps or vice versa.
- No black bars â€“ if the original was 1.7:1 then just make another 1.7:1 video instead of putting black bars. The Zune can handle it.
- Reduce to 320x? â€“ may as well reduce the resolution to the Zuneâ€™s native display.
- Able to cope with minor damage to the input files (some of my DVRâ€™d files arenâ€™t that good)
Honestly, I didnâ€™t think any of those were particularly much to ask from a conversion program. The later iPods support a very similar set of features to the Zune so I expected the conversion programs would easily do what I wanted. Sadly, it wasnâ€™t to be. Hereâ€™s a list of the apps I tried and where I found their failings were:
Not too bad a product, but wouldnâ€™t let me set an automatic frame rate (defaulted to NTSC), and insisted on putting black bars at the top and bottom of letterboxes. Failed to handle any input file errors, and was no ability to set the priority to default to low.
Seemed pretty good, but again no automatic frame rate detection. Setting the encoder to H.264 produced a file that wasnâ€™t playable on the Zune and had to be converted a second time. Didnâ€™t cope with any input file errors and there was no ability to set the priority to low.
This was exactly the same program as the Xilisoft one. Go figure.
Seemed the best of the bunch â€“ handled input file errors with no problem but didnâ€™t seem to want to remember the previous encoder settings so you had to go back and specify H.264 every time. There was no automatic frame rate detection either, and the priority (again) couldnâ€™t be set to low.
I had great hopes for this one – it automatically kept the frame rate for me and promised H.264 encoding. The wizard interface was a little clunky but livable. Videos converted played fine in the PC player and transferred without conversion to the Zune but just gave an error when I tried to play them.
I actually own Nero 8, so I gave Nero Recode a try. It seemed to do very well when using the iPod profile but when I finally got to play it on the device, it had trimmed the video to the left side rather than letterboxing it. The trim controls were strangely complex so I just gave up.
Promised a lot, but didnâ€™t really deliver. Figuring out how to rescale the video and keep the frame rate turned out to be close to impossible and would have left me making a new conversion profile for every different type of file. Not something I really wanted to do.
The hard-core converters were a bit of a disappointment. As I expected they all had a whole bunch of controls but none really seemed to work as well as even the basic commercial ones above. Made me kinda sad because Doom9 has previously been a great resource for ripping my DVDs to media files for playing on my PC!
So, disappointed with all of these offerings, I decided to sit down and try to use the Windows Media Encoder APIs to do the whole thing myself. After a few hours work with the SDK and Visual Studio 2005 (it crashes with 2008 – go figure), I had something actually encoding to a .wmv file, but I ended up running against the same problems I had with Windows Media Encoder â€“ you needed to build the profile up from scratch for every variation in the input file which really made it more work than I wanted to put in right then.
Finally, I was looking at the freeware H.264 encoder (x264) and noticed it was on the same site as one of my favorite open source media players (VLC). Looking more into VLC I found out that it can also transcode files, and noticed that .mp4 was one of the outputs. From there, it was all a matter of figuring out the arcane command line incantation to get it to produce an mp4 that the Zune itself was happy to play. Finally it all worked out and I ended up with the attached 4NT script: makezune.btm
Edit: I’ve been asked by a couple of people to write a version of the script file that runs in the regular XP/Vista command shell, so here it is. I even threw in a couple of comments to make life a little easier! makezune2.cmd
Edit #2: Note that this solution only works with the Zune v2.0 (4/8/80G) and not the original 30G Zunes which can only play .wmv files. To get those to work is probably going to involve some heavy tinkering with the Windows Media Encoder libraries.
Edit #3: So I put the time in to actually tinker with the Windows Media Encoder. After finding Alex Zambelli’s upgraded WMCmd.vbs (local link) script, it was a relatively simple matter of trial and error to find the parameters needed to make a file compatible with the Zune. The real problem was figuring out the scaling. Fortunately, some really ugly batch file scripting came to the rescue and the final product is in makezune3.cmd
Note: For any attached file, use right click, save link as… and then rename it to the proper name. To avoid issues with downloads of script files being prevented by Internet Explorer, I’ve actually stored everything as text files.