This module records video and saves it to the MicroSD card inside the JeVois smart camera. It is useful, for example, to record footage that will be used to train some machine vision algorithm.
Issue the command start
over the command-line interface to start saving video frames, and stop
to stop saving. Successive start/stop commands will increment the file number (d argument in the filename
parameter. Before a file is written, the module checks whether it already exists, and, if so, skips over it by incrementing the file number. See Command-line interface user guide for details on how to use the command-line interface.
This module works with any video resolution and pixel format supported by the camera sensor. Thus, additional video mappings are possible beyond the ones listed here.
See Advanced topic: Image pixel formats for information about pixel formats; with this module you can use the formats supported by the camera sensor.
This module accepts any resolution supported by the JeVois camera sensor.
This module can operate both with USB/GUI video output, or no USB video output.
When using with no USB/GUI output (NONE output format), you should first issue a streamon
command to start video streaming by the camera sensor chip, then issue a start
when you are ready to start recording. The streamon
is not necessary when using a video mapping with USB video output, as the host computer over USB triggers video streaming when it starts grabbing frames from the JeVois camera.
This module internally uses the OpenCV VideoWriter class to compress and write the video file. See the OpenCV documentation for which video formats are supported.
You should be aware of two things when attempting video recording at high frame rates:
- If using a video mapping with USB output, the frame rate may be limited by the maximum rate at which the host computer can grab and display. On many host computers, for example, the display refresh rate might be 60Hz. Using a video capture software on these computers is likely going to limit the maximum display rate to 60 frames/s and that will in turn limit the capture and saving rate. This is not an issue when using a video mapping with no USB output.
- The
fps
parameter should be set to the rate at which you want to save video. If you capture at 60 frames/s according to your video mapping but fps
is set to 30, saving will be at 30 fps. This limitation of rate is done internally by the OpenCV VideoWriter. So just make sure that you set the fps
parameter to the rate at which you want to save.
Note that this module may suffer from DMA coherency artifacts if the camturbo
parameter of the jevois::Engine is turned on, which it is by default. The camturbo
parameter relaxes some of the cache coherency constraints on the video buffers captured by the camera sensor, which allows the JeVois processor to access video pixel data from memory faster. But with modules that do not do much processing, sometimes this yields video artifacts, we presume because some of the video data from previous frames still is in the CPU cache and hence is not again fetched from main memory by the CPU. If you see short stripes of what appears to be wrong pixel colors in the video, try to disable camturbo:
edit JEVOIS:/config/params.cfg on your MicroSD card and in there turn camturbo
to false.
Example use
Connect to the JeVois command-line interface (see Command-line interface user guide), and issue
setmapping2 YUYV 640 480 30.0 JeVois SaveVideo
streamon
start
and you will be saving compressed video with 640x480 at 30fps to your microSD card inside JeVois. When you are done, just issue:
stop
and the video file will be finalized and closed. If you want to access it directly by exporting the microSD inside JeVois as a virtual USB flash drive, issue (with JeVois v1.3 and later):
streamoff
to stop camera sensor streaming, and
usbsd
to export the microSD as a virtual USB flash drive. The video file(s) will be in the JEVOIS:/data/savevideo/ folder. You can then use the recorded video to test and debug a new algorithm using your host computer, by running jevois-daemon
on the host computer with a video file input as opposed to a live camera input, as follows:
jevois-daemon --cameradev=myvideo.avi --videomapping=num
where you replace num above by the video mapping you want to use. See The jevois-daemon executable for more info about the cameradev
parameter.