I noticed that this stream will only run for a few hours since the memory is slowly filling up.
At a certain moment the OOM becomes activated and kills the vlc process:
Jan 21 06:43:31 raspberrypi kernel: [26493.401437] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/,task=vlc,pid=450,uid=0
Jan 21 06:43:31 raspberrypi kernel: [26493.401554] Out of memory: Killed process 450 (vlc) total-vm:99032kB, anon-rss:0kB, file-rss:0kB, shmem-rss:0kB, UID:0 pgtables:78kB oom_score_adj:0
Jan 21 06:43:31 raspberrypi kernel: [26493.432645] oom_reaper: reaped process 450 (vlc), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
My question is how I can prevent this from happening? Is there a better way to stream libcamera-vid stream into rtsp so I can receive it on my Synology Surveillance station?
Ok thanks for the suggestion, I started that 4 hours ago. This is the result. First thuis is what I get if I start the command you suggested:
pi@raspberrypi:~ $ /usr/local/bin/libcamera-vid -t 0 -n --inline --framerate 25 --width 640 --height 480 -o /dev/null
[0:01:24.931432831] [645] INFO Camera camera_manager.cpp:293 libcamera v0.0.0
[0:01:24.947840956] [649] WARN CameraSensor camera_sensor.cpp:197 ‘arducam-pivariety 10-000c’: Recommended V4L2 control 0x009a0922 not supported
[0:01:24.967335800] [649] WARN CameraSensor camera_sensor.cpp:249 ‘arducam-pivariety 10-000c’: The sensor kernel driver needs to be fixed
[0:01:24.967484133] [649] WARN CameraSensor camera_sensor.cpp:251 ‘arducam-pivariety 10-000c’: See Documentation/sensor_driver_requirements.rst in the libcamera s ources for more information
[0:01:24.979573091] [649] WARN CameraSensorProperties camera_sensor_properties.cpp:141 No static properties available for ‘arducam-pivariety’
[0:01:24.979763664] [649] WARN CameraSensorProperties camera_sensor_properties.cpp:143 Please consider updating the camera sensor properties database
[0:01:24.979891997] [649] WARN CameraSensor camera_sensor.cpp:414 ‘arducam-pivariety 10-000c’: Failed to retrieve the camera location
[0:01:25.453759810] [649] ERROR IPAProxy ipa_proxy.cpp:149 Configuration file ‘arducam-pivariety.json’ not found for IPA module ‘raspberrypi’
[0:01:25.865176997] [649] ERROR DelayedControls delayed_controls.cpp:87 Delay request for control id 0x009a090a but control is not exposed by device /dev/video0
[0:01:25.876318976] [645] INFO Camera camera.cpp:937 configuring streams: (0) 640x480-YUV420
[0:01:25.877951424] [649] INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt RG10 Score: 2136.67 (best 2136.67)
[0:01:25.878231216] [649] INFO RPI raspberrypi.cpp:122 Mode: 1920x1080 fmt pRAA Score: 1636.67 (best 1636.67)
[0:01:25.955287153] [649] INFO RPI raspberrypi.cpp:624 Sensor: /base/soc/i2c0mux/i2c@1/arducam@0c - Selected mode: 1920x1080-pRAA
[0:01:26.016309028] [653] INFO IPARPI raspberrypi.cpp:654 Request ctrl: Sharpness = 1.000000
[0:01:26.016970903] [653] INFO IPARPI raspberrypi.cpp:654 Request ctrl: Saturation = 1.000000
[0:01:26.017327726] [653] INFO IPARPI raspberrypi.cpp:654 Request ctrl: Contrast = 1.000000
[0:01:26.017644185] [653] INFO IPARPI raspberrypi.cpp:654 Request ctrl: Brightness = 0.000000
[0:01:26.017931216] [653] INFO IPARPI raspberrypi.cpp:654 Request ctrl: FrameDurationLimits = [ 40000, 40000 ]
[0:01:26.018351112] [653] INFO IPARPI raspberrypi.cpp:654 Request ctrl: NoiseReductionMode = 1
[0:01:26.018855122] [653] INFO IPARPI raspberrypi.cpp:654 Request ctrl: AeMeteringMode = 0
[0:01:26.019403143] [653] INFO IPARPI raspberrypi.cpp:654 Request ctrl: AeExposureMode = 0
[0:01:26.019719237] [653] INFO IPARPI raspberrypi.cpp:654 Request ctrl: ExposureValue = 0.000000
[0:01:26.020130747] [653] INFO IPARPI raspberrypi.cpp:654 Request ctrl: AwbMode = 0
[0:01:26.029171997] [649] INFO RPISTREAM rpi_stream.cpp:122 No buffers available for ISP Output0
[0:01:26.029310955] [649] INFO RPISTREAM rpi_stream.cpp:122 No buffers available for ISP Output0
[0:01:26.489383507] [649] INFO RPI raspberrypi.cpp:1732 Dropping frame at the request of the IPA (7 left)
[0:01:26.522529080] [649] INFO RPI raspberrypi.cpp:1732 Dropping frame at the request of the IPA (6 left)
[0:01:26.560109914] [649] INFO RPI raspberrypi.cpp:1732 Dropping frame at the request of the IPA (5 left)
[0:01:26.595718664] [649] INFO RPI raspberrypi.cpp:1732 Dropping frame at the request of the IPA (4 left)
[0:01:26.629947726] [649] INFO RPI raspberrypi.cpp:1732 Dropping frame at the request of the IPA (3 left)
[0:01:26.665778351] [649] INFO RPI raspberrypi.cpp:1732 Dropping frame at the request of the IPA (2 left)
[0:01:26.699376372] [649] INFO RPI raspberrypi.cpp:1732 Dropping frame at the request of the IPA (1 left)
[0:01:26.732945747] [649] INFO RPI raspberrypi.cpp:1732 Dropping frame at the request of the IPA (0 left)
Then I did a free -m command after I started it:
free -m
total used free shared buff/cache available
Mem: 428 98 166 3 163 277
Swap: 99 0 99
Now after 4 hours:
pi@raspberrypi:~ $ free -m
total used free shared buff/cache available
Mem: 428 171 93 3 164 204
Swap: 99 0 99
As you can see the amount of free memory has decreased already significantly in 4 hours.
I did not start any other processes in between, just let it run.
Thanks Wong, maybe it’s a problem specific for the Rasppberry PI model 3A+?
It only has 512MB memory while the 3B+has 1GB.
Are there any other people maybe using the IMX462 on a RPI 3A+?
BTW I’m running the recommended OS version:
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.10.17-v7+ #1403 SMP Mon Feb 22 11:29:51 GMT 2021 armv7l GNU/Linux
We tested it on Pi4 for about 14 hours,
The free memory has changed from 432 to 351. I plan to upgrade libcamera to the new version first and run the test again.
thanks for the first feedback. Good to see you also see a gradually increase of memory usage over time. Since PI4 has larger memory it will take longer but most likely at some point you will face the same issue as I saw on the RPI Model 3A+. Appreciate if you could try the latest version and could share your findings.