GrapheneOS / Camera

Modern camera app focused on privacy and security with QR & barcode scanning.
https://grapheneos.org/
MIT License
842 stars 85 forks source link

EIS works badly on Pixel 5 #457

Closed mbuzdalov closed 1 month ago

mbuzdalov commented 1 month ago

Pixel 5, GrapheneOS build 2024072800, Camera 72.

I started to see a sudden huge drop in perceived video quality after the recent Camera update, and after toggling random configuration bits, it seems to be EIS-related.

Here is the video with EIS, compressed to 1280x720, originally filmed in UHD with quality over latency: https://github.com/user-attachments/assets/1315df57-d66f-459b-89cb-7d9126a28cf3

Here is the video without EIS, also compressed: https://github.com/user-attachments/assets/5081a06d-0094-4448-b4a1-8ddfa0ac6bc4

I can send the original files on request, they are just a little bit heavy for a direct GitHub upload.

I noticed that In EIS-enabled videos, there is a huge amount of frame duplicates, more than 1/4 of all the frames (noticeable when running ffmpeg on it).

Also, stabilization can be really really bad when filming videos vertically, as can be seen in the first part of this video: https://www.youtube.com/watch?v=Jeaom790P9A.

Happy to provide any additional info if needed.

MHShetty commented 1 month ago

Hi @mbuzdalov,

We have filed an issue for the same to the CameraX team, will post any important updates regarding this issue here. (Link to the filed issue: https://issuetracker.google.com/issues/356770840)

Thanks a lot for reporting this issue and apologizes for the inconvenience being caused

MHShetty commented 1 month ago

Also @mbuzdalov, were you facing this issue previously on EIS by any chance or did it happen after a recent update?

mbuzdalov commented 1 month ago

This issue appeared only once I updated to version 72.

However, it might be caused by changing the defaults - i.e. the update might have toggled the EIS flag - because I did not pay much attention to this setting before.

From my experience, stabilization was active before version 72, but I cannot confirm whether it was due to EIS working, or due to something else. So if the update to 72 did not change any defaults, then EIS was working just fine prior to the update.

MHShetty commented 1 month ago

Hi @mbuzdalov,

Yes actually we did replace the custom Camera2 API calls with official CameraX API calls which might have caused this issue related to EIS. We have reported this issue to the CameraX team and will mention important and relevant updates here as the issue progresses.

Thanks a lot for fidgeting with the settings to narrow down to confirming this issue, it would have been hard to know that without that since we had included multiple new features in the recent releases

MHShetty commented 1 month ago

Hi @mbuzdalov,

Thanks for patiently staying with us on this issue. Could you please try the following release apk for this issue? (Note: The following link is different from what was previously shared, please use the following link for testing a fix to this issue)

https://drive.proton.me/urls/7V08MBZM3G#MUU28lqar2D7

Edit: Please do let me know if you prefer building from a branch, could push the changes to a branch and share the link to it in that case

mbuzdalov commented 1 month ago

I tried to install the last of these two APKs either via adb install or via manual upload and Package Manager, both failed to install.

In particular, adb said the following:

Performing Streamed Install
adb: failed to install /home/maxbuzz/camera-stabilization-fix.apk: Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed to collect certificates from /data/app/vmdl1574233769.tmp/base.apk: Attempt to get length of null array]

I have no experience building anything for Android, so I apologize for being more stupid than necessary.

MHShetty commented 1 month ago

Hi @mbuzdalov,

Sorry for the inconvenience. Had made a release build as EIS didn't work in debug builds but didn't sign the apk before uploading.

adb: failed to install /home/maxbuzz/camera-stabilization-fix.apk: Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed to collect certificates from /data/app/vmdl1574233769.tmp/base.apk: Attempt to get length of null array]

I have uploaded the signed apk on the same link as before that should solve the installation issue. Please delete the existing apk file and download the updated apk from this link to test the app for the EIS related bug:

https://drive.proton.me/urls/7V08MBZM3G#MUU28lqar2D7

Edit: Please make sure you uninstall the existing camera app before trying to install the apk

mbuzdalov commented 1 month ago

I first executed adb install for the new file, it then said

Performing Streamed Install
adb: failed to install camera-stabilization-fix.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Existing package app.grapheneos.camera signatures do not match newer version; ignoring!]

Then (before I saw your edit) I went on to remove the existing camera app. Package Manager could not do it for me, but it suggested running

adb shell pm uninstall -k --user 0 app.grapheneos.camera

which I did with "Success". However, an attempt to install the new version with adb install failed with exactly the same message. Uploading the APK to the device and trying to install it with Package Manager failed with "Installation failed".

I am not sure what I am doing wrong, unless of course a single attempt to install the APK with the previous version still in place bans the installation forever.

MHShetty commented 1 month ago

Hi @mbuzdalov,

Please try running the simple adb uninstall app.grapheneos.camera to uninstall the app and then installing the new apk file

mbuzdalov commented 1 month ago

adb uninstall app.grapheneos.camera

resulted in

Failure [DELETE_FAILED_INTERNAL_ERROR]

then adb install camera-stabilization-fix.apk

resulted in

Performing Streamed Install
adb: failed to install camera-stabilization-fix.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Existing package app.grapheneos.camera signatures do not match newer version; ignoring!]

Installing the camera via AppStore resulted in a success. Then

adb uninstall app.grapheneos.camera

resulted in the same

Failure [DELETE_FAILED_INTERNAL_ERROR]

whereas

adb shell pm uninstall -k --user 0 app.grapheneos.camera

resulted in

Success.

MHShetty commented 1 month ago

Does the app show up in the phone settings/home launcher?

mbuzdalov commented 1 month ago

Camera being uninstalled via adb shell pm uninstall - which is my current state - is no longer on the home launcher, does not have its own entry in Settings (only in Security, Notifications etc, where seems to be about other applications accessing cameras).

MHShetty commented 1 month ago

Ah wait, which Android OS do you currently have installed on your device?

mbuzdalov commented 1 month ago

GrapheneOS, build 202408200.

MHShetty commented 1 month ago

Could you please install the latest version of the Camera app from Apps (the official app store of GrapheneOS)?

mbuzdalov commented 1 month ago

Done, it is version 73.

MHShetty commented 1 month ago

Could you please installing the apk present at the following link for the EIS related issue?

https://drive.proton.me/urls/NYFNTJXVBR#U0YvUEbLfIhp

mbuzdalov commented 1 month ago

Shall I uninstall Camera 73 before?

MHShetty commented 1 month ago

No not at all, that should not be needed

MHShetty commented 1 month ago

Once you're done with testing, please make sure you run adb uninstall app.grapheneos.camera.test to uninstall the test variant of the app

mbuzdalov commented 1 month ago

By the looks of it, this version performs well, thank you!

I'm moving the video pieces on my laptop to look at them in more detail, but the obvious signs of wrong performance are now gone.

MHShetty commented 1 month ago

Glad to know that it's performing well. Please feel free to let us know if anything feels wrong in the recorded video. We'll include this fix for this in the upcoming release of the camera app.

Thanks a lot for reporting this issue and helping us out with testing @mbuzdalov!

mbuzdalov commented 1 month ago

From my naive tests, everything looks OK in the test version. Thank you again!

MHShetty commented 1 month ago

From my naive tests, everything looks OK in the test version. Thank you again!

Glad to know that it's working as expected. Thank you for reporting this issue and helping us out with testing!

mbuzdalov commented 1 month ago

Version 74 works as expected, so I take the liberty to close this now. Thank you very much!

MHShetty commented 1 month ago

Version 74 works as expected, so I take the liberty to close this now. Thank you very much!

Great to know that @mbuzdalov. Thanks a lot for reporting this issue!