Cool! Code reviews are a good thing and feedback would be most welcomed! My Java is a little rusty and I only saw that code for the first time the week before last. Don't feel you have to fix issue in my contribution yourself.
I figured it out. Since the device supports photo_video_recording, a third surface (3840x2160) is automatically added to the capture session in addition to the preview and record 1920x1080 surfaces. Since the max frame rate for 3840x2160 is 30fps, that's the limit. My feeling is that if a user selects a specific frame rate, that should be honored if possible so a few things can be done... Add a "Disable photo capture if selected frame rate can't be met" option to video settings and disable the "take...
OK, here's the latest patch BUT somehow I lost 60fps recording again. 120 works as does not-quite 240. Just not 60. I DID have it working, I swear. :) Anyway, I 'll keep working on it. I was able to get Google's Camera2Video example to work at 60fps so I know it can be done. To make things like this easier, you may want to think about refactoring Preview and the CameraControllers into separate classes for still vs video and Camera vs Camera2. It's really hard to figure out what gets called in what...
You can have the copyright. also there were some bugs in that patch which I need to correct so stay tuned. :)
will do. also there were some bugs in that patch which I need to correct so stay tuned. :)
Here's the patch. I probably went a bit overboard on the refactoring, sorry. :) Most of the work was in refactoring getVideoProfile and that started a ripple effect (as refactoring often does). In any case, things still to do would be to filter the preferences dialogs so if you specify a specific resolution, you only get frame rates the resolution supports. Also the addition of the capture to encoder frame rates for slow/fast motion. The thing to pay attention to is that "high speed" is now determined...
Here's the patch. I probably went a bit overboard on the refactoring, sorry. :) Most of the work was in refactoring getVideoProfile and that started a ripple effect (as refactoring often does). In any case, things still to do would be to filter the preferences dialogs so if you specify a specific resolution, you only get frame rates the resolution supports. Also the addition of the capture to encoder frame rates for slow/fast motion. The thing to pay attention to is that "high speed" is now determined...
So now I DO have 60fps without using high speed and still have 120 and audio with high speed. Now the question is how to integrate that into the codebase as it required changes to Preview, CameraController2 and VideoProfile. The changes to CameraController2 and VideoProfile are generic and should work on any device. For CameraController2, I just implemeneted the setPreviewFpsRange and getSupportedPreviewFpsRange methods. For VideoProfile, I added audioChannels, audioBitRate, audioSampleRate, videoEncodingProfile...
Ha!. I've now got it recording at 120fps by forcing video_high_speed = true and has_capture_rate_factor = false. Still can't get 60 though. :)
Well, I'm going to retract the statement that I made about it working before. After examininng the videos, the 60fps ones were recorded with the stock camera app. I reflashed the phone back to 8.0.0 and tried earlier versions of OpenCamera to no avail. Without the Camera2 API, I get a message from Stagefright complaining that the framerate of 60 is too large and it's being clamped down to 30. With the Camera2 API, I get nothing from Stagefright but I do get... mm-camera: <CPP>< INFO> 1732: cpp_module_handle_stream_cfg_event:...
I just grabbed the git repo and tried a few versions back with no luck so I'm thinking I got an android update that broke it. I'm going to try reverting the update and see what happens. If I can even revert it. Since I have the source code now and can build it, if there are things I can try, let me know.
First... Love the app. Thanks! I don't know what changed but as of Monday (1/1/18) I lost the ability to record videos at anything other than 30 FPS. I can't even force recording to 24 FPS. I still get 30. Lower resolutions and lower bitrates don't help. Nor does switching on or off the Camera2 APIs. A few days before I was recording 1080p60 just fine. I still have those videos. The stock camera also will only record at 30 FPS now so I'm not pointing the finger at OpenCamera by any means. I'm just...