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 development > Video codec for DS games (video downloads)

#52182 - cybereality - Sun Aug 28, 2005 3:34 am

I am looking to create a multimedia game using the DS and I need a way to play video on the system. I looked around (ie google, searched the forums, etc.) and all I found was Caimans Video Codec. Though the quality was excellent, it is a commercial product and I cant afford to pay $5000+ just to put video on a little demo I am making. Are there any other freeware / open-source solutions to get video on either the DS or GBA? I know there is a GBAMP or whatever, but I am talking about a software only solution so I can code an interactive movie type of game.

If not I would be interested in creating one myself, but it seems rather complex. My first idea was just to use a series of JPEGs that would cycle through an array. The only issue would be size (I think GBA cart max is like 32MB) so that might not be the best solution. Does anyone know how I would go about starting to get a video codec on the DS? Any help will be much appriciated.


Last edited by cybereality on Wed Aug 31, 2005 3:08 am; edited 1 time in total

#52185 - zerotri - Sun Aug 28, 2005 4:33 am

try this:
http://www.mpeg.org/MPEG/MSSG/#source
it is an MPEG-2 video codec.
not for the DS, but it couldnt be too hard to port.
otherwise, check SourceForge.net

hopefully that helps some.

~~~Zerotri~~~

#52190 - cybereality - Sun Aug 28, 2005 4:56 am

I managed to find an opensource program called PocketMVP. This was designed for the PocketPC platform which runs on ARM9 processors, so I thought it could be a good place to start. They have a codec called the VP3 codec for PocketMVP, which will run DiVX and similar files on the PocketPC. I have tested the software on my Dell Axim and the quality it pretty good for the file size. They also made a port for Dreamcast, so I assume porting it to NDS may also be possible. Heres the link (with source files) if anyone else is interested:
http://home.adelphia.net/~mdukette/downloads.html

So far this looks like the most promising start. I assume since it is designed for ARM9 processors that it would be possible to run on DS, however those PPCs are usually 133MHz and up, so Im not sure how fast it would be. But Im sure there are tricks you can do to get video running (judging by the quality of Caimans codec). If anyone has any experience porting PPC or Dreamcast code to the DS, please let me know where I would start.

BTW, I tried a simple test to see if the DS could decode a series of JPEGs to fake video but it didn't work. I compiled 50 images at about 20k each using the GBFS and based off of Chris Double's JPEG loader. It would load about the first 5 frames and then choke or crash, it was hard to tell. So I guess decoding JPEGs or the fly is out of the question.

#52199 - zubiac - Sun Aug 28, 2005 11:12 am

Maybe THIS could be useful for you.
(Once there's sound implanted)

translation:
Quote:
Hello, I and delfare have made a video converter for nintendo DS: viDeoconverterS

For the moment there is no sound, but that could not delay the release.

It is rather simple of use, it is enough for you to put the video one in the repertoire dated, to modify the convert_video.bat and of modified this line:

avi2ds Data/test.avi by avi2ds Data/MaVideo.avi

and if you want to save place but by losing quality you replace this line with:
avi2ds Data/test.avi by avi2ds_BadQuality Data/test.avi

once that you converted your video, it is enough for you to click on build_rom.bat and that will create a file video.ds.gba pret with being flasher on your cartridge gba!

Also, it is necessary to remove the file of screen0.frm with screen9.frm bus when one does one * frm that thus modifies the oder frames are enmell� a little in the video but that is arranged!



WOW. Maybe something for Moonshell too?
_________________
Abusing Cube and DS with all sorts of homebrew and hacks.

#52237 - Kir - Sun Aug 28, 2005 5:12 pm

Man, that thing is absolutely LAME. Guy simply copies videoframes as uncompressed .BMP files into GBFS, and then so called "player" just shows them with a right timing. Since there's no codec of any sort, video is HUGE in size and no sound, of course.

#52259 - birslip - Sun Aug 28, 2005 9:44 pm

Quote:


I tried a simple test to see if the DS could decode a series of JPEGs to fake video but it didn't work. I compiled 50 images at about 20k each using the GBFS and based off of Chris Double's JPEG loader. It would load about the first 5 frames and then choke or crash, it was hard to tell. So I guess decoding JPEGs or the fly is out of the question.


My videos converters works like that. I use a jpeg lib and gbfs now. I can't port a mpeg 4 lib... It's too hard. And for the sound, i try zlib compression.

I'm seeing the mpeg-2 codec too.

#52260 - jstart - Sun Aug 28, 2005 9:55 pm

umm u guys lookee here tadah
http://www.ndsupdates.com/2005/08/videoconverters-for-ds-released.html#comments
_________________
-=Jstart=-

#52261 - tepples - Sun Aug 28, 2005 10:01 pm

birslip wrote:
My videos converters works like that. I use a jpeg lib and gbfs now. I can't port a mpeg 4 lib... It's too hard. And for the sound, i try zlib compression.

Zlib won't do much to sound unless you unfilter it first, using an autoregressive, or linear prediction, model. An autoregressive model tries to predict the next sample based on the last few samples and then stores the difference between the prediction and the actual next sample. Such models lie at the heart of most lossless audio codecs (such as Shorten and FLAC) and most lossy cellphone codecs (such as GSM Full Rate, which has been ported to GBA and should be easy to port further to Nintendo DS).
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#52298 - birslip - Mon Aug 29, 2005 2:19 pm

Ok, thanks tepples.
I'm trying the adpcm format, and it works fine on DS!
On Dstek:
Quote:

Cpu Bit Name Expl.
7 0-6 Volume 0..127=silent..loud
7 8-9 Data Shift 0..3=None, 1bit, 2bit, 4bit
7 15 Hold 0=Nothing, 1=Hold
7 16-22 Panning 0..127=left..right
7 24-26 Wave Duty See below

7 27-28 Repeat Mode 0..3=Manual, Loop Infinite, One-Shot, Prohibited
7 29-30 Format 0..3=PCM8, PCM16, IMA-ADPCM, PSG(Programmable Sound Generator)/(white)noise
7 31 Channel Enable 0=Disable, 1=Enable


Video sample with adpcm sound:
http://birslip.pizz.biz/mullen_video_adpcm.rar

#52465 - cybereality - Wed Aug 31, 2005 3:06 am

I finally got a video onto the DS! Its a 5 minute trailer for The Animatrix with sound. I am using the jpeg slideshow technique, so it is not a real codec, but it works. I am working on a multimedia game (ported from flash) and I needed to be able to play short video clips. Until a real codec comes out, this is the next best thing. I am working directly from Chris Double's tutorials and using the GBFS to decompress JPEGs to the screen. Using this method I was able to compress a 5 minute 90MB quicktime trailer into a 16MB ROM. Obviously this isn't optimal, but its not too bad either. So dont expect to rip a DVD, or even an episode, using this method. It could be useful for like a short intro animation or prerendered cut-scene. In a situation where you only need like 1 minute of video and you didn't want to code a whole codec to do so.

------------------------------------------------
THE ANIMATRIX TRAILER - DS
animatrix.nds
animatrix.nds.gba
source code
------------------------------------------------


Last edited by cybereality on Wed Aug 31, 2005 7:10 am; edited 1 time in total

#52467 - tepples - Wed Aug 31, 2005 3:13 am

cybereality wrote:
I am using the jpeg slideshow technique, so it is not a real codec

Yes it is. The "JPEG slideshow technique" is more properly called motion JPEG, and it is widely used in video production. It's a good start until you figure out how to do motion compensation. (Imagine a full MPEG decoder.)
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#52485 - cybereality - Wed Aug 31, 2005 7:19 am

Thanks tepples, I didn't even know that. It just seemed like the simplest solution. I plan on working on it further, it can definately be optimized. It was also a great learning exercise, and hopefully will grow to something more full featured.

// cybereality

#52538 - leoedin - Wed Aug 31, 2005 5:38 pm

how tricky is it to port from flash, or do you need to completely re-code everything except the graphics, as a really great game that could be ported (if possible :)) is Madness Interactive :)
Leo
_________________
Yours Truly
my website
my blog
M3 Review

#52561 - cybereality - Wed Aug 31, 2005 9:32 pm

When I said port from Flash, I mean in the broadest sense of the term. All the logic would have to be re-coded from scratch. Basically I have all the assets ripped into a format the DS can handle. Then I will recode the game logic in C++. There is not a simple way to port content like that do another platform. Especially if there are Flash specific tools used like tweening or movie clip properties, etc. You can get the graphics as images no problem (that was how I exported the animatrix trailer to a jpeg sequence), but the code will be different. But if you know what you're doing, its not that hard. Just expect to redo a lot of stuff.

// cybereality

#52567 - leoedin - Wed Aug 31, 2005 10:17 pm

thanks, I'm a bit of a C/C++ noob right now, so I don't think i'll be porting a flash game soon :).

Leo
_________________
Yours Truly
my website
my blog
M3 Review

#52570 - Volta - Wed Aug 31, 2005 11:08 pm

Anyway it would just be crazy to create a flash emulator. Flash is just so much using ram...

#52573 - leoedin - Wed Aug 31, 2005 11:23 pm

yes: porting, not emulating. I was talking about taking the source (.fla) and porting it to the DS. It takes a while to re-write everything in the flash game into C++, and just take the graphics from the fla.

--Leo
_________________
Yours Truly
my website
my blog
M3 Review

#52574 - cybereality - Wed Aug 31, 2005 11:55 pm

Well flash is an open standard so it would be theoretically possible to create a DS flash player, however I doubt it would run good. This is not the same as an emulator. It would be a stripped down flash client. I was even concidering writing a Flash Lite exporter for the DS (this is the flash version that runs on mobile devices), but it would be a major project. It would be easier to just port the code over. Most of the game logic can be broken down to simple "if.. then" statements which will work under any language. The main issue would be rewriting the graphics functions, but once you have that working, the rest is simple.

// cybereality

#52576 - josath - Thu Sep 01, 2005 1:01 am

Flash lite should be doable...it runs on cellphones after all. Too bad macromedia charges money (lots of it, i think) for the player source...you'd have to rewrite it from scratch.