#53415 - cybereality - Thu Sep 08, 2005 8:01 am
I have converted the Ruby tech demo into a DS video. This is using a similar technique to the Animatrix trailer I released last week, but with major improvements. The code has been cleaned up and optimized and now supports double buffering. This results in much smoother playback. The sound has also been upped to 41k mono (I still can't seem to get stereo sound to play). The 2 minute trailer with sound fits on a 128Mbit card (14MB total). It has been tested on a NeoFlash 512Mb, should work with other GBA flash carts.
---------- RUBY - DOUBLE BUFFERED VIDEO EXAMPLE -------------
download nds
download nds.gba
download source
------------------------------------------------------------------------------
The code is based off of chris doubles tutorials and uses the GBFS and JPEG loader to display the images. This is a good example of how to load files (images/sounds) from a GBA cart using the GBFS. Since the DS can only handle 4MB in ram at a time, I am using a system to swap out different files during playback to play the entire video. Also, for some reason GBFS cannot compile more than 500 files at a time into a *.gbfs, so I had to create a work-around for that. The double buffering was based on the example in libnds (drunken coders) but optimized by the use of dmaCopy().
This project was designed as a quality test for a multimedia game I am working on (about 50% complete right now). I was able to get the video quality at a good level while still cramming 2 minutes of video onto a 128Mbit file. This could be useful for a short pre-rendered intro or some animated cut-scenes to spice up your homebrew titles. All you have to do is export a series of JPEGs (about 10K each) from your video editing program. I used Flash, but I could have easily used any program that exports a series of images from video source. Then set an array in the source to hold the names of the files and it will play them back. I hope this may be of some use to someone.
// cybereality
#53422 - tepples - Thu Sep 08, 2005 8:25 am
cybereality wrote: |
Also, for some reason GBFS cannot compile more than 500 files at a time into a *.gbfs |
There's a missing fclose() in gbfs.c.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#53424 - falcon!!! - Thu Sep 08, 2005 8:59 am
hey i just cant start the video! It shows me the logo on the bottom screen and it stop. HOw can i start it ?
#53426 - cybereality - Thu Sep 08, 2005 9:11 am
tepples: thanks a bunch, I'll try to fix that.
falcon: Like I said, I've only tested it using a NeoFlash 512Mb cart and FlashMe. I know it wont work in any emulators. What setup are you using, I'd be interested to know the difference. The only thing I can think is that the flash card you have uses different memory address that aren't compatible with NeoFlash/X2 so it can't read the data.
// cybereality
#53428 - falcon!!! - Thu Sep 08, 2005 9:23 am
i've tried nds file with gbamp + flashme, then ds.gba in the same way.
They dont go.
#53433 - El Hobito - Thu Sep 08, 2005 10:34 am
i've told you a thousand times falcon
#53434 - falcon!!! - Thu Sep 08, 2005 10:39 am
El Hobito wrote: |
i've told you a thousand times falcon |
Is this one of those case in which you need more than 4 MB of ram to load the movie?
#53487 - El Hobito - Thu Sep 08, 2005 7:16 pm
Yup the nds file would need to be small enough to fit in memory and the jpegs would need to be streamed off the cf, should be too difficulty to do, in fact i might give it a bash myself, though dont expect anything.
#53507 - Chetic - Thu Sep 08, 2005 10:02 pm
Great job with this, cybereality!
Quality is fantastic, sound good and size is actually also pretty nice.
Could you make a converter or something so non-coders (/moron-coders (me)) can convert their own moviefiles to work with this?
Even if it is jpeg, I can't think of a way to do this without taking like all day.
I really enjoyed watching this.
_________________
Packin':
Grey DS with FlashMe v7
1Gbit XG2T 2005 (Neoflash compatible)
GBAMP, Supercard CF, 512Mb Magic Key 3 and EZFA 256Mbit
#53514 - cybereality - Thu Sep 08, 2005 10:58 pm
falcon: I guess you can only use this with an actual flash cart. Emulators, GBAMP, WiFi, won't work. I can release a simple version of the code if you just want to see if it works, but I could only fit about 30 seconds of video into a 4MB file.
Chetic: Im glad you enjoyed it. I was concidering writing a program to automate the process, but I may want to use my effort to port a real codec to the DS. I am looking right now into adding an MPEG decoder to the project so it can load video files directly. I'll post any updates.
_________________
// cybereality
#53571 - falcon!!! - Fri Sep 09, 2005 7:56 am
cybereality wrote: |
falcon: I guess you can only use this with an actual flash cart. Emulators, GBAMP, WiFi, won't work. I can release a simple version of the code if you just want to see if it works, but I could only fit about 30 seconds of video into a 4MB file.
|
Yes yes! I'd really appreciate a video even if small! THX :D
#53576 - El Hobito - Fri Sep 09, 2005 1:19 pm
gbfs doesnt work with the gbamp so you might have difficulty doing this via that method. I know this cos i've just tried modifying the make file and got to 3.5 megs (1.5 minus sound) and theres no change. Gonna have a bash at replacing it with chism's cf reader instead
#53602 - tepples - Fri Sep 09, 2005 5:18 pm
El Hobito wrote: |
gbfs doesnt work with the gbamp |
It does if you use gbfs followed by either bin2s or the bin2o macro.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#53620 - El Hobito - Fri Sep 09, 2005 8:49 pm
so I use that on the gbfs file itself? then tack it on to the arm bin files or what? is there a doc for it somewhere?
#53627 - Bi99uy - Fri Sep 09, 2005 10:51 pm
It works wonders using the Supercard. While the framerate is kinda choppy and the audio isn?t really in sync, it?s impressive. I can?t wait for the day when you port a "real" codec to the DS plattform.
#53632 - cybereality - Sat Sep 10, 2005 12:55 am
Here is a much simplier example of the engine. It sill uses GBFS, but it only displays 10 images of different solid colors. If you are using a different file system (not GBFS) then you only have to edit the BltImage() function to point to the file instead of GBFS. If you can get this to display the flashing colors, then just replace the image array with your sequence of images. I reduced the code to the bare minimum so it is a much better example then the one with the full video.
------- SIMPLE DOUBLE BUFFERED IMAGE LOADER EXAMPLE ---------
download nds
download nds.gba
download source
-----------------------------------------------------------------------------------
_________________
// cybereality
#53662 - El Hobito - Sat Sep 10, 2005 12:21 pm
cheers, i figured this would be a good little project for me i probably wont ever release it but if i do get it working i'll send you a copy (that may take some time as im rather busy at the mo).
#53665 - falcon!!! - Sat Sep 10, 2005 12:35 pm
hey. the small ds buffer doestn work.
#53668 - cybereality - Sat Sep 10, 2005 1:33 pm
falcon, im sorry. I can't help you then. Maybe you should look into getting a GBA flash cart. If you already have flashed your DS it will only cost like $50. Its a pretty good investment.
_________________
// cybereality
#53671 - falcon!!! - Sat Sep 10, 2005 1:59 pm
no i wont. But do u know why doesnt your video work on gbamp? Its only 40 KB.
All othet homebrew nds files work fine....
#53677 - cybereality - Sat Sep 10, 2005 3:22 pm
It has to do with how I am loading the images from the GBFS file that is appended to the ROM. Other homebrew demos include the files inside the compiled bin, which wont work for video because of the size. The code would have to be modified to work specifically for GBAMP. Tepples mentioned that you can use bin2s/bin2o to compile the files to work with GBAMP. I would suggest searching those tools. I would try to get it working myself, but I dont have a GBAMP and would have no idea how to test the code. If I find a good way to load the files that will work on all devices, I will switch to that method.
_________________
// cybereality
#53691 - tepples - Sat Sep 10, 2005 6:28 pm
cybereality wrote: |
Other homebrew demos include the files inside the compiled bin, which wont work for video because of the size. The code would have to be modified to work specifically for GBAMP. Tepples mentioned that you can use bin2s/bin2o to compile the files to work with GBAMP. I would suggest searching those tools. |
There is a bin2s program in the GBFS distribution, but bin2s does "include the files inside the compiled bin".
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#53733 - falcon!!! - Sun Sep 11, 2005 8:17 am
is it possible to use your source to create our videos?
If we put the same number of images (total video lenght the same) and we put some .aiff, can we get our videos?
Anyway i dont know how to make it works on gbamp, so I'm not motived.
HELP^^
#54865 - Dudu.exe - Fri Sep 23, 2005 5:31 am
there is a way to compress even more Jpeg go get smallers videos?
_________________
http://flickr.com/photos/stuffbox
#54887 - cybereality - Fri Sep 23, 2005 8:39 am
The animatrix trailer was an attempt to cram as much video as I could onto a 128Mb cart. I managed to fit a total of 5 minutes of audio and video using the motion jpeg method. The images were compressed as far as I could (most stills were about 4K) so that is the max, as far as I know. The ruby trailer was only about 2 minutes so I was able to increase the quality of the jpegs. This technique is useful to show short video clips exported as an image sequence. It works well for intro screens or small multimedia projects like TickleGirl. Dont expect to rip any DVDs like this or anything.
If you are interested in using this in your own project, I would suggest downloading the double buffer demo from my site. It is a simple example illustrating the technique used to display a series of jpegs on the screen. If you have a 2-4 minute video you want on the DS, do the following. Use the ruby source as an example, it has updates from the animatrix trailer. Use a video editing program to export still images of the video (10fps 256X192). Put the images in a folder with the source and edit both the makefile and the main_arm9 file. If you want to make your life easier, then just over-write the ruby images with the new images of the same name and you wont have to edit the source too much. Make sure the the images array in the source has the same number of images as the folder and makefile. Also, make sure the jpegs do not exceed 12K or the DS cant render in real-time. The audio is AIFF 8-bit mono. Make sure no one sound file is larger than 4MB or the DS will crash (not enough RAM). Thats basically it.
_________________
// cybereality
#59297 - Sektor - Mon Oct 31, 2005 8:57 am
I just tried this on M3 Perfect CF (firmware E10) + PassKey. It plays the video but there is no sound. Same problem with animatrix trailer.
#59303 - falcon!!! - Mon Oct 31, 2005 9:42 am
it works for me on m3.
sorry the off topic: can u run heretic on m3? i cant...It seems that there are some problems with ds.gba files with the last firmwares (09, 10)..
I was thinking on install back update07 or similar..