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.
- Demux video and audio
- Convert video stream to mpeg1video
- Convert audio stream to mpeg2
- Create header according to the converted video and audio stream
- 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: nintendo ds, moonshell, mencoder, dpg, batchdpg, dpgenc
- sugree's blog
- 41488 reads
porn
Script or tool to convert avi to dpg in linux
Once upon a time I was
DPG in UBUNTU
Post new comment