Open a video file from computer with OpenMV IDE

Hello everyone !
It’s my first time with machine vision and i wanted to start with OpenMV M7 !
In order to ease test and developpement of my project i would like to read a video file from my computer instead of the camera video, any idea ?
(PS : I tryed to import cv2 but it didn’t work)

The OpenMV Cam cannot read video files from the PC. The system is a microcontroller running MicroPython. While you can program it in Python you don’t have access to desktop python libraries. MicroPython is there to make it do whatever you need easy via a scripting language interface.

Anyway, what is your application? I’ll try to guide you on what you need to do.

Well i’m trying to pilote an adaptative driving beam depending on what is in front of a care. Since it’s a bit hard to develop and driving by night i would like to test the code on a video. I know we can play back a video we already saved, but i wanted to try on another video i get from internet before. Maybe i can put the video on the on micro sd card and play it ? I didn’t find a way to play a video witch is on sd card, is it possible ?

I see, to do this you’ll need me to create a converter in OpenMV IDE that allows you to turn a video into one of the RAW video capture files the OpenMV Cam can read. I have a converter for turning that into a normal video file but not the other way around.

This is a good feature request. Can you make a ticket for tracking this here and I’ll do it: Issues · openmv/openmv-ide · GitHub

No problemes !
Thank for your quick answer.

I wanted to thank you for your work to, that’s really a good project, you guys are doing a great job ! I wish the best for you guys.

Hello !
Thank you very much for the last update, as soon as i saw the video converter i tested it !

But i may have some trouble with the converter : my .wmv video use 14,5 Mo memory space while the .bin video converted using 2,5 Go !

Is this normal ?

Hi, the converter works by using FFMPEG to break the file up into a bunch of image stills and then I build up an OpenMV Cam video .bin file out of those stills. All timing information is stripped. So, the video will run very fast on the OpenMV Cam if you aren’t doing any processing.

Still, i didn’t get why the size of the video explode like this :confused:
Moreover i have an FB Overflow error when i launch the exemple code “”, i think my video resolution is to high for the hardware ?
Is the converter working better depending of witch kind of source file (mp4, wmv, etc) the video is ?

Edit : Changing the resolution to 160 width (qqvga) solve the “OSerror : FBOverflow”. I did it easily on a website. Maybe it is possible to adapt the video resolution with the converter you create on OpenMV IDE ? It will be awesome !

Ah, yeah, the res of the video is limited on the camera. Um, make a github issue on the IDE to support resolution changes with FFMPEG.