# how use python code read video, not use openide

**URL:** <https://forums.openmv.io/t/how-use-python-code-read-video-not-use-openide/1466>\
**Category:** OpenMV Boards\
**Created:** [November 6, 2019, 10:43am UTC](https://forums.openmv.io/t/how-use-python-code-read-video-not-use-openide/1466 "2019-11-06T10:43:29Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![dotzhang](https://avatars.discourse-cdn.com/v4/letter/d/9de0a6/32.png) [@dotzhang](https://forums.openmv.io/u/dotzhang)\
**Post date:** [November 6, 2019, 10:43am UTC](https://forums.openmv.io/t/how-use-python-code-read-video-not-use-openide/1466/1 "2019-11-06T10:43:29Z")

</div>

I try use python opencv read video, but fail, i only read mac camera, not read openmv video.  
python code:

> import cv2
> 
> # i try parameters use 0,1,2,3,4,5, but only 0 is available
> 
> video = cv2.VideoCapture(0)  
> test = video.isOpened()
> 
> # cv2.VideoCapture(0) output true, this is mac computer camera
> 
> # cv2.VideoCapture(1) output false
> 
> # cv2.VideoCapture(2) output false
> 
> print(test)

In OPENMV IDE, the camera is success, now i want use python read video, then show web pages. can this be done? What are some ways to use python read video? thanks.

---

<div class="post-metadata">

**Author:** ![iabdalkader](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/iabdalkader/32/1169_2.png) [@iabdalkader](https://forums.openmv.io/u/iabdalkader)\
**Post date:** [November 6, 2019, 3:58pm UTC](https://forums.openmv.io/t/how-use-python-code-read-video-not-use-openide/1466/2 "2019-11-06T15:58:52Z")

</div>

Yes you can use the UVC firmware. Just keep in mind OpenMV is not meant to be used as a webcam.

---

<div class="post-metadata">

**Author:** ![dotzhang](https://avatars.discourse-cdn.com/v4/letter/d/9de0a6/32.png) [@dotzhang](https://forums.openmv.io/u/dotzhang)\
**Post date:** [November 10, 2019, 12:57am UTC](https://forums.openmv.io/t/how-use-python-code-read-video-not-use-openide/1466/3 "2019-11-10T00:57:25Z")

</div>

> [@](#):
>
> Yes you can use the UVC firmware. Just keep in mind OpenMV is not meant to be used as a webcam.

If use the UVC firmware, this need modify openmv sourcecode ? Now, i already try use python uvc fireware read video, but always not find the camera, I was used cv2 read.  
can you have through uvc read video example python code? thanks you very much.

---

<div class="post-metadata">

**Author:** ![iabdalkader](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/iabdalkader/32/1169_2.png) [@iabdalkader](https://forums.openmv.io/u/iabdalkader)\
**Post date:** [November 11, 2019, 11:22pm UTC](https://forums.openmv.io/t/how-use-python-code-read-video-not-use-openide/1466/4 "2019-11-11T23:22:47Z")

</div>

> [@](#):
>
> If use the UVC firmware, this need modify openmv sourcecode ? Now, i already try use python uvc fireware read video, but always not find the camera, I was used cv2 read.  
> can you have through uvc read video example python code? thanks you very much.

The UVC firmware is included in the IDE firmware folder, you just need to upload that instead and you don’t need to modify source code. The camera will work like a webcam, you can use cv2 to read it. Note if you upload the UVC firmware the camera will no longer work with the IDE and it will not run Python it will just look like a webcam.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [November 11, 2019, 11:26pm UTC](https://forums.openmv.io/t/how-use-python-code-read-video-not-use-openide/1466/5 "2019-11-11T23:26:00Z")

</div>

A note, the bootloader will still be on the camera so you can still easily restore the normal firmware.

The UVC firmware is under /share/qtcreator/firmware/OPENMV4/uvc.bin

Use the Tools-\>Run bootloader dialog to reflash the camera.

---

<div class="post-metadata">

**Author:** ![supported](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@supported](https://forums.openmv.io/u/supported)\
**Post date:** [March 19, 2020, 4:31am UTC](https://forums.openmv.io/t/how-use-python-code-read-video-not-use-openide/1466/6 "2020-03-19T04:31:00Z")

</div>

There seems to be an issue with UVC firmware and macOS I can not get it to connect to camera in opencv. I have confirmed OPENMV4 is working as UVC device as it shows up in system profiler under cameras as

OpenMV Virtual Comm Port in FS Mode #2:

Model ID: UVC Camera VendorID\_4617 ProductID\_43985  
Unique ID: 0x141300001209abd1  
  
  
Also lsusb  
Bus 020 Device 005: ID 1209:abd1 1209 OpenMV UVC in FS Mode Serial: 000000000011

I tried various programs to see if it is working as webcam such as Quick Time Player, Photo Booth and Plugable digital view. While all show the camera as an options none can connect to it.

I am using the Lepton 3 sensor which works fine with the normal firmware. I am currently using pyopenmv.py and normal firmware to get around this issue but it would be good to get UVC options working.

---

<div class="post-metadata">

**Author:** ![kwagyeman](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/kwagyeman/32/4_2.png) [@kwagyeman](https://forums.openmv.io/u/kwagyeman)\
**Post date:** [March 19, 2020, 4:16pm UTC](https://forums.openmv.io/t/how-use-python-code-read-video-not-use-openide/1466/7 "2020-03-19T16:16:22Z")

</div>

Hi, this is an Ibrahim question. Note that the UVC firmware isn’t really that supported. We did it because a customer thought it would be a cool idea. However, UVC doesn’t have a JPEG stream option so it’s hard to send lots of data over USB with it.

---

<div class="post-metadata">

**Author:** ![iabdalkader](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.openmv.io/iabdalkader/32/1169_2.png) [@iabdalkader](https://forums.openmv.io/u/iabdalkader)\
**Post date:** [March 19, 2020, 5:27pm UTC](https://forums.openmv.io/t/how-use-python-code-read-video-not-use-openide/1466/8 "2020-03-19T17:27:49Z")

</div>

> [@](#):
>
> There seems to be an issue with UVC firmware and macOS I can not get it to connect to camera in opencv. I have confirmed OPENMV4 is working as UVC device as it shows up in system profiler under cameras as
> 
> OpenMV Virtual Comm Port in FS Mode #2:
> 
> Model ID: UVC Camera VendorID\_4617 ProductID\_43985  
> Unique ID: 0x141300001209abd1  
>   
>   
> Also lsusb  
> Bus 020 Device 005: ID 1209:abd1 1209 OpenMV UVC in FS Mode Serial: 000000000011
> 
> I tried various programs to see if it is working as webcam such as Quick Time Player, Photo Booth and Plugable digital view. While all show the camera as an options none can connect to it.

Some programs show two UVC devices you have to try each one. Note this hasn’t been tested on MacOS it’s only known to work on Linux with guvcview.
