USB Camera writing to drive crash g-streamer due to out of memory

I have an issue related to writing images to disk at 3x60fps. Writing works well at that speed but the gst-launch crash after 195’261 images. But the fps is good up till then…

Any idea why? I thought first it was memory buffer growing so I removed the queue. But it still crash. All three stop at the same time:

0:18:08.450914600 78400 0xaaaae9a82a40 ERROR               fdmemory gstfdmemory.c:126:gst_fd_mem_map: 0xffff880181e0: fd 42: mmap failed: Cannot allocate memory
0:18:08.450971465 78400 0xaaaae9a82a40 ERROR               fdmemory gstfdmemory.c:126:gst_fd_mem_map: 0xffff880181e0: fd 42: mmap failed: Cannot allocate memory
0:18:08.450983817 78400 0xaaaae9a82a40 ERROR              nvvidconv gstnvvconv.c:3353:gst_nvvconv_transform: input buffer mapinfo failed
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason error (-5)
EOS on shutdown enabled -- waiting for EOS after Error
Waiting for EOS...
Got EOS from element "pipeline0".
EOS received - stopping pipeline...
Execution ended after 0:18:08.234331135
Setting pipeline to NULL ...
Freeing pipeline ...

Is this the fix?

And how do I upgrade without having to re-flash the whole drive? It is a “sh¤#%&¤#” to install deepstream with all the dependencies…

Please share the command(s). We will set up and check.

These are the commands I run in each terminal window. I have three.

v4l2-ctl -d 2 -c exposure_absolute=20

gst-launch-1.0 v4l2src device=/dev/video2 ! 'video/x-raw , width=(int)1280 , height=(int)720 , format=(string)GRAY8 , framerate=(fraction)60/1' ! nvvidconv ! 'video/x-raw(memory:NVMM),width=(int)1280,  height=(int)720, format=I420' ! nvjpegenc ! multifilesink location='/mnt/M2Disk/Images/ID1_Image01_1%09d.jpg' -ev

For Information
I purchased one more AGX Orin 64GB with jetpack 5.1.2 installed. I then ran the installation of Jetpack tools for deepstream support.
When now running on the new Jetson to a 4TB M2SSD I get full FPS on all three cameras.
So its would seem that the Jetpack upgrade from 5.1.1 to 5.1.2 would do the trick.

It is a bit problematic though since the first one has deepstream and yolov8 working and it was really hard to make all the dependencies right. I hope I can get that working and then I can flash the first one. Unless you have an idea on how to fx it on the first.

We try the command on AGX Xavier developer kit/Jetpack 5.1.2 and do not observe the issue:

$ gst-launch-1.0 videotestsrc is-live=1 ! 'video/x-raw,width=(int)1280,height=(int)720,format=(string)GRAY8,framerate=(fraction)60/1' ! nvvidconv ! 'video/x-raw(memory:NVMM),width=(int)1280,height=(int)720,format=I420' ! nvjpegenc ! multifilesink location='/tmp/ID1_Image01_1%09d.jpg' max-files=100 -ev

The memory of the process in top command looks stable and does not increase. Could you give it a try? If you also don’t hit the issue, videotestsrc may be fine and the issue is specific to using v4l2src.


I have tried this in two installed systems with Jetpack 5.1.2 and it works. Seems to do the trick. 5.1.1 seems to have a bug of some sort.

Thanks for the support!

I would encourage you to write complete installation instructions for flashing and installing JP and deepstream. The official instructions lack a lot of steps and goes back and forth. Its impossible to follow. I know it should be covering a lot but one guideline that actually works step by step from start to end would be good.

I think you have installation issues flashing JP6 with 22.04. I got a system that didnt even start…

1 Like