- Home /
WebCamTexture, correct resolution and RATIO.And FPS
Video acquisition via WebCamTexture is extremely slow (less than 3 FPS) in 1200*760 on a moto G2 Android one, which should be capable of better performances... Any idea guys to improve it? I'm under Unity 5.0.1. I've tried to play with different _requestedFPS but it didn't help.
After searching for a while, I've find different solutions
http://answers.unity3d.com/questions/555450/how-can-i-find-max-resolution-for-webcamtexture.html http://answers.unity3d.com/questions/773464/webcamtexture-correct-resolution-and-ratio.html http://forum.unity3d.com/threads/extremely-poor-webcamtexture-performances-under-android-in-high-resolution.221862/ Here is the little code I've used for testing:
public class CameraController : MonoBehaviour
{
public WebCamTexture mCamera = null;
public Transform plane;
void Start ()
{
mCamera = new WebCamTexture ( 1280,720,30);
plane.GetComponent<Renderer>().material.mainTexture=mCamera;
mCamera.Play ();
}
}
Answer by user_2015 · Apr 20, 2016 at 06:56 AM
I've ran into the same problem as you, before. For some reason, WebCamTexture has a very poor performance on Android, unless you use the default contructor:
mCamera = new WebCamTexture();
Thanks, this really helped. I didn't understand why the default constructor worked, but then I saw the video resolution was crappy. And indeed, problem was the resolution I was requesting in the constructor. I was using Screen.width and Screen.height, so I divided the values by 2 and now it runs really fast.