Vulcan Posted August 9, 2014 Share Posted August 9, 2014 I think Leadwerks should have a video player for the purpose to show intro video and game scenes. Yesterday I did make short intro video (6 sec, compressed AVI, ~2 MB) in Blender that was good but did not have an easy way to play this intro when game start. I suggest having a Cinema class that play a video in window/fullscreen with Play/Stop. Cinema* intro = new Cinema("Video/intro.avi"); if(intro->isLoaded()) intro->Play(); intro->Unload(); delete intro; As a temporary solution I made a cinema class and all works pretty well, except for that it takes about ~500 MB. And it uses *.tex files as each frame (0001.tex -> 0099.tex in my case). Cinema.txt Quote Link to comment Share on other sites More sharing options...
Guppy Posted August 9, 2014 Share Posted August 9, 2014 Have a look at this; https://icculus.org/theoraplay/ Theora migth not be the best format - but it's defintiviely better than 500mb for 6 sec of video and it's unencumbered by patents Quote System: Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k Link to comment Share on other sites More sharing options...
gamecreator Posted August 9, 2014 Share Posted August 9, 2014 Speaking of Theora, this was done for LE2: http://www.leadwerks.com/werkspace/files/file/89-letheorazip/ Maybe you can adapt it. Also this: http://www.leadwerks.com/werkspace/files/file/395-video-rendering-with-directshow/ Quote Link to comment Share on other sites More sharing options...
Vulcan Posted August 9, 2014 Author Share Posted August 9, 2014 Have a look at this; https://icculus.org/theoraplay/ Theora migth not be the best format - but it's defintiviely better than 500mb for 6 sec of video and it's unencumbered by patents Unfortunately TheoraPlay is based on C code, after digging around the net I found something called libtheoraplayer which is C++ based and so far looks good. Quote Link to comment Share on other sites More sharing options...
Vulcan Posted August 9, 2014 Author Share Posted August 9, 2014 Speaking of Theora, this was done for LE2: http://www.leadwerks.com/werkspace/files/file/89-letheorazip/ Maybe you can adapt it. Also this: http://www.leadwerks.com/werkspace/files/file/395-video-rendering-with-directshow/ Weird but can't download those files. "Sorry, you don't have permission for that." Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted August 9, 2014 Share Posted August 9, 2014 Well those files only work with Le2 anyway. A custom dll was created for LE2 to support video directly in the editor. Quote Link to comment Share on other sites More sharing options...
gamecreator Posted August 9, 2014 Share Posted August 9, 2014 Could you adapt it to work in your own LE3 code? Probably much better than starting from scratch, even if it doesn't work in the editor. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted August 9, 2014 Share Posted August 9, 2014 It certainly is possible. Just take quite some time to figure out how it works. Quote Link to comment Share on other sites More sharing options...
Guppy Posted August 9, 2014 Share Posted August 9, 2014 Unfortunately TheoraPlay is based on C code, after digging around the net I found something called libtheoraplayer which is C++ based and so far looks good. Any why would that be a problem? Quote System: Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k Link to comment Share on other sites More sharing options...
Vulcan Posted August 9, 2014 Author Share Posted August 9, 2014 I am not sure how I would implement this with Leadwerks. How do I put video frame onto a Leadwerks::Texture ? Quote Link to comment Share on other sites More sharing options...
Vulcan Posted August 11, 2014 Author Share Posted August 11, 2014 I have tryied to get TheoraPlay to work with Leadwerks. I do get pixel data but when trying to assign that data to Leadwerks::Texture then I get a run-time error. How do I remedy this? Only thing I can think of now is to iterate through each pixels but that would probably be slow as turtle. void TestState::Enter() { //bunny.ogg: 720x400 const char* filename = "bunny.ogg"; int video_w = 720; int video_h = 400; texture = Texture::Create(nextPow2(video_w), nextPow2(video_h), Leadwerks::Texture::RGB); THEORAPLAY_VideoFormat vidfmt = THEORAPLAY_VIDFMT_YV12; // <----- Probably wrong format. VLC reports YUV THEORAPLAY_Decoder *decoder = NULL; const THEORAPLAY_VideoFrame *video = NULL; const THEORAPLAY_AudioPacket *audio = NULL; decoder = THEORAPLAY_startDecodeFile(filename, 20, vidfmt); while (THEORAPLAY_isDecoding(decoder)) { video = THEORAPLAY_getVideo(decoder); if (video) { printf("Got video frame (%u ms)!\n", video->playms); texture->SetPixels((const char*)video->pixels); // <------- Runtime error: "Unhandled exception" THEORAPLAY_freeVideo(video); } // if audio = THEORAPLAY_getAudio(decoder); if (audio) { printf("Got %d frames of audio (%u ms)!\n", audio->frames, audio->playms); THEORAPLAY_freeAudio(audio); } // if if (!video && !audio) Sleep(10); } // while if (THEORAPLAY_decodingError(decoder)) printf("There was an error decoding this file!\n"); else printf("done with this file!\n"); THEORAPLAY_stopDecode(decoder); } howtovideo.txt Quote Link to comment Share on other sites More sharing options...
Vulcan Posted August 11, 2014 Author Share Posted August 11, 2014 WOOOHHOOOO!! I got it playing with Big Buck Bunny, only need to play it with correct speed and audio Quote Link to comment Share on other sites More sharing options...
Guppy Posted August 11, 2014 Share Posted August 11, 2014 WOOOHHOOOO!! I got it playing with Big Buck Bunny, only need to play it with correct speed and audio That is nice, however since this thread will likely show up in the search it would be nice if you posted the solution also 1 Quote System: Linux Mint 17 ( = Ubuntu 14.04 with cinnamon desktop ) Ubuntu 14.04, AMD HD 6850, i5 2500k Link to comment Share on other sites More sharing options...
Vulcan Posted August 11, 2014 Author Share Posted August 11, 2014 I have been trying to learn about how TheoraPlay handles sound and found out the sound data is within struct packets called THEORAPLAY_AudioPacket. But so far I haven't figured out how to implement this with Leadwerks. I have looked at Leadwerks header files: Sound.h and Bank.h but seems like "Bank* data" is holding all sound data. My problem is I am not sure how to append more sound data as new sound packets are arriving from TheoraPlay. audio = THEORAPLAY_getAudio(decoder); if (audio) { printf("Got %d frames of audio (%u ms)!\n", audio->frames, audio->playms); // <------ How do I add sound data to Leadwerks::Sound ? THEORAPLAY_freeAudio(audio); } // if Quote Link to comment Share on other sites More sharing options...
Krelle Posted November 23, 2014 Share Posted November 23, 2014 I really wish LETheora would work. Currently it's not. I know small game designers should not focus on cut scenes and movies. But I think this is diffrent. The ability to play video inside leadwerks would be great because it would allow stuff like talking pictures, old television sets, shock effects where texture suddenly change into some scary movie clip and a whole lot of other cool stuff. Quote Link to comment Share on other sites More sharing options...
BES Posted November 24, 2014 Share Posted November 24, 2014 Dumb question probably... but couldnt you make your video into an animated texture or something ?(adding sound to it)(or a series of linked animated textures) ...I say texture since GIFs dont seem to work in Leadwerks 3 ..its not seeing it.. Quote Threadripper 2920X Gen2 CPU(AMD 12-core 24 thread) | 32Gigs DDR4 RAM | MSI Nvidia GeForce RTX 2070 Stock OCed | ASRock X399 Professional Gaming Motherboard | Triple M.2 500Gig SSD's in Raid0 Windows 10 Pro | Blender | Paint.Net | World Machine | Shader Map 4 | Substance Designer | Substance Painter | Inkscape | Universal Sound FX | ProBuilder | 3D World Studio | Spacescape | OpenSky | CubeMapGen | Ecrett Music | Godot Engine | Krita | Kumoworks | GDScript | Lua | Python | C# | Leadworks Engine | Unity Engine Link to comment Share on other sites More sharing options...
randomkeyhits Posted November 24, 2014 Share Posted November 24, 2014 I'd happily settle for being able to do something like exec "/usr/bin/mplayer2 ./my_awesome_cutscene.mp4" in lua before loading the next map. Even cooler would be if I could get it to do that, load a map in the background and wait for the video to end before jumping into the map. Quote content over form, game play over all. Link to comment Share on other sites More sharing options...
Rick Posted November 24, 2014 Share Posted November 24, 2014 Have you looked into 3rd party libraries that maybe would make a window on top of LE's? It might be hacky but if you could have this video window on top of LE's then they would be completely separate. You could launch this window from LE before map loading and then after map loading you kill the window. Could be a possible workaround. You could even probably hide the task bar part of the window so it doesn't really look like it's 2 separate processes and could probably make the video window always on top. Quote Link to comment Share on other sites More sharing options...
Krelle Posted November 26, 2014 Share Posted November 26, 2014 Dumb question probably... but couldnt you make your video into an animated texture or something ?(adding sound to it)(or a series of linked animated textures) ...I say texture since GIFs dont seem to work in Leadwerks 3 ..its not seeing it.. this is a actually good solution for short animations. But it can never replace a real video player with audio Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.