Xamarin Android - Slow Motion Video
I am trying to use MediaRecorder to record 240fps slow motion video on a Galaxy S9 (Android 8 - Can't get it to update to newer). The built-in camera app does this no problem with the "Slow Motion" selection. I'm compiling using API26. This, set for 30fps, works:
recorder = new MediaRecorder();
recorder.SetVideoSource(VideoSource.Camera);
recorder.SetOutputFormat(OutputFormat.Mpeg4);
recorder.SetVideoFrameRate(30);
recorder.SetVideoSize(1920, 1080);
recorder.SetVideoEncodingBitRate(17000000);
recorder.SetVideoEncoder(VideoEncoder.H264);
recorder.SetOutputFile(path);
recorder.SetPreviewDisplay(viewer.Holder.Surface);
But I can not increase the VideoFrameRate > 30. I've tried a variety of values for the above, removed some settings, etc with no luck.
I have also tried the CamcorderProfile approach, but this doesn't work either. In particular these:
CamcorderProfile.HasProfile(CamcorderQuality.HighSpeed1080p)
CamcorderProfile.HasProfile(CamcorderQuality.HighSpeed720p)
return false. Though its clear the camera can do it.
Some posts I've read say that Camera2 is needed, however I've tried a variety of sample xamarin projects for Camera2... none of these work. I've not been able to find the Xamarin_Android version of Android-Slow-Motion-Camera2.
My goal is to record 240fps and play back at 30fps. Which I think requires some use of SetCaptureRate, but since I can't get it to record 240fps, I haven't gotten that far. SetVideoEncodingBitRate likely needs to be some other value too.