Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Low lighting leads to low fps when recording video

I am writing an application which has a video recording feature. During normal day-light hours with lots of light I am able to get 30fps video to record.

However, when there is less light, the frame rate drops to around 7.5fps (with exactly the same code). My guess would be that android is doing something behind the scenes with the exposure time to ensure that the resulting video has the best image quality.

I, however, would prefer a higher fps to a better quality image. Assuming exposure is the issue, is there any way to control the exposure time to ensure a decent fps (15fps+). There are the functions setExposureCompensation() and setAutoExposureLock() but they seem to do nothing.

Has anyone had this issue before? Is it even exposure that is causing my issue?

Any hits/suggestions would be great.

like image 238
Cheetah Avatar asked Aug 23 '12 20:08

Cheetah


3 Answers

I am sorry but the accepted answer is totally wrong. In fact I have created an account just to correct this.

Noise information gets discarded depending on the bitrate anyway, I do not understand why someone would think that this would be an extra load on cpu at all.

In fact, video framerate on a mobile device has a lot to do with light exposure. In a low light situation, exposure is increased automatically, which also means the shutter will stay open longer to let more light in. Which will reduce the number of frames you can capture in a second, and add some motion blur on top. With a DSLR camera you could change your aperture for more light, without touching the shutter speeds, but on mobile devices your aperture is fixed.

You could mess with exposure compensation to get more fps, but I do not think super dark video is what you want.


More information; https://anyline.com/news/low-end-android-devices-exposure-triangle/

like image 61
Murat Erdem Avatar answered Oct 12 '22 09:10

Murat Erdem


There is a simple explanation here. The lower light means there is more noise in the video. With more noise the encoding engine has to put far more effort to get the compression it needs. Unless the encoder has a denoiser the encoding engine has far more noise to deal with than normal conditions.

If you want a more technical answer: More noise means that the motion-estimation engine of the encoder is thrown for a toss. This is the part that consumes maximum CPU cycles. The more the noise, the worse the compression and hence even other parts of the encoder are basically crunching more. More bits are generated which means that the encoding and entropy engines are also crunching more and hence the worse performance.

Generally in high end cameras a lot of noise is removed by the imaging pipeline in the sensor. However don't expect that in a mobile phone sensor. [This is the ISO performance that you see in DSLRs ].

like image 43
av501 Avatar answered Oct 12 '22 10:10

av501


I had this issue with Android 4.2 Galaxy S III. After experimenting with parameters found one call which started to work.

Look on Camera.Parameters, if you print them out, you'll see:

preview-fps-range=15000,30000;
preview-fps-range-values=(8000,8000),(10000,10000),(15000,15000),(15000,30000),(30000,30000);

The range allows the fps to "slow down".

The call setPreviewFpsRange(30000, 30000); enforces the fps to stay around 30.

like image 36
josef Avatar answered Oct 12 '22 09:10

josef