# 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 1. Install the CamSwapper APK on a rooted device with LSPosed 2. Enable module in LSPosed Manager and select target apps 3. Select a video file from the app UI 4. 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 1. Place video files in `DCIM`, `Movies`, or other public storage 2. Grant the module media read permissions 3. Grant target apps media read permissions 4. In LSPosed, enable CamSwapper and select target scope (TikTok, Telegram, etc.) 5. **Force stop** target app after any changes 6. Tap the thumbnail area to select a video file ### Debugging Enable "Print Logs" in the app, then: ```bash adb logcat | grep "VCX" ``` ## System-Wide HAL Hook For system-wide camera replacement (all apps at once), flash the module ZIP: ### Installation ```bash # 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 ```bash # Check hook loaded adb shell getprop wrap.android.hardware.camera.provider@2.7-service-google # Check logs adb logcat -d -s CameraHook ``` ### Uninstall ```bash 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 - [FFmpeg](https://ffmpeg.org/) - [libjpeg-turbo](https://libjpeg-turbo.org/)