jevois / jevoisbase

JeVois base collection of algorithms and modules
Other
42 stars 30 forks source link

SaveVideo VGA Resolution #10

Open Duisterhof opened 2 years ago

Duisterhof commented 2 years ago

Hello!

I am trying to record video with the A33 JeVois camera with the SaveVideo module, but am running into an issue while trying to record video at VGA resolution with the following command:

jevois-cmd setmapping2 YUYV 640 480 30.0 JeVois SaveVideo

When stopping the recording using the following command: jevois-cmd streamoff I am getting the following error: Traceback (most recent call last): File "<string>", line 2, in <module> File "/usr/local/lib/python2.7/dist-packages/pyserial-3.5-py2.7.egg/serial/serialutil.py", line 244, in __init__ self.open() File "/usr/local/lib/python2.7/dist-packages/pyserial-3.5-py2.7.egg/serial/serialposix.py", line 332, in open self._reconfigure_port(force_update=True) File "/usr/local/lib/python2.7/dist-packages/pyserial-3.5-py2.7.egg/serial/serialposix.py", line 401, in _reconfigure_port raise SerialException("Could not configure port: {}".format(msg)) serial.serialutil.SerialException: Could not configure port: (5, 'Input/output error') I do find a short clip of the first 5 seconds on the SD card, but it's not complete. Some info about the software running on the camera:

INFO: JeVois 1.15.0 INFO: Linux version 3.4.39

Recording 320 x 240 at 30 fps seems to work flawlessly. I would appreciate any help, thank you!

jevois commented 2 years ago

Likely your microSD card cannot sustain the amount of data written which may cause the camera to eventually run out of memory as it buffers frames and crash. You could try two things: get a very fast microSD card with sustained write speeds above 25 Mbytes/s (e.g., rated V30, V60, V90), or play with the video encoding codec to try to compress more but without exceeding what the CPU can do:

see

https://docs.opencv.org/4.5.5/dd/d9e/classcv_1_1VideoWriter.html#ac3478f6257454209fa99249cc03a5c59

and try different values for the fourcc code of cv::VideoWriter. Unfortunately, there is no official list of what OpenCV supports, so it's trial and error. ffmpeg is installed on jevois so any of the ffmpeg codecs should work. Tested codecs on JeVois include: MJPG, MP4V, AVC1. Make sure you also pick the right filename extension (e.g., .avi for MJPG, .mp4 for MP4V, etc)

so, for example, before you streamon:

jevois-cmd setpar fourcc MP4V jevois-cmd setpar filename video%06d.mp4

Duisterhof commented 2 years ago

Thank you for your reply! That makes sense, mp4 didn't work either, so maybe a faster sd card would be the easiest solution.

Another question: is there a recommended way to power the jevois without USB cable? My robot has a 5V output, I would like to save some weight by removing the connector. I looked at the schematics of the camera but couldn't find a solution so far.