Raspberry Pi NoIR camera image brightness changes at about 2Hz

I am streaming video from my NoIR Raspberry Pi camera and notice that sometimes the image starts flashing at about 2Hz. What seems to be happening is that the brightness is changing.

I have a sample video. You can see that after I move the camera, it stops flashing. What is going on? How do I stop this?

This is the command line I use:

gst-launch-1.0 -v nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)NV12, framerate=(fraction)30/1' ! nvvidconv ! nvv4l2h264enc insert-sps-pps=1 maxperf-enable=1 ! h264parse ! rtph264pay pt=96 mtu=1500 ! udpsink host=10.0.0.12 port=5000 sync=false async=false

Thank you.

Try to configure the gain/exposure to try. You can use argus_camera to set them from the GUI

Thanks

1 Like

You may try to rule out what comes from camera and what comes from encoding.
Do you see the same on local monitor not encoding ?

gst-launch-1.0 -v nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)NV12, framerate=(fraction)30/1' ! autovideosink

Or if no local display and remotely connected with ssh enabling X11 forwarding (-X or -Y):

gst-launch-1.0 -v nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)NV12, framerate=(fraction)30/1' ! nvvidconv ! xvimagesink

If not, the issue may be in encoding, in such case you may adjust bitrate and other encoding parameters.
Be also sure the issue is not in the player itself (you may try some other ones).

1 Like

I tried setting these and had these results:

exposurecompensation (when set to 1, flashing is less likely, when set to 2 it takes a while to adjust to changes in brightness)
aelock=true - just looked too white but no flashing
ispdigitalgainrange="1 1" - still flashing
awblock=true - still flashing
ee-mode=0 (off) - still flashing
aeantibanding=0 (off) - still flashing

I believe the issue is with the auto exposure PID control loop that has too high a P term (or too low D) which causes overshoot when the camera goes from low to high brightness.

Thanks for this. I tried it but the flashing still occurs. I used this command line (low resolution because of the low WiFi bandwidth):

gst-launch-1.0 -v nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=(int)320, height=(int)180, format=(string)NV12, framerate=(fraction)30/1' ! nvvidconv ! xvimagesink

To clarify my previous post, the issue is not the change from very bright to very dark. The issue is when you go from a “little bit” dark to a “little bit” lighter.

IMO the control loop of the camera ISP auto exposure is not working well and needs adjustment.

Limit the gainrange/exposuretimerange to narrow which one cause the issue.

gst-launch-1.0 -v nvarguscamerasrc gainrange="16, 16" ! 'video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)NV12, framerate=(fraction)30/1' ! autovideosink

gst-launch-1.0 -v nvarguscamerasrc exposuretimerange="358733000 358733000" ! 'video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)NV12, framerate=(fraction)30/1' ! autovideosink

I have not had a chance to test this yet but will next week.

I finally tested this. Apologies for the delay, I was on holiday.

With BOTH of the examples you give, I see the flashing problem. :-(

It does not always occur, and it is dependent on the brightness of the scene that the camera is viewing, but when it does occur it takes at least 5 seconds to disappear. Very annoying.

Both of two commands are the same?

If I run your first command, I see flashing.
If I run your second command, I see flashing.

Could try below command again.

gst-launch-1.0 -v nvarguscamerasrc gainrange="16, 16" exposuretimerange="358733000 358733000" ! 'video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)NV12, framerate=(fraction)30/1' ! autovideosink

Just tried this and in fact it makes it worse. I would say it flashes twice as frequently as just using one of those nvarguscamerasrc parameters.

Could you use argsu_camera to try on/off the anti banding and if the gain/exposure range limit as above still the same then the problem could be the sensor source instead of ISP problem.

I still get the problem with anti banding set to 0 and 3 so it must be the sensor then. I’ll just have to live with it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.