Skip to content

TBM13/Samsung-Camera-Experiments

Repository files navigation

Samsung Camera Experiments

This repository contains a Python script that patches the libexynoscamera3.so camera lib of Exynos devices to enable different features.

Requires Python 3.10 or higher. Make sure to install the dependencies too (pip install -r requirements.txt).

libexynoscamera3.so

Usually located at /vendor/lib/libexynoscamera3.so and/or /vendor/lib64/libexynoscamera3.so. Some devices have both but only use one, it's suggested to patch both in that case.

Some newer Exynos devices like the Galaxy A55 don't have this library. Those aren't supported by this script at the moment.

If the script fails to patch your lib, open an issue with your device model, Android version and attach the lib.

Features

The following camera features can be enabled or modified.
Keep in mind that enabling them doesn't mean they will work as expected nor that something will change. It's up to you to test the modifications.

Hardware Level

Capabilities

Usage

usage: patch_lib.py [-h] [--hardware-level {0,1,2,3,4}]
                    [--enable-cap {2,4,8,16,32,64,128,256,512,1024,2048} [{2,4,8,16,32,64,128,256,512,1024,2048} ...]]
                    [--disable-cap {2,4,8,16,32,64,128,256,512,1024,2048} [{2,4,8,16,32,64,128,256,512,1024,2048} ...]]
                    [--skip-depth] [--model MODEL] [--android-version ANDROID_VERSION] [--version VERSION]
                    libs [libs ...]

positional arguments:
  libs                  Path(s) of the libexynoscamera3.so lib(s) to patch

options:
  -h, --help            show this help message and exit

Lib Modifications:
  --hardware-level {0,1,2,3,4}
                        The hardware level that will be set
  --enable-cap {2,4,8,16,32,64,128,256,512,1024,2048} [{2,4,8,16,32,64,128,256,512,1024,2048} ...]
                        The capabilities that will be enabled, separated by spaces
  --disable-cap {2,4,8,16,32,64,128,256,512,1024,2048} [{2,4,8,16,32,64,128,256,512,1024,2048} ...]
                        The capabilities that will be disabled, separated by spaces
  --skip-depth          Skips modifications on cameras with the "Depth Output" capability. Recommended if your device
                        has a depth camera.

Magisk Module:
  If the following settings are provided, a Magisk module with the patched lib(s) will be created

  --model MODEL         The device the lib comes from (e.g. Galaxy A20)
  --android-version ANDROID_VERSION
                        The Android version the lib comes from (e.g. 11)
  --version VERSION     The module version (e.g. 1)

Example

python3 ./patch_lib.py libexynoscamera3.so --enable-cap 16 will enable the RAW capability. This should be enough to make GCam work.

python3 ./patch_lib.py libexynoscamera3.so --enable-cap 16 32 --hardware-level 1 will enable the RAW & ZSL capabilities and set the hardware level to FULL.

Troubleshooting

If Android doesn't show show any cameras, this means the camera lib crashed:

  • Can happen if your device has a depth camera, try patching with --skip-depth.
  • Someone has reported that they had to move the lib to /vendor/lib64/hw/. Try it if you see something like dlopen failed: library "libexynoscamera3.so" not found in the logcat.

GCam tests after enabling the RAW capability

Note: If you test this on a device not listed here or you have any issue/weird behaviour, please let me know.

Most tests were done using BSG's GCam 8.1, as it seems to be the most stable one on Exynos devices that do have GCam working.

Device Name SoC GCam Works? Notes
Galaxy A12 Nacho (A12s) Exynos 850 X
Android 11Android 13
FreezesLags/freezes. Back cam doesn't save pics and front cam sometimes does
Galaxy A20 Exynos 7884
Android 10Android 11
FreezesHDR works & pics are 10x better than with the stock cam.
Very laggy, sometimes the phone reboots while using it.
Galaxy A20e Exynos 7884
Android 10Android 11
FreezesHDR works & pics are 10x better than with the stock cam.
Very laggy, sometimes the phone reboots while using it.
Galaxy A25 Exynos 1280
Android 14
HDR works. Not much difference in quality with the stock cam.
Laggy.
Galaxy A30 Exynos 7904
Android 10Android 11
FreezesHDR works & pics are 10x better than with the stock cam.
Very laggy, sometimes the phone reboots while using it.
On few devices the front cam pics are unusable due to bad resolution.
Galaxy A30s Exynos 7904 ?
Android 10Android 11
FreezesUntested
Galaxy A33 Exynos 1280 X
Android 14
Saves black pics when HDR is on
Galaxy A40 Exynos 7904 Partially
Android 11
Front cam pics unusable due to bad resolution.
It's possible to fix, need to investigate how
Galaxy A50s Exynos 9611 Partially
Android 11
Photos have pink tint. Changing black level doesn't help
Galaxy A51 Exynos 9611 Partially
Android 11
Photos have pink tint. Changing black level doesn't help
Galaxy F62 Exynos 9825 Partially
Android 11
Issues with the front camera
Galaxy M31 Exynos 9611 Partially
Android 11
Photos have pink tint. Changing black level doesn't help
Galaxy M31s Exynos 9611 Partially
Android 12
Photos have pink tint. Changing black level doesn't help
Galaxy M34 5G Exynos 1280 X
Android 13
Saves black pics when HDR is on

As it can be seen, GCam only seems to be usable on the Exynos 7884/7904 series. As someone who had an A20, I can say that the difference in quality with the stock camera is huge. You can check that yourself with this comparison of two pics I took a few years ago.

About

A Python script to enable camera features on Exynos devices and make GCam work

Topics

Resources

Stars

Watchers

Forks

Contributors 2

  •  
  •