Implement video parsing/playback#1333
Conversation
- Added mpv_render_context_update flag check to bypass heavy OpenGL renders when no new frame is available. - Added auto-pause and resume behavior when textures are not rendered/accessed. - Configured automatic unloading after 20 seconds of inactivity to free GPU memory. - Added path query parsing (e.g. video.mp4?loop=no) to configure loop settings from b3d/csv files. - Added strict URL and network protocol checks to block internet endpoints. - Tuned MPV options (demuxer bounds, fast decoding, skiploopfilter, and thread limits) to prevent CPU/FPS lag.
|
please dont use too big video file, try test it with small 720p 10 seconds file. you need the libmpv .so file, unfortunately im not familiar with linux environment. you need to obtain the libmpv file either compile it from the source or from your package's server. |
|
For Debian / Ubuntu, I think you'll need to first install the libmpv2 package. Then, edit the OpenBveApi.dll.config file to add the following into the Not tested at the minute, might try doing that later. Apple wise, I think you'd have to compile it as a dylib, along with all it's dependancies and add that to the actual app bundle. I'm not entirely convinced though. This seems like a lot of work (and mess) for a relatively small return, Animated GIF files haven't really been used, and they give much the same result. |
|
I also asked the question because I thought I could play an 11GB file since I heard there was no time limit. However, as you mentioned, there's a time limit, and the resolution is 720P, and it's less than 30 seconds long, so I thought there are already realize by animated GIFs... |
well yeah... it is very time consuming... just assume this PR as working proof of concept. i tried to narrow it down, so only the video and audio decoder must work if we set video as texture, others feature should be blocked. But in the end, we must compile and tinker with the lib itself and its dependency if we need it for real public release... i don't want us to ship entire 100MB lib... |
i mean... there is technically no limits for size and video length... but if you wanna test, 720p 30fps 10 seconds is good enough. The audio is supported when i tested it in my side (windows). |


Discussion at #1332
VERY EXPERIMENTAL, ONLY TESTED ON WINDOWS.
simple way to use is jut load it like using nomal texture
example : myobject.b3d
By default its looping infinitely, add this paramater in the same filepath as your video file.
Play once:
video.mp4?loop=no(or?loop=false/?loop=0)Loop forever (default):
video.mp4(orvideo.mp4?loop=inf)Loop few times (e.g. 3 times):
video.mp4?loop=3so its like:
Note:
libmpv-2.dllnext toTolk.dllvideotexture.csline 93 you set that line as comment to enable audio decoder.@leezer3 if you have time, may take a look?