5

I am trying to create a video recording app that records videos in 24 FPS. I am using the following code in an attempt to lock the FPS to 24:

Camera.Parameters params = mCamera.getParameters();
params.setPreviewFrameRate(24);
params.setPreviewFpsRange(24000, 24000);

And also the following CamcorderProfile that is used with MediaRecorder:

CamcorderProfile ccp = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
ccp.videoFrameRate = 24;

Unfortunately, it only works when the video is taken in low light situation, but once I go outside when there's light, the video starts recording in 30 FPS.

Is it possible to lock the frame rate to 24fps also in broad daylight?

Thanks in advance!

MrByte
  • 1,083
  • 2
  • 11
  • 21
  • May I ask why you want to lock it at 24fps? 29.97 FPS is much more common now a days for most applications. Is this perhaps something you could do server side? I dont know the nature of your app, so sorry if these questions dont make sense. – blindstuff Sep 30 '13 at 19:30
  • What I'd like to achieve is a movie-like quality. I have noticed that cameras capture a much higher quality in lower FPS. It's really hard to explain, but when you watch a 24 fps video and you compare it to a 29 fps video, it looks different in a better way. – MrByte Oct 01 '13 at 15:13

4 Answers4

1
public List<Integer> getSupportedPreviewFrameRates ()

check this list. I suppose that you just cant set frame rate that is not listed there. It may be because of codecs modification that are used in Android OS.

Lebedevsd
  • 950
  • 5
  • 12
  • Thank you very much for the answer. I have checked the values and I have received the following: 15000,30000 and 30000,30000. My goal is to reach the exact amount of 24 frames per second, so I've assumed that if I changed the values to 24000, it would do the trick since my device supports this value which is between the 15000 and 30000. But, if it's impossible to use anything else except for these values, is it actually impossible to achieve? – MrByte Sep 30 '13 at 14:48
1

i would suggest you have a look at MediaRecorder : setCaptureRate (double fps)

fps : - Rate at which frames should be captured in frames per second

For Querying supported :- getPreviewFpsRange(int[])

Please note that your camera cannot guarantee that frames will be captured at the given rate due to camera/encoder limitations.

Kahn
  • 11
  • 2
  • Thank you for your answer. This function is deprecated. I have tried it as well yet I had no success. I'm trying to achieve the exact amount of fps, nothing more and nothing less. – MrByte Oct 01 '13 at 15:15
1

From personal experience on my Android, I see there is a dependency between FPS and exposure. I haven't check it with WhiteBalance but it's possible too.

Then why don't you set the fps to 24 or some other value that results in 24fps at some point. Then you continuously check the current fps, and when it's 24fps, then you setAutoExposureLock(true) (and setAutoWhiteBalanceLock(true) too just in case). The fps won't change anymore because of changes in automatic exposure.

martinako
  • 2,690
  • 1
  • 25
  • 44
  • Simple & clever. As you said, apparently white balance plays a small role in FPS too. In my case locking the exposure at a slightly lower FPS did the trick. – Cagan Arslan Jan 02 '18 at 14:47
0

Probably you have not locked the auto-white balance and auto-exposure. The FPS may be affected by the environment. Try to setAutoExposureLock(true) and setAutoWhiteBalanceLock(true).

yushulx
  • 11,695
  • 8
  • 37
  • 64
  • Thank you for your answer, although it did do the trick in one situation (when the video is taken in low light), it is only good for certain situations. For example, if the user wants to take a video inside his house and then he wants to get out when there's light, the camera will only show "white screen". Also, if the user is taking the video when there's a lot of light, the FPS will lock on 30 instead of 24 as I want it to be. – MrByte Sep 23 '13 at 11:06