Blitzmax and Video
BlitzMax Forums/BlitzMax Programming/Blitzmax and Video
| ||
Is there a way to show a video in BlitzMax, specifically on Mac? I have a project where I would like to have a video looping in the background. What are my options? |
| ||
from what i remember brucy made a couple modules that can do video one without sound i think it required you to sync them yourself, another thread here http://www.blitzmax.com/Community/posts.php?topic=87506 allowed you to embed a swf flash player into the game to play a movie. |
| ||
PantsOnHead made two video modules: One that plays mpeg video (GPL license), the other use Ogg Theora (BSD license) Neither of them has video/sound synchronization, though. You can download them here: http://www.pantson.com/mods/index.php |
| ||
Just a thought... You could use a MaxGUI web page window, disable all title bars hide cursor etc, and show a flash video |
| ||
But that would allow me only to show the video. I want to use BMax to put words and such on top of the video (sound is not required). |
| ||
The Ogg Theora one probably works for you. You can convert pretty much any video format into Theora using free converters. |
| ||
http://www.blitzmax.com/Community/posts.php?topic=87598#1012933 |
| ||
Bestest way I found, which give let me have the most control, kept the 'video' size right down, while fully cross platform, was to split a video into its individual frames, load each one into a bank, then load and display from there:-Function DoGameEnding() Local bank:TBank[215] For Local frameLoop:Int = 0 To 214 bank[frameLoop] = LoadBank("media/video/frame" + frameLoop + ".jpg") 'Each frame is 512x512 pixels Next Local count:Int = 0 frame = LoadImage(bank[count]) Local doExit:Int = False Local endingTweener:tTweener endingTweener = New tTweener.Create(18) Repeat Cls DrawImageRect frame, 0, 0, 800, 600 endingTweener.Update() For Local Ticks:Int = 1 To endingTweener.FrameTicks endingTweener.UpdateExecutionTime() frame = Null GCCollect frame = LoadImage(bank[count]) count = count + 1 If count = 215 Then doExit = True ; Exit Next If doExit = True Then Exit Flip If MouseHit(1) Then Exit Forever End Function Worked a charm! :) Dabz |
| ||
Using a 'real' video decoder will result in smaller files though, since thos etypically only track the changes between successive frames, and not the entire scene each frame. (Other than a keyframe every ~10 seconds or so) |
| ||
But that would allow me only to show the video. I want to use BMax to put words and such on top of the video (sound is not required). That's not a trivial task that goes far beyond simply displaying a video. You'll probably have to use OpenGL |
| ||
I'm pretty sure that the video decoders mentioned above will draw to the screen like any other blitzmax drawing operation -- you have a normal graphics context, and can draw on top of them without problems... |
| ||
Using a 'real' video decoder will result in smaller files though, since thos etypically only track the changes between successive frames, and not the entire scene each frame. (Other than a keyframe every ~10 seconds or so) What I found when using that code above (Which was only written because of the sheer lack of decent video support at the time), was that the file size difference was minimal, the above 'video' uses 215 512x512 jpeg frames, and rolls in, disk size, at 2mb... I found believe it or not, the same video encoded to roughly the same file size looked terrible, no, it was worse than terrible when running. A lot of blitzmax based video codecs that I tried just didnt do the job I wanted, they would either run and display the video terribly, if I recall, one used to only play the video on the top-left of the screen only, and to make it cover the entire screen, I'd have to convert it to 800x600 (Bigger file size straight away), but it still looked awful. Another would fire up its own graphics context and display it in a separate window (I think it was the windows only one that did that) I tried everything, but this worked a charm for me, and to be fair, if something works, then who am I to argue! Dabz |
| ||
Fair enough. |
| ||
@Dabz: You could also create your own file type and throw all the frames into that file (along with frame speed, video information, etc.) and then compress it with zlib. I would definitely be interested in something like this, actually. :) |
| ||
@Dabz: You could also create your own file type and throw all the frames into that file (along with frame speed, video information, etc.) and then compress it with zlib. I would definitely be interested in something like this, actually. :) lol, well, I was thinking of taking this a little step further when I needed video for my next project, because I'd simply do the same thing... Unless of course, someone writes one before hand, which is usually the case half the time! :D Dabz |
| ||
lol, well, I was thinking of taking this a little step further when I needed video for my next project, because I'd simply do the same thing... Unless of course, someone writes one before hand, which is usually the case half the time! :D I think a little stuff added here and there on top of what you already have would actually produce a very cool and useful module. If you ever do decide to take this a step further, I would definitely be interested in helping. |
| ||
I've been begging for someone to make a video module for years now. I'd pay for it. The ideas above for a module that uses frames in a zip file isn't what I want...it's not flexible enough. I want a standard video playback module, that handles synchronized sound, and be cross-platform. It needs to play Theora files at the very least, and Xvid would be nice as well. |
| ||
I am trying to create a program that displays song lyrics on top of looping video, so sound is not important for me. Yet I am still amazed that BlitzMax still does not have a robust video module. |
| ||
Has anyone tried to make VLC work with BlitzMax? Seems like that might be doable. |
| ||
MPlayer can be used with BlitzMax. http://www.mplayerhq.hu/design7/news.html I am not sure what kind of license it has. I used it for a media center type application I did for someone perhaps two years ago. If I remeber corretly it is controlled by calling it with commandline parameters and you need to feed it the context you want it to be shown in. But it supports all kinds of video files with and without sound. |