Kanaha transforms Android phones into network-controllable cameras with a secure HTTP/2 API. Control multiple cameras simultaneously from any device using standard HTTPS requests with mutual TLS authentication.
Built in C for Performance: The core server (Apache httpd + Axis2/C) is written entirely in C, delivering native execution speed with minimal memory footprint. This enables Kanaha to run efficiently on devices spanning nearly a decade of Android hardware—from a 2017 Moto X4 (since retired) to a 2025 Pixel 10 Pro XL—with identical functionality.
- Multi-Camera Control - Start/stop recording on multiple phones simultaneously
- HTTP/2 + mTLS Security - Enterprise-grade encryption with certificate authentication
- Wide Device Support - Same APK works on Android 6.0+ (API 23) devices, tested on a 2025 Pixel 10 Pro XL and a 2024 Moto G Play, and earlier on a 2017 Moto X4 (since retired) 1
- SFTP File Transfer - Secure file retrieval with SSH key authentication
- mDNS Discovery - Automatic camera discovery on local network
- SMPTE Timecode Alignment - each camera records LTC timecode on its audio track through an iRig Pro I/O fed by a Tentacle Sync, and clips are aligned on it in post (
ltcdumpdecodes it on Linux); see SMPTE Timecode Setup and Multi-Camera Deployment - Synchronized Start -
start_atparameter fires all cameras at the same UTC millisecond, independent of network delivery timing - Software Sync Slate - for shoots without timecode,
playToneplays a synthesized sine wave on all cameras + laptop simultaneously; onset detection in post gives ~1–5 ms inter-camera sync - GPS Timestamping -
getStatusexposes GPS fix time and age for clock quality assessment - Recording Start Sidecar - Writes
<recording>.kanaha_start.jsonfor each recording when it starts (millisecond precision, GPS time). It marks when the start fired, not the first frame, which came 0.38–1.12 s later on the phones measured, so it locates takes rather than aligning them - Open Gate Recording - Full 4:3 sensor field of view on supported devices (2560×1920 on the Pixel 10 Pro XL, the largest 4:3 frame its encoder accepts; less resolution than 4K, more of the scene vertically); see Open Gate Recording
- On-Device Clip Description -
describeClipsamples frames from a finished recording and describes them with Gemini Nano through ML Kit, writing a<clip>.kanaha.jsonsidecar that travels with the video. Opt-innanobuild flavour; the defaultfossbuild keeps the operation and reports the model unavailable. See On-Device Clip Description - MCP (AI Assistant) Support - Model Context Protocol integration lets Claude Desktop and other AI assistants discover and control cameras as tools. 11 camera operations exposed with full parameter schemas. 117 KB native binary, no JVM; see MCP Documentation
- On your Android phone, open: Latest Release
- Tap
app-debug.apkto download - Tap the downloaded file notification to install
- If prompted: Settings → Install unknown apps → Allow for your browser
- Tap Install, then Open
# Download APK from releases page, then:
adb install app-debug.apk# On phone: Settings → Developer options → Wireless debugging → Pair
adb pair <phone-ip>:<pair-port> # Enter pairing code
adb connect <phone-ip>:5555
adb install app-debug.apk- Open Kanaha app
- Grant permissions: Camera, Microphone, Storage
- Android 15 users: Tap "OK" on the debuggable app warning (this is a debug build)
- Camera preview appears - the HTTP control server starts automatically on port 8443
From a computer on the same WiFi network (requires an mTLS client cert — see Set up mTLS):
curl -s https://<phone-ip>:8443/services/CameraControlService/getStatus \
--cert client.crt --key client.key --cacert ca.crtKanaha uses mutual TLS. You run a small private CA; its key never leaves your machine and is never shipped in the app. The device generates its own server key on-device (below) — you only ever sign a CSR.
mkdir -p ~/kanaha-certs && cd ~/kanaha-certs
openssl genrsa -out ca.key 4096
openssl req -new -x509 -days 3650 -key ca.key -out ca.crt -subj "/CN=Kanaha CA"
# A client certificate for your control station (curl / MCP):
openssl genrsa -out client.key 2048
openssl req -new -key client.key -out client.csr -subj "/CN=kanaha-control"
openssl x509 -req -days 365 -in client.csr -CA ca.crt -CAkey ca.key \
-CAcreateserial -out client.crt \
-extfile <(printf "extendedKeyUsage=clientAuth")On first run the app mints its own private key and a CSR (the key never leaves the device) and refuses to serve until you sign that CSR with your CA and push the signed cert back:
# After installing + launching the app once (it writes files/csr/camera.csr):
adb shell "run-as org.kanaha.camera cat files/csr/camera.csr" > camera.csr
# Sign it with your CA (add the phone's IP / mDNS name as SANs):
openssl x509 -req -days 365 -in camera.csr -CA ca.crt -CAkey ca.key -CAcreateserial \
-out camera.crt \
-extfile <(printf "subjectAltName=IP:<phone-ip>,DNS:localhost,IP:127.0.0.1\nextendedKeyUsage=serverAuth,clientAuth")
# Push the signed cert + CA back into the app, then restart it:
adb push camera.crt /data/local/tmp/server.crt && adb push ca.crt /data/local/tmp/ca.crt
adb shell "run-as org.kanaha.camera sh -c 'cp /data/local/tmp/server.crt files/apache/ssl/server.crt && cp /data/local/tmp/ca.crt files/apache/ssl/ca.crt'"The server now starts with mTLS. Provisioning is durable — redo it only after a fresh install / data clear.
Launch Kanaha on your Android device. The camera preview starts automatically and the HTTP/2 server begins listening on port 8443.
# Via mDNS (Linux)
avahi-browse -rt _https._tcp | grep kanaha
# Or check the device's IP in Android Settings → NetworkAll API calls require mTLS client certificates:
# Set certificate paths (adjust to your cert location)
SSL=${KANAHA_CERT_DIR:-~/kanaha-ca}
CAMERA="192.168.1.100"
# Convenience alias used in all examples below. No -k: the camera's certificate
# must match the address used; if it names the camera only as camera.local, add
# --resolve camera.local:8443:$CAMERA and use https://camera.local:8443.
CURL="curl -s --http2 --cert $SSL/client.crt --key $SSL/client.key --cacert $SSL/ca.crt"Returns camera state, battery, storage, timestamp, and GPS fix (when available).
$CURL "https://$CAMERA:8443/services/CameraControlService/getStatus"Response fields:
{
"success": true,
"state": "IDLE",
"is_recording": false,
"battery_level": 87,
"storage_available_mb": 12400,
"timestamp": 1772039424000,
"gps_time": 1772039423850,
"gps_age_ms": 150,
"gps_provider": "gps"
}timestamp— camera'sSystem.currentTimeMillis()at response time (ms since epoch). Disciplined by GPS when a fix is active, otherwise by NTP/network.gps_time— time of the most recent GPS fix (location.getTime()), in ms since epoch. Only present when GPS location is available.gps_age_ms— milliseconds since the GPS fix was obtained. Use this to judge whether the camera's clock is GPS-disciplined.gps_provider— location provider name (e.g."gps","network").
# Minimal — start immediately with auto-generated clip name
$CURL -H "Content-Type: application/json" \
-d '{"action":"startRecording"}' \
"https://$CAMERA:8443/services/CameraControlService/startRecording"
# With clip name
$CURL -H "Content-Type: application/json" \
-d '{"action":"startRecording","clip_name":"my_clip"}' \
"https://$CAMERA:8443/services/CameraControlService/startRecording"
# Scheduled start — all cameras fire at the same wall-clock millisecond
# Compute start_at = 3 seconds from now (laptop clock, ms since epoch)
START_AT=$(( $(date +%s%N) / 1000000 + 3000 ))
$CURL -H "Content-Type: application/json" \
-d "{\"action\":\"startRecording\",\"clip_name\":\"sync_test\",\"start_at\":$START_AT}" \
"https://$CAMERA:8443/services/CameraControlService/startRecording"Request parameters:
clip_name(optional) — prefix for the output filename. Default: auto-generated.quality(optional) —"4K"(default),"1080p","720p","480p", or an OpenCamera quality string. Kanaha records the camera size nearest the request that the phone's video encoder accepts, so"4K"gives 1920×1080 on a 1080p phone such as the Moto G Play 2024 rather than failing.duration(optional) — recording duration in seconds.0= record until stopRecording.format(optional) — container format. Default:"MP4".open_gate(optional) —trueto record the full 4:3 sensor field of view (2560×1920 on the Pixel 10 Pro XL, smaller than 4K in both directions; see OPENGATE.md). The call blocks 3–5 s while the camera session reopens. The Moto G Play 2024 records 1600×1200 under the Camera2 API; a phone with no 4:3 video size ignores the flag and records normally. Default:false. See Open Gate Recording.hlg10(optional) —trueto record 10-bit HLG video (HEVC Main 10, BT.2020), whatever theformat. Applies to this recording only; omitting it records 8-bit even if the Settings toggle is on. Refused with an error on cameras that lack 10-bit support (supports_hlg10: falseingetStatus) rather than silently recording 8-bit. Combines withopen_gate. Default:false.raw12(optional) —truefor a 12-bit RAW take: every 30 fps frame of the full 4080×3072 sensor written as a lossless DNG (Pixel 10 Pro XL). The camera app switches to its take screen (live preview and a status line) untilstopRecording, then OpenCamera returns. Refused, with the reason, on a phone without 12-bit RAW, withhlg10, while a recording runs, unlesssetExposurehas fixed the ISO and pinned a shutter of 1/40 s or faster (1/60 at 30 fps; auto exposure let the sensor drift to 29.74 fps), or with room for less than 30 s.durationcaps the take, and so does free space (max_secondsin the reply: about 22 GB a minute).start_atis honoured to the frame. Default:false. See 12-bit RAW takes.start_at(optional) — UTC epoch milliseconds at which recording should begin. When provided, the camera schedules the start viaHandler.postDelayed()and returns immediately with"scheduled": true. The camera fires at the specified wall-clock time regardless of when the request arrived. Valid range: 50 ms to 30 000 ms in the future. If zero or omitted, recording starts immediately.
Scheduled start response (when start_at is provided and valid):
{
"success": true,
"scheduled": true,
"clip_name": "sync_test",
"start_at": 1772039427000,
"delay_ms": 2837,
"timestamp": 1772039424163,
"operation_id": "abc123"
}$CURL -H "Content-Type: application/json" \
-d '{"action":"stopRecording"}' \
"https://$CAMERA:8443/services/CameraControlService/stopRecording"Pin exposure so cameras match, instead of each one metering its own framing.
# Manual: ISO 100, 1/60 (180° shutter at 30 fps), 5600 K, focus held where it is
$CURL -H "Content-Type: application/json" \
-d '{"action":"setExposure","iso":100,"exposure_time_ns":16666666,"wb_kelvin":5600,"focus":"lock"}' \
"https://$CAMERA:8443/services/CameraControlService/setExposure"
# Freeze whatever auto has settled on
$CURL -H "Content-Type: application/json" -d '{"action":"setExposure","lock":true}' \
"https://$CAMERA:8443/services/CameraControlService/setExposure"
# Back to auto
$CURL -H "Content-Type: application/json" -d '{"action":"setExposure","auto":true}' \
"https://$CAMERA:8443/services/CameraControlService/setExposure"
# Modes, live values, support and ranges
$CURL -H "Content-Type: application/json" -d '{"action":"getExposure"}' \
"https://$CAMERA:8443/services/CameraControlService/getExposure"setExposure fields, all optional:
iso,exposure_time_ns— manual exposure. Camera2 has no shutter or ISO priority, so giving one fixes both; the other is taken from the live value.wb—"lock"freezes the white balance the camera's own auto white balance has chosen, gains and factory colour calibration both, and keeps it through reopens and restarts;"auto"returns white balance alone to auto. Locking keeps a camera's colour constant; it does not make different models agree, which takes a per-camera gray-card correction in post (see Multi-Camera Setup and the matching guide).wb_kelvin— manual white balance from OpenCamera's generic kelvin formula. It applies no colour calibration (identity colour matrix), so it is consistent between identical phones but less accurate, and does not make different models match.focus_distance(dioptres,0= infinity), or"focus":"lock"to hold the current distance, or"focus":"auto".stabilization—true/false. Electronic stabilization crops by a varying amount, so set it the same on every camera.tone— a fixed tone curve, so contrast does not change with what is in frame:rec709,srgb, the flat log curvesfine/low/medium/strong/extra_strong, orjtvideo/jtlog/jtlog2.off(the default) leaves contrast to the phone. A log curve also leaves more room to grade 8-bit footage. Not combinable withhlg10, which has its own transfer function;startRecordingrefuses that pairing.fps— pin the recording frame rate to a fixed rate the camera offers (getExposurelists them inranges.fixed_fps; 15, 24, 30, 60 on the Pixel 10 Pro XL), or"default"to let the camera choose. On default no rate is requested at all, so pin it on every camera that must cut together. The shutter-longer-than-a-frame check applies only to a pinned rate.codec—"h264","hevc"or"default"(the camera profile's codec, H.264 on the phones tested), for later recordings, in MP4.hlg10overrides it with HEVC for that take. Refused on a phone with no HEVC encoder (supports.hevc).bitrate— video bits per second, or"default". Refused outside the encoder's range (ranges.bitrate_h264/ranges.bitrate_hevc), which is the encoder's declared limit, not a guarantee the phone sustains it.lock— freeze every value not given explicitly at its live value.auto— everything back to auto; not combinable with other fields.
Values outside the camera's range are refused, never clamped, since a clamped value would leave cameras unmatched; so is a shutter longer than one frame, which would lower that camera's frame rate. Settings persist across takes and through the reopen open_gate causes, and are refused while recording. Manual exposure and kelvin need the Camera2 API; Motorola phones default to Camera1 (Settings > Camera API).
getExposure returns exposure_mode, wb_mode, focus_mode, stabilization, tone, fps, codec, bitrate, settled (whether the live values have caught up with pinned settings; setExposure waits up to 2 s for it), the live iso, exposure_time_ns (also as shutter, e.g. "1/60"), wb_kelvin, wb_gains, focus_distance and frame_duration_ns, plus supports and ranges objects. wb_mode is locked while a white balance lock is in force. The exposure and focus values can be sent unchanged to setExposure on other cameras; see Multi-Camera Setup. White balance cannot: wb_gains belong to one sensor, and wb_kelvin under auto white balance is OpenCamera's estimate from those gains, which can be far off (the Pixel 10 Pro XL and Moto G Play 2024 both report 15000 K in daylight). Lock each camera and correct each from a gray card in post, or give every camera the same wb_kelvin.
Zoom during a take, for a push-in or pull-back as an effect. Digital zoom crops the sensor before scaling, so it costs no resolution until the crop is narrower than the video: about 2.5x for the Moto G Play 2024's 1600×1200 open gate from its 4080-wide sensor.
# Push in to 2.5x over 8 s, starting at a moment in the song (epoch ms on the camera's clock)
$CURL -H "Content-Type: application/json" \
-d "{\"action\":\"setZoom\",\"ratio\":2.5,\"duration_ms\":8000,\"start_at\":$AT}" \
"https://$CAMERA:8443/services/CameraControlService/setZoom"ratio— the target, withingetExposureranges.zoom_min–zoom_max; out of range is refused.duration_ms(0–60000) ramps to it, easing in and out at an even apparent speed; omitted, the zoom is immediate.start_at— 50 ms to 10 minutes ahead. Cues queue, so a song's cue list can be sent before the take; a cue that fires takes over from any ramp in progress.{"clear": true}cancels every queued cue and the ramp in progress.step_ms(33–500, default 33) sets how often a ramp moves;getExposurereports the currentzoom.- On the Moto G Play 2024 a ramp drops frames — about one per second of zooming, at a 33 or a 100 ms step — while an instant change (no
duration_ms) dropped none in testing (2026-10-20). For a timecoded take, prefer punch-ins on the Moto.
$CURL "https://$CAMERA:8443/services/CameraControlService/listFiles"$CURL -H "Content-Type: application/json" \
-d '{"action":"deleteFiles","pattern":"VID_20260225*.mp4"}' \
"https://$CAMERA:8443/services/CameraControlService/deleteFiles"Pushes files from the camera to a remote host via SFTP. Requires SSH key setup — see SFTP File Transfer.
$CURL -H "Content-Type: application/json" \
-d '{"action":"sftpTransfer","storage_server_id":"control","video_filename":"VID_20260225*.mp4","destination_folder":"/tmp/pixel9pro"}' \
"https://$CAMERA:8443/services/CameraControlService/sftpTransfer"Plays a synthesized sine wave through the device speaker. Used as a software sync slate — all cameras play the same tone at the same scheduled moment; onset detection in post gives ~1–5 ms inter-camera sync with no hardware.
# Play immediately — 1 kHz for 500 ms
$CURL -H "Content-Type: application/json" \
-d '{"action":"playTone","frequency":1000,"duration_ms":500}' \
"https://$CAMERA:8443/services/CameraControlService/playTone"
# Scheduled — all cameras play at the same wall-clock millisecond
START_AT=$(( $(date +%s%N) / 1000000 + 3000 ))
for cam in $PIXEL $MOTOG $MOTOG5G; do
$CURL -H "Content-Type: application/json" \
-d "{\"action\":\"playTone\",\"frequency\":1000,\"duration_ms\":500,\"start_at\":$START_AT}" \
"https://$cam:8443/services/CameraControlService/playTone" &
done
# Also play on laptop speaker at the same moment
sleep 2.9 && ffplay -nodisp -autoexit -f lavfi -i "sine=frequency=1000:duration=0.5" 2>/dev/null
waitRequest parameters:
frequency(optional) — tone frequency in Hz. Default:1000. Valid range: 20–20000.duration_ms(optional) — duration in milliseconds. Default:500. Valid range: 10–5000.start_at(optional) — UTC epoch milliseconds at which to play. Same mechanism asstartRecording. If omitted, plays immediately.
The tone is synthesized via AudioTrack MODE_STATIC with 5 ms linear fades to prevent click artefacts. Its onset in the recorded audio can be detected to ±1–5 ms accuracy using ffmpeg's bandpass + silencedetect pipeline (see parseWithoutLTC.sh).
The workflow script test-triple-camera-workflow.sh exposes this as play_slate_all(), which automatically writes the start_at value to /tmp/kanaha_slate_at.txt for parseWithoutLTC.sh to read.
Query the MCP tool catalog to see all available camera operations and their parameter schemas — this is what Claude Desktop reads to discover your camera:
# Via the MCP stdio binary on the phone (over ADB)
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | \
adb shell run-as org.kanaha.camera ./files/kanaha-camera-mcpResponse (10 tools with full inputSchema):
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tools": [
{"name": "getStatus", "description": "Get camera status: battery, storage, GPS...",
"inputSchema": {"type": "object", "properties": {}, "required": []}},
{"name": "startRecording", "description": "Start video recording. Supports scheduled start...",
"inputSchema": {"type": "object", "properties": {
"clip_name": {"type": "string"}, "quality": {"type": "string"},
"start_at": {"type": "integer"}, "open_gate": {"type": "boolean"},
"hlg10": {"type": "boolean"}}, "required": []}},
{"name": "stopRecording", "description": "Stop the current video recording immediately.", "...": "..."},
{"name": "playTone", "description": "Play sync slate tone for multi-camera alignment.", "...": "..."},
{"name": "listFiles", "description": "List recorded video files on the device.", "...": "..."},
{"name": "deleteFiles", "description": "Delete files matching a glob pattern.", "...": "..."},
{"name": "sftpTransfer", "description": "Transfer file via SFTP with Ed25519 SSH key auth.", "...": "..."},
{"name": "cleanupFiles", "description": "Delete recordings by policy.", "...": "..."},
{"name": "describeClip", "description": "Describe a recording with the on-device model (nano flavor).", "...": "..."}
]
}
}Claude reads this schema and constructs valid requests from natural language —
no documentation, no curl syntax, no certificate management needed by the user.
See MCP Documentation for the full tool catalog with complete
inputSchema definitions.
For complete record-transfer-cleanup workflows, use the included test scripts:
cd kanaha-camera-app
# Single camera: record 10 seconds, transfer to /tmp, delete from camera
./test-single-camera-workflow.sh workflow --duration 10
# Dual camera: simultaneous recording on two phones (Pixel and Moto by default; set PIXEL_IP and MOTO_IP in the script)
./test-dual-camera-workflow.sh --duration 10
# Single camera commands
./test-single-camera-workflow.sh status # Get camera status
./test-single-camera-workflow.sh record # Start recording
./test-single-camera-workflow.sh stop # Stop recording
./test-single-camera-workflow.sh list # List video filesSee mTLS Setup Guide for certificate management and SFTP Setup for SSH key configuration.
Kanaha supports Model Context Protocol (MCP), enabling Claude Desktop and other AI assistants to discover and control cameras as tools. The MCP server is a 117 KB native binary — no JVM, no Python, sub-50ms startup.
See MCP Documentation for setup, tool catalog, and live examples tested on a Pixel 9 Pro.
All endpoints are under /services/CameraControlService/. All requests require mTLS client certificates.
Every curl command below has an MCP equivalent — see MCP docs for
the JSON-RPC 2.0 format.
The URL decides which operation runs. The "action" field the examples below
send is optional on this path and, when present, must name the same operation
as the URL; a request that names a different one is refused. MCP clients send
no URL, so for them "action" is what selects the tool.
| Endpoint | Method | Key Parameters | Description |
|---|---|---|---|
/getStatus |
GET/POST | — | Camera state, battery, storage, timestamp, gps_time, gps_age_ms |
/startRecording |
POST | clip_name, start_at, quality, duration, format, open_gate, hlg10, raw12 |
Begin recording; open_gate: true records the full 4:3 sensor (Pixel 10 Pro XL); raw12: true a 12-bit RAW take; supports scheduled start via start_at (UTC epoch ms) |
/stopRecording |
POST | — | Stop active recording |
/listFiles |
GET/POST | — | List recorded video files with sizes and timestamps |
/deleteFiles |
POST | pattern |
Delete files matching glob pattern |
/sftpTransfer |
POST | storage_server_id, video_filename, destination_folder |
Push files to remote host via SFTP |
/describeClip |
POST | video_filename, frame_count, positions, write_sidecar, max_dimension |
Describe a recording with the on-device model (Gemini Nano, nano flavor only); writes <basename>.kanaha.json |
/setExposure |
POST | auto, lock, iso, exposure_time_ns, wb_kelvin, wb, focus, focus_distance, stabilization, tone, fps, codec, bitrate |
Pin exposure, white balance, focus and stabilization so cameras match; refused out of range or while recording |
/getExposure |
POST | — | Modes in force, live values (feed them to setExposure on other cameras), support flags and ranges |
/setZoom |
POST | ratio, duration_ms, step_ms, start_at, clear |
Zoom at once or as a smooth ramp, now or at a scheduled time, while recording; cues queue, clear cancels them |
/playTone |
POST | frequency, duration_ms, start_at |
Play synthesized sine wave for software sync slate |
start_at parameter (on startRecording and playTone): Pass a future UTC epoch millisecond timestamp. The camera schedules the action internally and returns immediately. Send to multiple cameras simultaneously — each fires at the same wall-clock time regardless of network delivery timing. See Quick Start for curl examples.
startRecording with "raw12": true writes one folder per take, RAW_<clip>_<date>_<time>/, in the app's takes/ directory:
frame_000000.dng, … — every frame, 12-bit, lossless JPEG compressed (DNG Compression 7), 8–12 MB each depending on the scene. Compressed bylibkanaha_dng.so, a separate native program, so the camera never waits on it.take.wav— the audio input for the whole take: with the iRig, the Tentacle's SMPTE timecode.take.gcsv— the phone's gyroscope and accelerometer from the first frame on, in Gyroflow's format, for stabilising in post.take.kanaha_start.json—recording_start_ms(when the first frame was exposed),first_frame_after_first_sample_ms(where that frame falls intake.wav, which ties every frame to timecode), the exposure,motion(the motion log's name, or null), and when the take ends itsframes,dropped,secondsandmotion_samples.
stopRecording waits for every frame to be written and replies with the counts; getStatus carries raw12_take while it runs. listFiles lists each take as one entry ("type": "raw12_take", frames, size), and deleteFiles, cleanupFiles and sftpTransfer treat a take folder as one recording: matched by its folder name or by *, today or a date, deleted whole, sent as a folder. A take still recording is never deleted or sent. tools/kanaha-develop <take folder> develops a take into one ProRes 4444 .mov with its audio and timecode; --stamp-dngs instead writes the timecode into the DNGs for editing them directly; details, timecode and copying takes off the phone in 12-bit_depth.md.
Recording-start sidecar: each recording gets <recording basename>.kanaha_start.json (for VID_20261019_142007.mp4, VID_20261019_142007.kanaha_start.json) in the app's external files directory, written once the recording has started. Contains file, recording_start_ms (when the start fired, to the millisecond; not the first frame), clip_name, open_gate, hlg10 and the GPS fix time if available. sftpTransfer and deleteFiles carry it with its recording. Clips are aligned on SMPTE timecode; the sidecar locates takes.
Control multiple cameras simultaneously with mTLS:
SSL=~/kanaha-certs
# Scheduled simultaneous start — all cameras fire at the same wall-clock millisecond
# regardless of when the HTTP request arrives. Use start_at to eliminate WiFi RTT skew.
START_AT=$(( $(date +%s%N) / 1000000 + 3000 )) # 3 seconds from now
for cam in 192.168.1.{100,101,102}; do
curl -s --http2 \
--cert "$SSL/client.crt" --key "$SSL/client.key" --cacert "$SSL/ca.crt" \
-H "Content-Type: application/json" \
-d "{\"action\":\"startRecording\",\"clip_name\":\"sync_test\",\"start_at\":$START_AT}" \
"https://$cam:8443/services/CameraControlService/startRecording" &
done
wait
echo "All cameras scheduled — firing at $START_AT"The same client certificate works for all cameras when they share a CA.
Matching exposure. Meter on one camera, then send its live values to all of them, so no camera meters its own framing:
VALUES=$(curl -s --http2 --cert "$SSL/client.crt" --key "$SSL/client.key" --cacert "$SSL/ca.crt" \
-H "Content-Type: application/json" -d '{"action":"getExposure"}' \
"https://192.168.1.100:8443/services/CameraControlService/getExposure" \
| jq -c '{action:"setExposure", iso, exposure_time_ns, focus_distance, stabilization:false, fps:30}')
for cam in 192.168.1.{100,101,102}; do
curl -s --http2 --cert "$SSL/client.crt" --key "$SSL/client.key" --cacert "$SSL/ca.crt" \
-H "Content-Type: application/json" -d "$VALUES" \
"https://$cam:8443/services/CameraControlService/setExposure" &
done
waitIdentical phones match only on the same Android build: an OTA update changes the image processing, so update every camera together.
For three-camera workflows with automatic sync slate, SFTP transfer, and post-processing, use test-triple-camera-workflow.sh — it handles address resolution, start_at scheduling, software slate (play_slate_all), file transfer including the sync sidecar, and cleanup in a single script.
See GPS Synchronization for a full explanation of sync accuracy, the start_at architecture, software slating, and comparison with SMPTE/LTC hardware.
The IPC pipeline crosses three threading contexts — the C Apache/Axis2 worker thread, the Android main (UI) thread where onReceive() lands, and the background KanahaCameraControl thread that runs the handlers. See Threading Model for the full model, JMM visibility rules, and guidance when adding new action handlers.
For developers who want to modify the app or native code:
- APK Build Guide - Building the Android app
- Cross-Compilation Guide - Building native libraries
- System Architecture - Complete system documentation
cd kanaha-camera-app
# Both flavours at once
./gradlew assembleDebug
# foss (distributable): app/build/outputs/apk/foss/debug/app-foss-debug.apk
# nano (private use): app/build/outputs/apk/nano/debug/app-nano-debug.apk
# Or one at a time
./gradlew assembleFossDebug
./gradlew assembleNanoDebugThe foss flavour is the default and the only one to distribute. The nano
flavour adds Google's proprietary on-device description client, which cannot be
shipped under GPL v3; see On-Device Clip Description.
- Android: 6.0+ (API 23+) for the
fossbuild, 8.0+ (API 26+) fornano; ARM64 device - Permissions: Camera, Microphone, Storage, Network
- Network: WiFi connection (same network as control station)
Kanaha uses multiple layers of security:
- mTLS Authentication - Client certificates required for all API access
- TLS 1.2/1.3 - Encrypted communications with modern cipher suites
- Certificate Validation - Server verifies client certificates against CA
- No Default Credentials - Users must generate their own certificate chain
See Security Documentation for threat model, certificate management, and security hardening.
| Document | Description |
|---|---|
| Security Guide | Threat model, certificate management, hardening |
| Multi-Camera Deployment | Complete system guide, mTLS setup, API reference |
| SFTP File Transfer | SSH key setup for secure file retrieval |
| Open Gate Recording | Full 4:3 sensor recording, 8- and 10-bit per phone, reframing, LUT grading, C layer build process |
| 12-bit RAW | 12-bit RAW takes: which phones, what a take is, DNG against ProRes, timecode, copying, kanaha-develop |
| 8K Video | Why Kanaha has no 8K on Pixels, open gate as the alternative, local upscaling, and checking other phones for native 8K |
| APK Building | Compiling from source |
| Cross-Compilation | Building native C libraries |
| SMPTE Timecode Setup | iRig Pro I/O + Tentacle Sync hardware timecode setup |
| GPS Synchronization | GPS/NTP soft sync, start_at scheduled recording, software slate (playTone), sync sidecar — vs. SMPTE/LTC for consumer and security use cases |
| Threading Model | IPC pipeline threading: C Apache/Axis2 worker → Android UI thread → background handler; JMM visibility rules, CountDownLatch patterns |
| MCP (AI Assistant) | Model Context Protocol integration — 11 camera tools, Claude Desktop config, live Pixel 9 Pro examples |
| On-Device Clip Description | describeClip: per-clip descriptions from Gemini Nano via ML Kit, the .kanaha.json sidecar, the foss/nano build flavors, and why the nano build is private-use only under GPL v3 |
| C and Java Design | Where Java starts and ends in this app, the Intent seam and its request-file fallback for devices that refuse am, and the licence boundary between OpenCamera (GPL) and the Axis2/C service (Apache 2.0) |
| Why Not the NDK Camera API | The case for replacing OpenCamera with NDK camera code, and why fifteen years of device coverage won the argument |
| Legal Review | License compatibility analysis for Apache httpd, Axis2/C, OpenCamera (GPL v3+), and the proprietary ML Kit client (nano flavor only) |
Control Station Android Device
| |
| HTTPS/HTTP2 + mTLS |
| ─────────────────────────────► |
| [Apache httpd]
| |
| [Axis2/C JSON-RPC]
| |
| [CameraControlService]
| |
| [OpenCamera Engine]
| |
| JSON Response |
| ◄───────────────────────────── |
1 SMPTE timecode recording requires a USB audio interface (iRig Pro I/O) which needs ~500mA of USB power. Phones from ~2021+ (Pixel 6 and later) provide sufficient USB-C power and work with a direct connection. Older phones (pre-2020) lack sufficient USB OTG power for the audio interface to enumerate, making them unsuitable for timecode recording. Camera control, video recording, and all other Kanaha features work on all tested devices. On a device that refuses am from apps, such as the Moto G Play 2024, camera commands reach the camera through a polled request file instead, which adds up to half a second per command; see C and Java in Kanaha Camera. See iRig SMPTE Timecode Setup for details.
GPL v3+ (GNU General Public License version 3 or later)
This license is required because Kanaha incorporates OpenCamera, which is GPL v3+ licensed.
The optional nano build flavor links Google's proprietary ML Kit client for
describeClip. A GPL program may not be distributed with a proprietary library
compiled into it, so nano builds are for private use only and are never
published; the default foss flavor is the distributable one. See
docs/GOOGLE_NANO_INTEGRATION.md.
- OpenCamera - Camera engine
- Apache Axis2/C - Web services framework
- Apache httpd - HTTP/2 server