- Home /
Movie Texture - lost first few seconds and long start up times
Ran into a really strange problem with movie textures.
I've got sorenson video 3, MPEG layer 3 quicktime mov (3 minutes long, 768x432pixels). It plays fine in Quicktime (win 7) but when imported into Unity the first 4 seconds are just black or cut off entirely (its hard to tell via the preview). It also takes a good few seconds to start playing.
Obviously i'm going to have to try using a different mov format, but just wondering if anyone else has had similar issues and what if any solutions were found?
Answer by Noise crime · Jul 21, 2010 at 08:09 PM
ok seem to have an answer for this.
For some reason playing an embedded movie in Unity suffers this problem, which appears to be more a case of a long delay, meaning the first few seconds are missed, rather than any codec issue.
Playing the same movie via WWW using a local file does not have this problem, it plays instantly, has no black frames and doesn't cut off the first few seconds.
My assumption is that when playing the embedded version it must be loading the entire movie or a considerable part of it into memory before playing. This means when it does start playing it has to skip forward a few seconds to be in sync.
I'd say this is a bit of abug as clearly WWW verison plays fine.
For reference I used the answer to this question.
Answer by alvaro-em · Jan 28, 2014 at 01:32 PM
Hi, Noisecrime.
I just followed your advice and it didn't solve the issue either.
This is my code:
IEnumerator LoadMovie()
{
string path = "file://"+Application.streamingAssetsPath+"/"+videoPath;
Debug.Log(path+": "+System.IO.File.Exists(path));
WWW w = new WWW(path);
while (!w.isDone)
yield return 0;
Debug.Log("Bytes: " + w.bytesDownloaded);
_videoManager.videoLeft = w.movie;
while (!_videoManager.videoLeft.isReadyToPlay) yield return 0;
Application.LoadLevel(1);
}
The video is then played in the new scene.
I am still facing the same issue, with a few seconds in the video fully black, while the audio plays ok.
Any other ideas on how to solve this?