react-native-vision-camera: 💭 Enabling `video` slows down photo capture on Android
Question
Photo capture performance drops significantly and results in a preview layer freeze when the video
prop is set to true
.
Condition | Format Filter | Photo | Video | Duration[^1] |
---|---|---|---|---|
0 |
undefined |
true |
false |
373.5ms |
1 |
[{ photoResolution: { width: 480, height: 320 } }] |
true |
false |
389.6ms |
2 |
undefined |
true |
true |
779.7ms |
3 |
[{ photoResolution: { width: 480, height: 320 } }] |
true |
true |
823.8ms |
[^1]: Averaged across 10 sequential captures.
What I tried
Test app: rnvc3-test.zip
VisionCamera Version
3.8.2
Additional information
- I am using Expo
- I have read the Troubleshooting Guide
- I agree to follow this project’s Code of Conduct
- I searched for similar questions in the issues page as well as in the discussions page and found none.
About this issue
- Original URL
- State: open
- Created 5 months ago
- Comments: 29 (16 by maintainers)
It’s just reading the latest pixels from the preview or video stream. No AE/AF/AWB at all.
Results for
4.0.0-beta.8
:To recap, capture with only photo enabled is slower in
beta-8
than capture with video also enabled. Both conditions are slower than either of the same conditions in3.8.2
.Hey! I just released a new V4 beta (v4.0.0-beta.7) where I fixed a bunch of issues! 💪🚀 Can you test that and see if that fixes the issue for you? 😅
You might need to increase the
compileSdk
to the newest Android SDK (34) if you are behind.Heyo, I just tested this on my end on my Huawei P10:
Without the
stopRepeating()
before capture, so just VisionCamera main codebase as it is today:With the
stopRepeating()
added before the capture, so with the patch I suggested:There doesn’t seem to be a difference here at all on my end.
Can you absolutely confirm that this changes the capture speed for you?
Confirmed. That brings
Condition 2
in the table down to 218.5ms. All testing performed on a Pixel 3a.