- Home /
I can't get my .mov or .mp4 to play in unity pro
Hello, I have tried to get a video to play in unity but can't seem to get it to work! The steps i took; put a .mov in my assets folder, that didn't convert to the unity video asset and would not drag onto a material as a texture put a .mp4 in my assets folder, that did convert to the unity video asset and would drag onto a material as a texture made a script.
public MovieTexture movTexture;
// Use this for initialization
void Start () {
renderer.material.mainTexture = movTexture;
movTexture.Play();
}
made a plane put the script on it and dragged the texture onto the variable in the editor; What am i doing wrong, i have watch/read a few tuts and followed everything i can find.
Important points; unity version 4.5.1f3 pro (free trial), using a .mp4 file currently, using c#.
Thanks
Are you on windows or $$anonymous$$acOS?
Because :
$$anonymous$$ovie Textures are not supported on iOS. Ins$$anonymous$$d, full-screen strea$$anonymous$$g playback is provided using Handheld.PlayFullScreen$$anonymous$$ovie.
see here
If you really need a texture there are some plugins in the asset store (not free)
I find that playing video is fussy with respect to codex, aspect ratio and the like, both with movie textures and with other methods of playing video (Handheld.PlayFullScreen$$anonymous$$ovie() or Prime31 plugin). I recommend you start by walking through a tutorial to make sure you have everything setup correctly. If so, you can then narrow the focus to figuring out the video format that works. A quick search yielded this tutorial:
$$anonymous$$aybe you can try Adoreshare i$$anonymous$$ovie Video Converter, I found this on Google and don't know if it works, you can try
Answer by Nerevar · Jul 08, 2014 at 04:03 PM
try the sample_sorenson.mov on this website, I followed the guidelines unity documentation provides and everything worked fine : )
1) make sure movie is imported correctly
2) create a plane (oriented toward camera, add some light in the scene)
3) attach the code you have (it works) to the plane
4) drag and drop the movie on your plane
5) reference the movie texture from inspector (assign it to your movie)
6) hit play
it should work :p
Tks Nerevar it's working for me, I now know that it was a format pb. But I don't know how to export a video with the good parameters. I have after effect and try H264 - mp4, $$anonymous$$ov / mp4 too and I still can't read the video in the editor ?
Answer by Wolfram · Sep 12, 2015 at 12:10 PM
Unity seems to have trouble with certain video files or file formats. One way is to use ffmpeg2theora to manually convert your videos into the format that Unity uses internally for MovieTextures (=.ogv).
One of the advantages: you can play them directly, without the need to import them in Unity or have them processed by Unity.
See here: http://answers.unity3d.com/questions/916921/video-intro-problem-post-unity-5.html
Answer by Johnhans93 · Aug 23, 2015 at 05:12 AM
Have you tried attaching another object like a cube?