Russell Posted August 7, 2023 Share Posted August 7, 2023 Hello team, I'm working on a little vídeo that i want show on my game's startup. But I found that I can't load an mp4 (h264) video in LUA. I've tried to dive along old forum posts, but the examples I've found are in C++ and some links inside don't work anymore after the upgrade from leadwerks.com to ultraengine.com I am testing an initial basic code as the following: local IntroVideo = System:CreateVideo() IntroVideo:Open("Video/Intro.mp4") -- Reproduce el video IntroVideo:Play() But doesn't work. It doesn't give me any error, but doesn't work for me either. Any ideas on how I can start with this point? I just want a video to play when the game opens, and then load the starting *.map. Many thanks Quote Link to comment Share on other sites More sharing options...
Russell Posted August 7, 2023 Author Share Posted August 7, 2023 Is there anyway inside Leadwerks to load a video with LUA? I've found some examples with C++ but with LUA valid for Leadwerks i can't find anything. Quote Link to comment Share on other sites More sharing options...
Russell Posted August 8, 2023 Author Share Posted August 8, 2023 Team i need help with this... All the threads inside the forum that talk about this subject are down or lost. And links inside this threads with the "www.leadwerks.com..." don't work after the change to www.ultraengine.com. Google can't help me neither, because all the LUA examples I find to play a video, don't work in Leadwerk's LUA. Many thanks. Quote Link to comment Share on other sites More sharing options...
Solution Josh Posted August 8, 2023 Solution Share Posted August 8, 2023 Links to the Leadwerks domain should just redirect to the equivalent URL to this domain: https://www.leadwerks.com/community/topic/62067-how-to-loadplay-any-video-file-with-lua/ Leadwerks doesn't support video files. Ultimately what you need is a series of texture files and an audio file. Any video file loader will just be doing that behind the scenes. You might as well just use ffmpeg or something to extract a series of images. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Russell Posted August 8, 2023 Author Share Posted August 8, 2023 25 minutes ago, Josh said: Links to the Leadwerks domain should just redirect to the equivalent URL to this domain: https://www.leadwerks.com/community/topic/62067-how-to-loadplay-any-video-file-with-lua/ But for me, in all old threads like this thread: We have a link inside: "http://leadwerks.com/werkspace/index.php?app=downloads&showfile=89" and when i push it, appears this: And this always happens to me with all the links www.leadwerks.com that now are ok transformed with www.ultraengine.com route. How can I fix this? ------------------------------------------------------ 29 minutes ago, Josh said: Leadwerks doesn't support video files. Ultimately what you need is a series of texture files and an audio file. Any video file loader will just be doing that behind the scenes. You might as well just use ffmpeg or something to extract a series of images. Many thanks Josh!! Yesterday i've found again this thread of @Ttiki very useful... But I was totally unaware that LUA didn't allow to play video... Answer that leads me to ask one last question... Can a Leadwerks game built 100% in LUA run C++ scripts in a mixed way? Quote Link to comment Share on other sites More sharing options...
ERK Games Posted August 27, 2023 Share Posted August 27, 2023 The implementation of Theora Video on Leadwerks was written by Niosop a long time ago, even for the 2.x versions of the engine. As practice and a HUGE number of tests and attempts have shown, it works quite unstably and requires significant additions as well as radical solutions to minimize crashes when playing videos (in particular, it requires low quality sound in the video file (96kbps recommended and 128kbps maximum) for more or less stable operation, and video resolutions no higher than 720p at 5000kbps (recommeded 720x576 for 16:9, which, you see, is rather low quality for 2023). Our first game on Leadwerks, SALVATIONLAND, uses a significantly improved Lua-based version of this implementation, but crashes still occur on certain hardware combinations. We were unable to identify their patterns or fix the C++ code, as Niosop didn't release the source code for the library. So, yes, I wouldn't recommend using this Theora implementation to ANY users of the engine. It's necessary to write video implementation from scratch, look for ways to do so. We're currently searching and have not yet found a solution. There was our attempt to attach some ffdshow components to the engine to launch full-screen video separately from the application process. Unfortunately, this caused a large number of problems and was a rather rough. 2 Quote Link to comment Share on other sites More sharing options...
Gun Man Posted September 29, 2023 Share Posted September 29, 2023 On the topic of video playback, will video be supported natively in Ultra Engine? I've skimmed through the documentation, but couldn't find anything relating to video. 1 Quote Link to comment Share on other sites More sharing options...
Josh Posted September 29, 2023 Share Posted September 29, 2023 39 minutes ago, Gun Man said: On the topic of video playback, will video be supported natively in Ultra Engine? I've skimmed through the documentation, but couldn't find anything relating to video. Not yet but I am open to adding this in the future. 2 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Gun Man Posted September 29, 2023 Share Posted September 29, 2023 54 minutes ago, Josh said: Not yet but I am open to adding this in the future. Adding video playback in the future would be very useful, and very much appreciated. Thank you. 1 Quote Link to comment Share on other sites More sharing options...
Josh Posted September 30, 2023 Share Posted September 30, 2023 It looks like ffmpeg is probably the easiest way to achieve this. Exact audio: https://stackoverflow.com/questions/9913032/how-can-i-extract-audio-from-video-with-ffmpeg Extract frames: https://stackoverflow.com/questions/10957412/fastest-way-to-extract-frames-using-ffmpeg I think that's pretty much it. All that's needed is to wrap it up in some nice easy to use commands. 3 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
klepto2 Posted September 30, 2023 Share Posted September 30, 2023 @Josh, as UltraEngine uses Vulkan you might consider using the Vulkan Video extensions ( researched since 2018 and integrated since 2021 ) https://www.khronos.org/blog/an-introduction-to-vulkan-video It enables you to decode and encode H264 (mp4) and maybe other formats (don't know exactly) directly on the gpu and use the frames as normal VKImageViews / VKImages and VkBuffers. A good sample of the integration is located here: https://wickedengine.net/2023/05/07/vulkan-video-decoding/ 1 2 Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI 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.