PYNQ: PYTHON PRODUCTIVITY

Recording video in a fast manner

Hi guys,
I have a system where I have used CMOS sensor sending continuous images at 1080p 60FPS. The incoming stream is received through VDMA via video pipeline and later displays the image through DisplayPort. Everything is running well so far. The problem is when I want to record the video. The FPS dropped to less than 5 and I can assume PS processing is not enough to handle OpenCV videowriter.
Is there any other way, I could save the video at least 30 FPS. Any suggestion would be really appreciated. Thank you.

Mizan

Hi,

Where are you writing the image? SD card? This may be very slow.

1080p @ 30 FPS is ~ 1.5 Gbps (1920 x 1080 x 30 x 24). This means that you need storage capable of being written at least at that speed.

You can try to write to memory using ramgs or tmpfs. This may be fast enough.

https://www.thegeekstuff.com/2008/11/overview-of-ramfs-and-tmpfs-on-linux/

Be aware that these alternatives, are volatile storage. If you want to save the file, you will have to move it to permanent storage before powering off.

Mario

2 Likes

Hi Mario,
I suppose you are stating the uncompressed (raw) data writing. Obviously, it will take greater than 177MBps speed. I am considering an encoded version like FFmpeg or whatever is used in OpenCV videowriter as a default encoder.
I am using one of patriot’s USB drives which supports 180MBps, and I have tried it on my PC it goes up to 90MBps for writing. That’s is currently attached to my ZCU104 board running PYNQ 2.6.
As a side note, in my custom board, there will be around 6Gb of ram. If it could be somehow used to speed the process faster, let me know the process to do that in PYNQ, that will be helpful.

1 Like

I would suggest to start by profiling the full pipeline. Once you find the bottleneck you can try to accelerate the part that impacts the performance the most.

2 Likes

The video pipeline has no problem currently, though lens correction added latency of 10ms to the stream and another 2image(32ms) latency by vdma. The only problem is now with saving the video in a storage drive. For encoding, I wanted to use the VCU inside, as far as I know, there is no support for that in pynq right now. I have no slight idea how to do it my own. So, I had to use OpenCV videowriter. That’s how this post was made :slight_smile: .
Thanks.

1 Like