Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by Happeloy · Jun 19, 2018 at 03:37 PM · webcamtexturewebcam

Set webcam image format to MJPG

Hi,

I have a webcam (Logitech C930e) that I want to use in a project (this will only run on a dedicated computer, with this exact webcam). I'm having some problems with the FPS. First of all, here's the script I'm running right now:

 using System;
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 
 public class WebcamHandler : MonoBehaviour {
 
     private WebCamTexture webCamTexture;
     public RawImage webcamView;
     public int selectedWebcam;
     public int requestedWebcamWidth, requestedWebcamHeight, 
     requestedWebcamFPS;
 
     void Start () {
         PrintAvailableWebcams();
         SetupWebcam();
     }
 
     private void SetupWebcam(){
         webCamTexture = new WebCamTexture(WebCamTexture.devices[selectedWebcam].name, requestedWebcamWidth, requestedWebcamHeight, requestedWebcamFPS);
         webCamTexture.Play();
         webcamView.texture = webCamTexture;
     }
 
     private void PrintAvailableWebcams(){
         WebCamDevice[] devices = WebCamTexture.devices;
         for (int i = 0; i < devices.Length; i++){
             Debug.Log("Webcam[" + i + "]: " + devices[i].name);
         }
     }
 
 }

It works, I get the live image from the webcam, but the FPS is stuck at 5 FPS, no matter what I enter as requested frame rate (even if I enter something lower, like 1 fps).

I downloaded the free version of AVPro Live Camera, just to see what's going on. And I notice that the webcam format is initialized as YUV_YUV2, and when I select a resolution of 1920x1080, the fps is stuck at 5. BUT, when I change the video format to MJPG, I can select an FPS of 30, and everything is running smoothly.

So, my question is, how would I change the format setting of a webcam, using Unity's built-in WebCamTexture? Is it possible? Seems a bit silly to pay the full price of AVPro Live camera (€179) just for this single setting.

Thank you!

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image abishekjreuben · Aug 29, 2019 at 03:53 AM 0
Share

I have the exact same issue with the same webcam. Did you manage to find any solutions.

avatar image urancle · Jan 09, 2020 at 10:25 AM 0
Share

i have the same issue with an Axis IP camera... any progress in this?

avatar image CabbageWarrior · Nov 24, 2020 at 03:25 PM 0
Share

Same problem right now with a Logitech C920 Pro. Trying to find a solution.

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

143 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

WebCamTexture nullpointerexception 1 Answer

Priview The Screenshot for User 0 Answers

Webcam on Multiple Objects 2 Answers

Unity webcam trouble 0 Answers

4K - WebCameTexture.Play() Could not connect pins - RenderStream() 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges