So our application has 8 HD clips which gets created during setup (each about 7MB each) and it takes our application around 40 seconds (running at 760MB) to load. We attempted to call each video when we switch scenes in the update function - this made the load time much faster, but it crashes the following draw scenes.
Is there a best way to load movie files to help shorten this 40 second load time in the beginning?
Perhaps I may be wrong, but I suggest to try threaded video addon from https://github.com/gameoverhack/ofxThreadedVideo.
Another way will be doing a vector of videos (or a vetor of pointer better), and load in your setup. ANd use an int as index for the vector
All the videos will be loaded on setup, so latter you can change wich video using the index
indexVideo = 0;
I remember trying to do a similar thing in one of my first tests with an oF application where I had ~12 HD videos. At first, I put to test the approach to have all the videos at the same time on the screen (eg: 12 player instances on the screen put to pause at a certain frame for each video). Unsurprisingly, the approach was failing for me since I was basically pushing my entire system to the limit by trying to decode 12 videos on the fly. Probably the OP’s computer might be able to handle this but I would have suggested to try and approach the problem with other clever techniques.
In my case, instead of having all those instances of video players, I had a vector vector storing the path of the all the videos and instead drew images at the regions where earlier I was trying to draw video player textures. When the user would click on any one of those images (to play a video obviously), I would get the particular path of the video from the vector and play the video in a single player instance which gets destroyed after the video finishes. I did give a shot to ofxThreadedVideo addon as well for a brief time (which is used to load large videos in a separate thread and then just play them when required without facing any lags) and it seemed to work for me and was a more elegant solution. But, since I didn’t have not-so-large videos at that moment and wasn’t getting any lags with the former approach and since I was only playing with it to build an application, I ended up using the former back then.
In my case i need to be able to swicth between videos in any moment without any delay or glitch, if this is not need as others says problably its better/saffer the threaded aproach.
Thank you so much everyone for all of your inputs! I will try the ofxThreadedVideo approach tonight first and will repost