Sunday, April 23, 2023

How to suppress opencv / gst-launch-1.0 nvarguscamerasrc GST_ARGUS warning / debug messages

 Jetson camera library always prints debug information:




GST_ARGUS: Creating output stream

CONSUMER: Waiting until producer is connected...

GST_ARGUS: Available Sensor modes :

GST_ARGUS: 3264 x 2464 FR = 21.000000 fps Duration = 47619048 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 3264 x 1848 FR = 28.000001 fps Duration = 35714284 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1920 x 1080 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1640 x 1232 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 120.000005 fps Duration = 8333333 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: Running with following settings:

   Camera index = 0 

   Camera mode  = 2 

   Output Stream W = 1920 H = 1080 

   seconds to Run    = 0 

   Frame Rate = 29.999999 

GST_ARGUS: Setup Complete, Starting captures for 0 seconds

GST_ARGUS: Starting repeat capture requests.

CONSUMER: Producer has connected; continuing.


These prints are hardcoded in the source file of the camera module gstnvarguscamerasrc.cpp as explained here . The following commands can be used to disable these hardcoded messages and compile the module.

Find the corresponding version of your nvidia jetpack and download its public_sources file

cat /etc/nv_tegra_release

cd ~/src 

# for R32 (release), REVISION: 7.3 Driver Package (BSP) Sources:  https://developer.nvidia.com/embedded/linux-tegra-r3273

wget --trust-server-names https://developer.nvidia.com/downloads/remack-sdksjetpack-463r32releasev73sourcest210publicsourcestbz2

tar -jxvf public_sources.tbz2*

cd Linux_for_Tegra/source/public

tar -jxvf gst-nvarguscamera_src.tbz2

cd gst-nvarguscamera/

vi gstnvarguscamerasrc.cpp

// delete printf in the following lines:

#define GST_ARGUS_PRINT(...)

#define CONSUMER_PRINT(...)

make

sudo make install

You may also use the following line to disable opencv warnings. It is also best to restart nvargus-daemon service each time before using the camera:

import warnings

warnings.filterwarnings('ignore')

import sys, os

os.system("sudo systemctl restart nvargus-daemon")

os.environ["DISPLAY"] = ":0"

os.environ["OPENCV_LOG_LEVEL"] = "OFF"

This will allow you to run your script without any warning messages:



How to disable Debian 12 sleep on production servers

 Debian 12 has power saver enabled by default which causes your server to go to sleep if there is no mouse / keyboard interaction. To resolv...