gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS Misc > batch or command line dpg creation? INFO

#83050 - takieda - Fri May 12, 2006 11:25 am

I've been looking through all the files included with the DGPEncoder for Moonshell and I've found some interesting things so far. For one, it seems the dpgenc.exe file is just a GUI shell for the command line utilities found in the dpgencplugin folder. The utilities found in that folder are all open source freeware utilities (as far as I know, all under the GPL license), all stock found on the web. (perhaps mencoder.exe has been altered, but more on that later).

So far what I've stumbled upon is that every file in dpgencplugin is a command line utility used to decode/encode video and/or audio files. I haven't tested anything but mencoder.exe and ffmpeg.exe. Aside from mencoder.exe, it seems that all the other files are used to extract audio and create an mpeg layer 2 audio stream, which it saves as "filename.dpg.mp2"

Mencoder.exe on the other hand, it seems, is being used by the GUI to extract the video, encode it under the specifications given in the GUI shell, and creates a video file called "filename.dpgm1v"

AFAIK, dpg is a specific format used for Moonshell only. From what I can tell it looks like mencoder.exe is creating the end .dpg file, so what mencoder.exe is doing creating dpg's leads me to some interesting speculation. (though the possibility exists that the GUI shell is doing so - see below) My best guess is that mencoder.exe is modified by Moonlight (just a guess, I could be completely wrong on this). Another guess is that mencoder.exe is just creating an .avi file with the previously made audio file, and a video file using a codec specified by the GUI as mpeg1video (as far as I can tell). I'm not exactly sure what's renaming it to a .dpg file. Then the GUI shell is wrapping the .avi out of the audio and video files, but I can't confirm this, as I can't test the functionality of mencoder, based on the code that the GUI shell is creating.

Looking through the dpgenc.log and dpgenc_mencoder.log files, I was able to create this snippet of code and write it into a .bat file:

Quote:
"C:\Archives\NDS\Homebrew\DPGTools\\dpgencplugin\ffmpeg.exe" -i "C:\Archives\DTA\testing.avi" -acodec mp2 -ab 128 -ar 32000 "C:\Archives\DTA\testing.dpg.mp2"
"C:\Archives\NDS\Homebrew\DPGTools\dpgencplugin\mencoder.exe" -v - -o "C:\Archives\DTA\testing.dpgm1v" -noautosub -nosound -frames 6578 -demuxer rawvideo -rawvideo fps=24:w=256:h=144:format=bgr24:size=110592 -ovc lavc -lavcopts vcodec=mpeg1video:vbitrate=256 -ofps 24 -of rawvideo


This is, apparently, the code that is used by the dpgenc.exe to create (at least) the audio and video files. When mencoder runs, it finishes with a statement saying:

Quote:
Flushing video frames

Writing AVI index...
Fixing AVI header...


Whereas the logs created by dpgenc.exe end with something like this:

Quote:
Flushing video frames

Writing AVI index...
Fixing AVI header...

Video stream: 255.227 kbit/s (31903 B/s) size: 8039639 bytes 252.000 secs 6048 frames
uninit video: raw
WINSOCK2 uninit


So I'm left wondering what's creating the .dpg file in the end.

With everything above, I can easily create the audio stream with the code snippet. Mencoder doesn't like to work based on what I've put in there, and I've been having some difficulty discerning the options that mencoder has, as well as understanding every bit of the code listed above. The only thing I can think about the mencoder code written in the log file is that the GUI shell is keeping the file name as a variable, which it then passes to mencoder, thereby bypassing the need to write out the name of the origin file. I've tried several different ideas on how to get it to reference the original video file but to no success. Any suggestions? Anyone familiar with mencoder.exe?

Would be nice to be able to create another shell, or .batch file, that can batch process an entire folder, or give more options for audio and video encoding, etc. Would allow us to test some more settings on Moonshell itself. (dual height video being one)

Any input on this is greatly appreciated.
-Tak
_________________
Est Sularis Oth Mithas - My Honor is My Life
(\_/)
(o.o)
(> <) This is The Bunny. Copy The Bunny into your signature to help him on his way to world domination.

#83059 - JaJa - Fri May 12, 2006 1:17 pm

Hi, I did some work on the moonshell video format so that I could convert videos on Linux and Mac OS X.

It does indeed use a couple of command line tools (mencoder) to convert video and audio into a format suitable for DS.

You will find details on the header format in this thread as well as a C tool for writing the header to file, from some details you input (frame rate, audio sample, video file size, audio file size and number of video frames). There are also bash and ruby scripts for doing this in that thread.

I believe the way I convert the video is similar to how the official moonshell tools do it.

If you look at the dpgenc tools you will find mencoder.exe, sox.exe and ffmpeg.exe in the folder dpgencplugin. These are the tools that I use on linux (well, Mac OS X. I also only use Sox and Mencoder).

This leads me to believe that dpgenc.exe must be a windows GUI for these tools.

Hope my work will be of use to you.
_________________
LAWL HOOGE
My Blog