Hacking DPG header?

h0t1ce

New Member
OP
Newbie
Joined
Jun 25, 2006
Messages
3
Trophies
0
XP
27
Country
Canada
Since I'm using linux, I haven't had much luck getting DPGenc to work to convert my videos into .DPG format.

I was wondering if any linux users had a way to get their videos to .DPG?

I was also wondering if there is no way as of yet, if it would be possible to just make a simple script
to make the special DPG header? Since I've heard DPG is simply an MPEG1 video with a special header.


I would be willing to take a look at the header of a sample DPG movie, so if anyone is willing to send me
a short video in DPG format so I can take a look. I have no clue if it's possible to figure it out with a HEX editor

any help would be appreciated



thanks in advance
 

feriol

Well-Known Member
Member
Joined
Nov 23, 2005
Messages
119
Trophies
0
Website
Visit site
XP
120
Country
Gambia, The
The Moonshell source package include the dpgtools source. Well, since it's written in Delphi, it isn't simply compile-n-go, but still a lot better than reverse-engineering the file format, right? Good thing is, the whole thing is based on mplayer/mencoder, so at least -that- part should work pretty much right out of the box.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
Edit I knew I should not have waited for the files to upload.
A fine endeavour you are undertaking so I will try and help, video on linux is in rather poor shape (it is one of the main reasons I do not use linux) and your choice of programs zero for the DS as far as I am aware.

The headers of the DPG files seem to be a mystery to many people (I just took a look myself and I have no clue as to what is going on there, with regard to the standard MPEG1 video stream thing the options in dpgenc seem to confirm it), for the first few versions the batchDPG tool (an alternative tool to encode dpg's) used dpgenc for conversion and even now the headers are not quite right (they will play back DS side but conversion back to "windows safe" video does not work apparently).
batchDPG in case you were unaware: http://ls5.cydonianknight.com/ , you might also want to try getting in contact with the author.

I am about to fall asleep right now so I can only give you some help.
I have put 2 files on my website:
the original video (it is a micro machines trailer I had kicking around my computer). It is an AVI file, XVid video stream, Lame MP3 audio track.
The dpg file encoded with dpgenc so it should have the "best" header available.
Grab both here:
http://www.4shared.com/dir/560042/2bce517c/DPG_help.html
 

feriol

Well-Known Member
Member
Joined
Nov 23, 2005
Messages
119
Trophies
0
Website
Visit site
XP
120
Country
Gambia, The
The relevant bits from the dpgenc source, in case you haven't already found it:
Code:
const DPGID=$30475044; // magic bytes

type // actual header
 TDPGINFO=record
   TotalFrame:integer;
   FPS:double;
   SndFreq,SndCh:integer;
   AudioPos,AudioSize:integer;
   MoviePos,MovieSize:integer;
 end;

I also looked at BatchDPG's headermaker.exe's output, looks valid at first glance... Maybe some of the padding bytes are wrong (in such a way that Moonshell doesn't care, but dpgdec does)? (Also, what's up with headermaker not asking for "SndCh"? Maybe that's it?)


Update: There you go, a platform-independent header maker (now if only dslinux sported mencoder & perl, you wouldn't need a PC at all
grog.gif
)
CODE#!/usr/bin/perl

if($#ARGV!=6){
 Âprint "usage: mkheader.pl \n";
 Âexit;
}

open(f,">@ARGV[6]");
binmode(f);
print f pack(a4ixCxxiiiiii,
      'DPG0',    Â# magic
      @ARGV[0],   Â# frames
      @ARGV[1],   Â# fps
      @ARGV[2],   Â# samplerate
      @ARGV[3],   Â# channels (0x00 for mp2, 0x0n for n-channel wave)
      36,      Â# audio pos (starts right after header)
      @ARGV[4],   Â# length of audio data
      36+@ARGV[4],  # video pos (starts after audio data)
      @ARGV[5]    # length of video data
     Â);
close(f);
Run the script to get a header, then simply "cat header.bin audio.mp2 video.m1v > myfile.dpg". Now, anyone wanna screw around with mencoder & co to get working audio/video converter scripts?
 

h0t1ce

New Member
OP
Newbie
Joined
Jun 25, 2006
Messages
3
Trophies
0
XP
27
Country
Canada
Sorry for the slow reply. I was busy at work all day.

Well thank you very much both feriol and FAST6191 for your help.

thanks feriol for the headermaker. That was the hardest part! Seems all is left is making a small script to use mencoder like dpgenc is doing to convert most video formats into mpeg1 format.

I like the idea of having a mencoder and perl on DSLinux. I'm just not sure the conversion process would be very fast!

thanks again!
 

feriol

Well-Known Member
Member
Joined
Nov 23, 2005
Messages
119
Trophies
0
Website
Visit site
XP
120
Country
Gambia, The
I just played around with "Draw Test R10", and seeing how it needs around half a minute to save a 512x328 png file... You'd need a whole new word to describe just how horribly slow it'd be. Apart from it being a cool technical demo, it'd be completely useless...

About the transcoding, I'd appreciate if you let me know when you have an idea on how to change the frame rate (the only bit I'm still missing). mencoder's "-fps" option seems to only slow down the playback instead of dropping frames.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    OctoAori20 @ OctoAori20: Not a lot, just relaxing