e5471b5fa087b88425b014ce008a6bce745f658e
CamSwapper: A Virtual Camera Module (Android 10+)
PLEASE DO NOT USE THIS SOFTWARE FOR ILLEGAL PURPOSES.
CamSwapper is a virtual camera module that replaces your device's camera feed with video files or images at the application level (via Xposed/LSPosed) or system-wide (via HAL hook).
Quick Start
- Install the CamSwapper APK on a rooted device with LSPosed
- Enable module in LSPosed Manager and select target apps
- Select a video file from the app UI
- Open any hooked camera app — your video plays as the camera feed
Features
App-Level Hook (LSPosed)
| Feature | Status |
|---|---|
| Local video file hooking | [x] |
| AMediaCodec hardware decoding (4K@60fps HEVC) | [x] |
| Static image hooking | [x] |
| Network stream (RTSP) | [ ] In progress |
| Preview cropping to match aspect ratio | [x] |
| Camera1 API photo capture | [x] |
| Camera1/Camera2 API hooks | [x] |
| Audio playback | [x] |
| Floating debug panel | [x] |
System-Wide HAL Hook (Magisk/KernelSU)
| Feature | Status |
|---|---|
| LD_PRELOAD injection | [x] |
| All apps simultaneous | [x] |
| No per-app scoping | [x] |
| RTSP network streams | [x] |
Requirements
- Android 10+ (API 29+)
- Root access
- LSPosed Framework 2.0.0+ (for app-level hook)
- Magisk or KernelSU (for system-wide HAL hook)
Usage
Setup
- Place video files in
DCIM,Movies, or other public storage - Grant the module media read permissions
- Grant target apps media read permissions
- In LSPosed, enable CamSwapper and select target scope (TikTok, Telegram, etc.)
- Force stop target app after any changes
- Tap the thumbnail area to select a video file
Debugging
Enable "Print Logs" in the app, then:
adb logcat | grep "VCX"
System-Wide HAL Hook
For system-wide camera replacement (all apps at once), flash the module ZIP:
Installation
# Flash camswapper-hal-hook-v1.zip in Magisk/KernelSU
adb reboot
# Configure
enabled=1
source_mode=file # or rtsp
video_path=/data/local/camera_magic/video.mp4
rtsp_url=rtsp://192.168.1.100:554/stream
Verification
# Check hook loaded
adb shell getprop wrap.android.hardware.camera.provider@2.7-service-google
# Check logs
adb logcat -d -s CameraHook
Uninstall
adb shell su -c "rm -rf /data/adb/modules/camera-hook"
adb shell su -c "setprop wrap.android.hardware.camera.provider@2.7-service-google ''"
adb shell su -c "rm -rf /data/local/camera_magic"
adb reboot
Known Issues
- Green lines on video edges — Fixed
- Camera1 API not stopping threads after recording — Fixed
- Camera2 API hook on menu switch — Fixed
- 4K audio desync on older devices (runtime permission) — Toggle front/rear camera as workaround
Credits
Description
Languages
Kotlin
46.5%
C++
41.9%
Shell
7.8%
C
2.9%
CMake
0.6%
Other
0.3%