How to convert AVI to DPG in Linux

In fact, I don't have Nintendo DS aka NDS but my friend has one. It looks very impressive when playing game. Not only playing game, NDS is capable to play movie too. The secret weapon is Moonshell DS and its DPG tools. If I'm not wrong, you need 2 files: Moonshell DS 1.1 and Moonshell 1.1 DPG Tools. So, as I expect, I have to convert movie files into .DPG to play in NDS. I have heard about dpgenc which seemed to bundle with the DPG tools but I do want to know how it works. Actually, I would like to use my linux box at night. And I found BatchDPG which is an open source DPG conversion tool relying on Avisynth and mencoder. Eventually, I know what is DPG actually.

What is inside DPG?

DPG = header + mp2 + m1v

So conversion of AVI to DPG is as follows.

  1. Demux video and audio
  2. Convert video stream to mpeg1video
  3. Convert audio stream to mpeg2
  4. Create header according to the converted video and audio stream
  5. Concatenate header, audio and video stream

Now, the only problem here is the header. Big thanks to BatchDPG that opened headermaker.c for all of us.

magic (4 bytes):                      0x44 0x50 0x47 0x30
frames (4 bytes integer):             0xXX 0xXX 0xXX 0xXX
pad (1 byte):                         0x00
fps (1 byte):                         0xXX
pad (2 byte):                         0x00 0x00
sample rate (4 bytes integer):        0xXX 0xXX 0xXX 0xXX
channels (4 bytes integer):           0xXX 0xXX 0xXX 0xXX
audio start offset (4 bytes integer): 0xXX 0xXX 0xXX 0xXX
audio size (4 bytes integer):         0xXX 0xXX 0xXX 0xXX
video start offset (4 bytes integer): 0xXX 0xXX 0xXX 0xXX
video size (4 bytes integer):         0xXX 0xXX 0xXX 0xXX

Usually, channels is 0, audio start offset is 36 and video start offset is 36 + audio size. Header is fixed size at 36 bytes. Other parameters are as follows.

width: 256
height: 144
fps: 15
video bitrate: 256
audio bitrate: 128
sample rate: 32000
channels: 0 (stereo)

Now I know enough to convert any media files to DPG on Linux. Thanks open source.

Tags: , , , , ,

porn

porn

Script or tool to convert avi to dpg in linux

Hi, Could you tell me if you were successful in writing a script tool for converting an avi to dpg file in linux? Thanks.

Once upon a time I was

Once upon a time I was looking franticly for a converter that worked for linux. Now I use mencoder, sox, cat, hexedit, mplayer and gcalc to do it all manually. And it takes less time than an autoconverter.

DPG in UBUNTU

Heey, I have made a tutorial for DPG in Ubuntu on the Ubuntu forums. Here is the link: http://ubuntuforums.org/showthread.php?t=852999 I should work on other linux systems as well

Post new comment