Skip to content

Latest commit

 

History

History
66 lines (56 loc) · 3.87 KB

File metadata and controls

66 lines (56 loc) · 3.87 KB

Camera2 Magic: A Virtual Camera Software (Supports Android 10+)

PLEASE DO NOT USE THIS SOFTWARE FOR ILLEGAL PURPOSES.

img

Documentation

Usage Precautions

Development & Testing Device: OnePlus 8T LPDDR4 (ColorOS Port 16.0)

  • MagicVideo files must be placed in local public storage directories, such as DCIM, Movies, etc.
  • The module must be granted permission to read media/files.
  • The target application (e.g., TikTok) must be granted permission to read media/files.
  • The device must be Rooted with the LSPosed Framework installed. Enable the module in LSPosed Manager and select the target scope (e.g., TikTok, Telegram, etc.).
  • After installing or updating the module, you must Force Stop the hooked application and reopen it for changes to take effect.
  • Open this module, tap the thumbnail area to trigger the system media picker: select a video file and confirm.
  • Enable audio or other features as needed.
  • If you intend to use the floating panel, ensure the hooked application has been granted the "Display over other apps" (Floating Window) permission.
  • Open the hooked application and use its camera function; you should see the preview screen replaced by your selected video.
  • If it doesn't work as expected, please enable the "Print Logs" feature. Use adb logcat | grep "VCX" for debugging.

Development Progress

Hook Camera1/2 API

  • Initial detection of the target app's working mode (Standard, QR Scanning, Face Detection)
    • Hook all working modes (Default)
  • Local media video decoding
    • FFmpeg demuxer: Initial work for network video stream support completed
    • AMediaCodec Hardware Decoding (Smooth 4K@60fps HEVC on Snapdragon 865/SM8250)
      • Double Buffering (Ping-Pong Mechanism)
      • GPU-accelerated transcoding to NV21
    • Initial audio decoding support
  • Network video stream support
  • Preview screen replacement
    • Corrected Preview Surface rendering to match the visual aspect ratio
    • MagicImage cropping to adapt to Preview Surface ratio (minimizing stretching/distortion)
    • Real-time adaptation to target app's ratio switching
  • NV21 byte[] generation
    • Camera1 API: Capture photos using current NV21 data (Default)
    • Force conversion of NV21 data to "Visual Upright" orientation (Default)
  • Use specific images to replace capture/photo data?

Module UI

  • Main Interface
    • Media permission requests
    • Tap empty thumbnail to select media / Long-press thumbnail to delete
  • Feature Toggles
    • Temporary module master switch
    • Audio playback toggle
    • Log printing toggle (Error logs are still printed)
    • Floating panel injection toggle

Known Issues

  • Fixed: Green lines on video edges.
  • Fixed: Camera1 API failing to correctly stop decoding/playback threads after photo capture or video recording.
  • Fixed: Camera2 API failing to correctly hook the camera stop signal when switching menus in certain apps (e.g., TikTok: POST <-> TEMPLATES), leading to unexpected thread behavior.
  • Ongoing: If camera permission is granted at runtime, 4K video may experience audio desync or pixelation on older devices. This can be temporarily resolved by toggling the front/rear camera; a permanent fix is pending in a future set_internal_state.

Floating Window (Injected into target app for Debugging)

  • Floating window framework
  • Low-resolution and low-frame-rate preview of NV21 bytes
  • Complete other feature menus

Documentation

  • Detailed documentation completed.