Mjpeg files corrupted


I’ve been trying to use the mjpeg library to create and save recordings of my OpenMV Cam H7. However, nearly every time I attempt to try this, the resulting mjpeg file is always corrupt (or just unplayable). I have had few successes, and each of these times I have had my OpenMV cam plugged into my computer. When I attempt to run the camera independently (with an Arduino power source, either 5 V or 3.3 V to VIN and ground connected to GND), it has never resulted in an uncorrupt mjpeg file.

I’m not going to include any relevant code because the same issue seems to persist even for the example “mjpeg.py” script. Are there any general reasons this might be happening?


Hi, it’s because the file is not closed on being saved. Unless the file is closed then it’s corrupted.

I will be updating this method later this year to include MJPEG reading and a flush method soon so you can ensure the file is in a usable state without having to close it.

Thanks for the response - if this is the case, how can I close the file on save myself? And to clear up some of my confusion, is what you are referring to different than the .close(fps) method?

It’s just that close method right now.