Skip to content

TBM13/Samsung-Camera-Experiments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Samsung Camera Experiments

This repository contains two Python scripts that can patch the camera lib of Exynos devices and enable/modify different features:

  • patch_libexynoscamera3.py is for older Exynos devices that use the libexynoscamera3.so lib.
    • Located at /vendor/lib/ and/or /vendor/lib64/.
    • If both libs are present, I suggest patching the two of them
  • patch_s5e.py is for newer Exynos devices that use the camera.s5eXXXX.so lib.
    • Located at /vendor/lib64/hw/.
    • The exact file name varies depending on your device. Look for something similar to camera.s5e8835.so.

Both scripts require Python 3.10 or higher.
Make sure to download the whole repository (and not just the patch_*.py script) & install the dependencies too (pip install -r requirements.txt).

If the script fails to patch your lib, open an issue with your device model and attach the lib(s).

Usage, features & troubleshooting

Warning

Enabling or modifying something doesn't mean it will work as expected. It's up to you to test everything.
In any case, feel free to open an issue if you encounter any problem.

libexynoscamera3.so
usage: patch_libexynoscamera3.py [-h] [--hardware-level HARDWARE_LEVEL] [--enable-cap CAPABILITY [CAPABILITY ...]]
                                 [--disable-cap CAPABILITY [CAPABILITY ...]] [--skip-depth] [--model MODEL] [--android-version ANDROID_VERSION]
                                 [--version VERSION]
                                 libs [libs ...]

positional arguments:
  libs                  Path(s) of the lib(s) that will be patched

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

Lib Modifications:
  --hardware-level HARDWARE_LEVEL
                        The hardware level that will be set
  --enable-cap CAPABILITY [CAPABILITY ...]
                        The capabilities that will be enabled, separated by space.
  --disable-cap CAPABILITY [CAPABILITY ...]
                        The capabilities that will be disabled, separated by space.
  --skip-depth          Skips modifications on cameras with the "Depth Output" capability. Recommended if your device has a depth camera.

Magisk Module:
  If all the following args 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)

Hardware Level

  • LIMITED - default level on pretty much every lib
  • FULL - enables some capabilities, more info below
  • LEVEL_3 - the lib doesn't seem to expect this level, it'll probably behave like LIMITED
  • These are worse than LIMITED so you shouldn't use them:

Example:
python3 ./patch_lib.py libexynoscamera3.so --hardware-level FULL will set the Hardware Level to FULL on all cameras.

Capabilities

Examples:
python3 ./patch_lib.py libexynoscamera3.so --enable-cap RAW enables the RAW capability on all cameras.
python3 ./patch_lib.py libexynoscamera3.so --enable-cap RAW YUVReprocessing enables the RAW and YUV_REPROCESSING capabilities.
python3 ./patch_lib.py libexynoscamera3.so --disable-cap BurstCapture disables the BURST_CAPTURE capability.

Troubleshooting

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

  • Try patching with --skip-depth. Some devices have depth cameras and enabling capabilities on them breaks the lib.
  • Someone reported 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 logs.
camera.s5eXXXX.so
usage: patch_s5e.py [-h] [--hardware-level HARDWARE_LEVEL] [--enable-cap CAPABILITY [CAPABILITY ...]]
                    [--lib-name LIB_NAME] [--model MODEL] [--android-version ANDROID_VERSION] [--version VERSION]
                    libs [libs ...]

positional arguments:
  libs                  Path(s) of the lib(s) that will be patched

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

Lib Modifications:
  --hardware-level HARDWARE_LEVEL
                        The hardware level that will be set
  --enable-cap CAPABILITY [CAPABILITY ...]
                        The capabilities that will be enabled, separated by space.

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

  --lib-name LIB_NAME   The name of the lib (e.g. camera.s5e9925.so)
  --model MODEL         The device the lib comes from (e.g. Galaxy A54)
  --android-version ANDROID_VERSION
                        The Android version the lib comes from (e.g. 15)
  --version VERSION     The module version (e.g. 1)

Hardware Level

Example:
python3 ./patch_lib.py camera.s5e8835.so --hardware-level FULL will set the Hardware Level to FULL on all cameras.

Capabilities

Note that some capabilities (specially the ones at the end of the list) may only do something on newer lib versions.

Examples:
python3 ./patch_lib.py camera.s5e8835.so --enable-cap RAW enables the RAW capability on all cameras.
python3 ./patch_lib.py camera.s5e8835.so --enable-cap RAW YUVReprocessing enables the RAW and YUV_REPROCESSING capabilities.

GCam tests after enabling the RAW capability

Note: If you test GCam on a device not listed here or get a different result, let me know.

camera.s5eXXXX.so

SoC Device Name GCam Works? Notes
Exynos 1380 (S5E8835) Galaxy A54 Tested on Android 16
Exynos 1480 (S5E8845) Galaxy A55 Tested on Android 15 using SGCAM 8.4 v25

libexynoscamera3.so

Most tests were done using BSG's GCam 8.1, as it seems to be the most stable one.

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

As you can see, GCam is unusable on most devices that use the libexynoscamera3 lib.
On the Exynos 7884/7904 series, the difference in pic quality between the stock camera and GCam is huge. Check it yourself with this comparison of two pics I took with the Galaxy A20.

About

Python script to enable camera features on Exynos devices, like RAW capture (required by GCam)

Topics

Resources

Stars

Watchers

Forks