I want to play a 1 second full hd video in editor or windows build, but the video lags or freezes.
I tried render to texture or camera near plane, both had the same result.
I don’t know why it’s happing, no log information is reported. It just freezes for a while and if I set to loop it loops just half of the video and freezes the other half.
Unity 2018.1.0f2, Windows 10, Video codec h264.
Are you calling Prepare?
I’m having similar video lag/freezing issues. Prepare definitely helped. My videos lag 20-30 seconds in. ![]()
I tried Prepare() and when I play it, “isPrepared” is true, but the problem persists.
Try codec h264 (as you are doing right now), Main or Baseline - Lvl3, container mp4. (I use HandBrake or Compressor on Mac). Do one test with Main and other with Baseline. use 3.0 or 3.1 tops.
I know you’re using Full HD (1080p) but testing on HD (720p) won’t hurt (just to see if resolution is the problem).
Another thing: You don’t say what methond are you using (Direct, Material Override). For example: I use to play videos using a plane with material Override in my project. I’m using right know 2017.4.2 (will try to update next week to 2018). I don’t use Transcode at all because it breaks my the video quality (that’s normal).
Hope that helps!!!
¿? I don’t know if I get it. You can’t play the clip in Windows Media Player (or any player outside Unity)? If that’s the case, then the problem is in the video itself. Maybe the video resolution or the framerate.
You can use MediaInfo program to see all the video data.
Thanks for your help!
I tested with HD and followed your instruction for the codec on HandBrake. It got better, but still not a reliable video playblack. The video plays fine for half second, then it freezes on a random frame, but the internal counter seems to still working and it triggers the “loopPointReached” event. I using this event to hide the movie clip. So it gets pretty random result.
I’m using Camera Near Plane (which is the most convenient way for me) and I have tried RenderTexture with the same result. I will try Material Override.
In Handbreak, what framerate do you use? Video Quality? Optimize Video preset?
Thanks!
I have encounter that problem using Easy Movie Texture in my tests (loopPointReached). I think it has to do with some specific information data inside the clip but I haven’t locate where the error is yet. But using the Unity’s videoplayer everything work fine for me (not using transcode).
Try Material Override over a plane just to see if anything changes. I tried using camera near with no problem at all.
Try another videoclip too, download anything just for testing (there is the famous fat video rabbit aroiund there).
I use HD videos (1920x1080 o 1280x720) on Windows 10 StandAlone. I tried using even 1024x1024 or 512x512 videos and it works fine.
Framerate: I didn’t notice nothing strange using diffrerent framerates on windows (60, 30, 29.97, 25). Everything is OK.
In handbrake I use:
Codec : H264
Framerate: 30 (almost always)
Encoder profile: Baseline
Encoder Level : 3.0
Quality: Constant Quality: 20 or 24
I use always the “mp4” container.
Another thing you can try is to test using a NO Audio videoclip (just clear the audio tracks in handbrake). So you can see if there is any kind of audio problem.