30 December 2007

Converting videos for use with Moonshell (NDS)

One of the tasks that I needed to do over the holidays was to get some Nintendo DS/GBA flash carts set up for some people who are just getting started in Gameboy/DS homebrew development. Even though the primary use for this card is for homebrew, I thought it would be nice to get some audio/video playback working as well.

So I installed the multimedia player (homebrew) app Moonshell onto the DS flash carts. The latest version of Moonshell can be found in Moonlight's NDS archive. As of this post, Version 1.71+1 (August 2007) is the most recent version.

To use image and music files with Moonshell, you just copy your JPG/MP3 files (or a few other formats) over to your flash card and Moonshell will show/play them just fine.

Video, however, is a different beast as Moonshell won't dynamically convert the format or the size - it expects the video file to be GBA screen-sized and to be encoded in MPG1 video/MP2 audio. This means that you need to convert the videos into DPG format, which is a special format specific to the NDS and Moonshell. To convert videos into this format, there are a few free tools available (presented in the order in which I discovered them):
  • dpgenc.exe - This is included in the dpgtools distribution that comes with Moonshell. A basic tutorial on how to use (an older version of) this is at can be found in the MaxConsole Forums.

  • BatchDPG - This is an alternative to dpgenc created by LS5, another homebrew developer. The official site still has the old original 1.0 version (with source), but updated versions from various people are also available (like Firon's 1.2 version). Be sure to review Yee and Firon's BatchDPG Guide because there are a number of pre-requisites (AviSynth, ffdshow, .Net Framework 1.1) that you'll need to have installed for this to work.

  • SUPER by eRightSoft - "Simplified, Universal Player Encoder and Recorder" - This is a general video/audio converter that contains special support for DPG files. It can be downloaded from the SUPER main page, although to get to the actual download link, you'll have to navigate through a number of links. If you get frustrated trying to find the download, here is a direct download link. The latest build is 2007.23 (4 July 2007).
All of these applications are basically GUI wrappers around ffmpeg or ffdshow, which are standard audio/video encoding/decoding libraries. The first two applications (dpgenc, BatchDPG) are specific for Moonshell DPG files whereas the last one (SUPER) is a general purpose tool that can be used for all sorts of audio/video conversions.

I tried all of these tools and had luck only with SUPER. There are clearly people out there using dpgenc and BatchDPG successfully, but I kept encountering problems with the conversion - probably codec related, but I didn't bother tracking them down since SUPER worked "out of the box" for my tasks.

Using SUPER to create DPG files...

To create DPG video files using SUPER, select "Nintendo - DS" from the dropdown list of output containers. This will simplify the interface by removing options that are not appropriate for DPG containers.

Select "Nintendo - DS" as the Output Container

Now you can drag a video file into the window to add it to the filelist. Press the "Encode" button and SUPER will chug away and drop the newly encoded video file into your output directory.

Drag your video files into the SUPER window

One nice thing about SUPER is that, while the interface is a bit busy, there is plenty of context-sensitive help that pops up when you hover over the elements in the UI. This makes it fairly easy to get started with the program and get things working. To set the output directory, for example, just hover over the Output box and a message will pop up telling you how to set the output options.