DPG header?

Discussion in 'NDS - Flashcarts and Accessories' started by h0t1ce, Jul 6, 2006.

  1. h0t1ce

    h0t1ce Newbie

    Jun 25, 2006
    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
  2. feriol

    feriol GBAtemp Regular

    Nov 23, 2005
    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.
  3. FAST6191

    FAST6191 Techromancer

    pip Reporter
    Nov 21, 2005
    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:
  4. feriol

    feriol GBAtemp Regular

    Nov 23, 2005
    Gambia, The
    The relevant bits from the dpgenc source, in case you haven't already found it:
    const DPGID=$30475044; // magic bytes
    type // actual header
    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 [​IMG])

    Â Âprint "usage: mkheader.pl \n";
    Â Âexit;

    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
    Â Â Â Â Â Â);
    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?
  5. h0t1ce

    h0t1ce Newbie

    Jun 25, 2006
    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!
  6. feriol

    feriol GBAtemp Regular

    Nov 23, 2005
    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.
  7. h0t1ce

    h0t1ce Newbie

    Jun 25, 2006
    well I'm using "-ofps 15" and it's skipping frames like it should be.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice