I'm trying to get some large (1-2 minutes at 1920x1080 resolution) movies to work, and I'm having problems no matter what I try. I'm using Unity Pro.
In both cases I'm using a GUITexture object with an attached script to handle the actual movie playing. The GUITexture is setup to display the texture fullscreen.
The first method I attempted was to simply import the movies into Unity like regular assets, provide the references to the movies on the movie playing script, and simply select which texture to use. The script looked something like this:
This technically works, but there's a problem. The movie doesn't actually start playing when I call Play(). It seems like the movie doesn't properly get loaded until Play is called, and there's a huge delay. This wouldn't be a problem except that once the movie does start playing, it automatically syncs up to where it should be, cutting off the beginning few seconds of the clips.
I've tried various methods to wait until the video is actually ready to play, but nothing works. It seems like the delay is inevitable using this method.
So onto method 2: using the WWW class. My code for that is as follows:
At first it seemed the second method didn't work at all. But then I tried using the sample video provided by Unity (http://www.unity3d.com/webplayers/Movie/sample.ogg), and it worked. So now I realize that the code works, but for some reason the movies I'm encoding don't work in Unity, though they work outside of Unity just fine.
I used ffmpeg2theora as recommended in a different post, and I've also tried using Miro Video Converter (which is just using ffmpeg2theora under the hood I think), to no avail. The videos work just fine outside of Unity, but when I try to load them using the WWW class as above, they "load" immediately but have a duration of -1 seconds. They take no time to play and the code basically immediately finishes.
I've been scouring the forums, and I feel like I've already tried everything I can to get this working in an ideal way. At the moment I'm quite disappointed in getting a Pro license for the movie support. Any thoughts?
I am having the same problem. Right now I'm troubleshooting by adding a second and a half to the beginning of my video. I noticed if you don't start playing the audio, it does not delay at all. Give it a shot.
answered Jun 26 '12 at 02:49 AM