Document Overview
1.1 Purpose
This guide provides comprehensive technical specifications and step-by-step instructions for developers to remotely access DRIFT cameras, retrieve real-time audio/video streams, achieve bi-directional video communication, control and setup those devices. It is designed to facilitate the integration of DRIFT devices into custom applications (e.g., PC/mobile apps) by leveraging DRIFT’s open APIs and standard protocols (RTSP/RTMP/HTTP).
1.2 Scope
1. Supported Hardware: DRIFT camera models including Ghost XL, Ghost XL Pro, X5, X5 Mini, X3, GHOST 4K+, N1, and N2.
2. Core Functions: Wi-Fi network configuration, real-time RTSP video streaming, RTMP live streaming, audio playback control, camera operation (e.g., recording, photo capture), parameter configuration, and file management.
1.3 Target Audience
Software developers (PC/Android/iOS), embedded system engineers, and technical integrators responsible for building applications that interact with DRIFT cameras.
1. Wi-Fi Network Configuration
DRIFT devices operate in Station Mode, enabling applications to access the camera via a Wi-Fi router or mobile personal hotspot. Two configuration methods are supported: Script File (for batch deployment) and QR Code Scanning (for quick single-device setup).
1.1 Script File Configuration
1.1.1 File Creation & Deployment
1) Create a text file named fmcam.conf (case-sensitive; suffix .conf is mandatory) and populate it with network and stream parameters (see Example 1-1).
2) Save the fmcam.conf file to the root directory of the camera’s Micro SD card (do not place it in subfolders).
Example 1-1: fmcam.conf File Content
router_ssid=foream_dev router_password=foreamqwe123 stream_type=rtsp stream_resolution=720P stream_bitrate=2000000 stream_framerate=30
|
1.1.2 Parameter Description
Parameter Name |
Description |
Valid Values |
Unit |
router_ssid |
SSID (name) of the Wi-Fi router/mobile hotspot |
English characters & numbers only (must match the target network) |
- |
router_password |
Password for the Wi-Fi network |
8–64 characters (leave empty for open networks) |
- |
stream_type |
Type of stream to enable |
Only RTSP (RTSP protocol) |
- |
stream_resolution |
Resolution of the real-time stream |
480P, 720P, 1080P |
- |
stream_bitrate |
Bitrate of the real-time stream |
Up to 6000000 |
bps |
stream_framerate |
Frame rate of the real-time stream |
30, 60 (model-specific; see 1.1.3) |
FPS |
1.1.3 Model-Specific Recommended Settings
Camera Model |
Recommended Resolution |
Recommended Bitrate |
Recommended Framerate |
Notes |
Ghost XL |
720P |
2,000,000 |
30 |
Do not exceed; higher values cause freezing |
Ghost XL Pro / X5 / X5 Mini |
1080P |
6,000,000 |
30 |
Supports up to 1080P |
X3 / GHOST 4K+ |
1080P |
4,000,000 |
30 |
- |
1.1.4 Activation & Deactivation
1) Activation: Power on the DRIFT camera. It will automatically read fmcam.conf from the SD card, connect to the configured Wi-Fi network, and enable streaming.
2) Deactivation:
a) Delete fmcam.conf file from the SD card and reboot the camera to restore default mode.
b) Alternatively, press the Wi-Fi physical button on the camera (when connected) to disconnect manually.
1.2 QR Code Scanning Configuration
This method enables quick Wi-Fi setup when the camera and application are in the same network. The application generates a QR code containing network credentials, then the camera scans it to connect.
1.2.1 QR Code Format
The QR code must follow this fixed structure (fields separated by |):
17|router_ssid|router_password|stream_type |
Field |
Description |
17 |
Fixed value (identifies the QR code as a DRIFT Wi-Fi configuration type) |
router_ssid |
Wi-Fi network name (non-empty) |
router_password |
Wi-Fi password (empty for open networks) |
stream_type |
Stream protocol (only rtsp is supported) |
Example: A QR code for SSID foream_dev, password foreamqwe123, and RTSP stream would encode:
17|foream_dev|foreamqwe123|rtsp
1.2.2 QR Code Generation & Scanning
Generate the QR Code:
a) Use official tools (e.g., https://www.qr-code-generator.com/) to input the format string and generate the QR code.
b) For custom app development, integrate the ZXing Library (open-source barcode scanning for Java/Android: https://github.com/zxing/zxing).
Camera Scanning:
Ensure the camera is in standby mode (Wi-Fi is off, not on recording), activate its QR code scanning function, and align it with the generated QR code. The camera will automatically parse the credentials and connect to the Wi-Fi network.
2. Retrieving the Camera IP Address
Once the camera connects to Wi-Fi, it broadcasts a UDP packet to announce its presence to devices (PC/mobile) on the same network. The packet contains device metadata, and the camera’s IP address is embedded in the UDP message header.
2.1 UDP Broadcast Details
1) Port: 5555 (fixed for DRIFT devices).
2) Packet Format:
5|cam_serial|cam_model|phone_uuid|rtmp_status |
Field |
Description |
5 |
Fixed value (identifies the packet as a DRIFT device announcement) |
cam_serial |
Unique serial number of the camera |
cam_model |
Camera model name (e.g., X5, Ghost XL) |
phone_uuid |
Custom identifier (empty if not configured) |
rtmp_status |
Camera status: N (normal, not streaming) or L (live streaming via RTMP) |
Example Packet Content:
5|86QHPFKVRIR0AB36|X5||N
1) 86QHPFKVRIR0AB36: Camera serial number
2) X5: Camera model
3) Empty phone_uuid
4) N: Normal (non-streaming) status
2.2 IP Extraction
Extract the camera’s IP address from the UDP message header using network tools (e.g., Wireshark, custom UDP listeners). This IP address is required for subsequent HTTP API calls and RTSP streaming.
3. Acquiring Real-Time Video Streams
After establishing a Wi-Fi connection and retrieving the camera IP, use the RTSP protocol to access the real-time video feed. Supported media players include VLC, ijkplayer, and Vitamio.
3.1 RTSP URL Format
rtsp://<Camera_IP>/live |
3. Replace <Camera_IP> with the actual IP address of the camera (e.g., rtsp://192.168.4.148/live).
3.2 Step-by-Step Access (VLC Player Example)
1. Install VLC Media Player on your PC (download from https://www.videolan.org/vlc/).
2. Retrieve the camera’s IP address (e.g., 192.168.4.148; see Section 2).
3. Open VLC, navigate to Media > Open Network Stream.
4. In the "Network URL" field, input the RTSP URL (e.g., rtsp://192.168.4.148/live).
5. Click Play to start viewing the real-time video stream.
4. Live Streaming to an RTMP Server
Use HTTP APIs to configure the camera to push real-time video streams to an RTMP server (cloud or local network).
4.1 Start RTMP Streaming
4.1.1 API Endpoint
http://<Camera_IP>/cgi-bin/foream_remote_control?start_rtmp_with_param=<RTMP_Server_URL>&stream_res=<Resolution>&stream_bitrate=<Bitrate> |
4.1.2 Parameter Description
Parameter |
Description |
<Camera_IP> |
Camera’s IP address (e.g., 192.168.4.148) |
<RTMP_Server_URL> |
RTMP server address (omit rtmp://; e.g., 192.168.3.133:1935/live/5) |
<Resolution> |
Stream resolution (e.g., 720P, 1080P) |
<Bitrate> |
Stream bitrate (in Bps; e.g., 2000000 for 2Mbps) |
4.1.3 Special Handling for & in RTMP URLs
If the RTMP URL contains an & character (common in authentication parameters), replace & with *** to avoid URL parsing errors.
Example:
Original RTMP URL:
rtmp://wxalivepush.weixin.qq.com/live/wx3059da5fb34ccef3-4?txSecret=bc91766cea0589c907c764cdf41d0047&txTime=629f7600
Modified URL for API:
rtmp://wxalivepush.weixin.qq.com/live/wx3059da5fb34ccef3-4?txSecret=bc91766cea0589c907c764cdf41d0047***txTime=629f7600
4.2 Stop RTMP Streaming
4.2.1 API Endpoint
http://<Camera_IP>/cgi-bin/foream_remote_control?stop_rtmp |
Example:
http://192.168.4.148/cgi-bin/foream_remote_control?stop_rtmp
5. Controlling Audio Playback
DRIFT devices support playing audio streams from an RTSP server or audio files (stored locally on the SD card or remotely on a server). Supported audio format: AAC (dual-channel, 16K sampling rate).
Notes:
1) the audio format must follow the spec shown above, otherwise the device can’t play it properly.
2) Only X5 & X5 Mini support this feature.
5.1 Play Audio from an RTSP Server
Action |
API Endpoint |
Configure RTSP audio URL |
http://<Camera_IP>/cgi-bin/foream_remote_control?rtsp_url=<RTSP_Audio_URL> |
Start audio playback |
http://<Camera_IP>/cgi-bin/foream_remote_control?start_rtsp=<RTSP_Audio_URL> |
Stop audio playback |
http://<Camera_IP>/cgi-bin/foream_remote_control?stop_rtsp |
Example:
1) Configure URL: http://192.168.5.181/cgi-bin/foream_remote_control?rtsp_url=rtsp://192.168.5.53/audio_16K.aac
2) Start playback: http://192.168.5.181/cgi-bin/foream_remote_control?start_rtsp=rtsp://192.168.5.53/audio_16K.aac
3) Stop playback: http://192.168.5.181/cgi-bin/foream_remote_control?stop_rtsp
5.2 Play Audio Files
5.2.1 Play Local Audio (SD Card)
1) Save the AAC audio file (e.g., audio_16K.aac) to the camera’s Micro SD card.
2) Use the following API to start playback:
http://<Camera_IP>/cgi-bin/foream_remote_control?play_audio_file=<File_Path> |
Example: http://192.168.5.181/cgi-bin/foream_remote_control?play_audio_file=/tmp/SD0/audio_16K.aac
Test File: Download audio_16K.aac (AAC, dual-channel 16KHz) from https://pan.baidu.com/s/1Vw0nG_LQ0fVrNS7SRDUTcg?pwd=neck (Extraction code: neck).
5.2.2 Play Remote Audio (Network Server)
Use the following API (requires file_size parameter in bytes):
http://<Camera_IP>/cgi-bin/foream_remote_control?play_audio_url=<Remote_Audio_URL>&file_size=<File_Size> |
Example: http://192.168.5.181/cgi-bin/foream_remote_control?play_audio_url=https://api.driftsee.com/resources/voiceCommand/d10705e2a6714d478de2d5087423ffcb.aac&file_size=16598
5.2.3 Stop Audio Playback
http://<Camera_IP>/cgi-bin/foream_remote_control?stop_rtsp |
6. Camera Control via HTTP APIs
Use HTTP APIs to control camera operations (e.g., recording, zoom) and configure parameters (e.g., LED, exposure). Replace <Camera_IP> with the actual camera IP address (e.g., 192.168.4.148).
6.1 Core Operation APIs
Function |
API Endpoint |
Notes |
Zoom |
http://<Camera_IP>/cgi-bin/foream_remote_control?dzoom=<0-10> |
Values: 0 (no zoom) to 10 (max zoom) |
Start recording |
http://<Camera_IP>/cgi-bin/foream_remote_control?start_record |
- |
Stop recording |
http://<Camera_IP>/cgi-bin/foream_remote_control?stop_record |
- |
Switch to Video Mode |
http://<Camera_IP>/cgi-bin/foream_remote_control?switch_video_mode |
Required before recording |
Switch to Photo Mode |
http://<Camera_IP>/cgi-bin/foream_remote_control?switch_photo_mode |
Required before taking photos |
Take a photo |
http://<Camera_IP>/cgi-bin/foream_remote_control?take_photo |
Must be in Photo Mode first |
Reset to default settings |
http://<Camera_IP>/cgi-bin/foream_remote_control?reset_setting |
Restores all parameters to factory defaults |
Reboot camera |
http://<Camera_IP>/cgi-bin/foream_remote_control?reboot |
- |
Power off camera |
http://<Camera_IP>/cgi-bin/foream_remote_control?power_off |
- |
Record with custom filename |
http://<Camera_IP>/cgi-bin/foream_remote_control?record_with_param=<PriName>&sec_id=<SecName> |
Filename format: <PriName>_<SecName> (alphanumeric only). Use mediaInfo API to retrieve the file. |
Example: Record with Custom Filename
1. Start recording with parameters:
http://192.168.4.148/cgi-bin/foream_remote_control?record_with_param=T002&sec_id=L0000001
2. Stop recording:
http://192.168.4.148/cgi-bin/foream_remote_control?stop_record
3. Retrieve file info:
http://192.168.5.62/cgi-bin/foream_remote_control?mediaInfo
Sample Response:
{ "path": "100MEDIA\\VID00024.MP4", "name": "T002_L0000001", "time": "2024-01-01 00:38:55", "size": "69512330" } |
6.2 Camera Parameter Configuration
Parameter |
API Endpoint |
Valid Values |
Status LED |
http://<Camera_IP>/cgi-bin/foream_remote_control?led=<Value> |
1 (On), 0 (Off) |
Exposure Value |
http://<Camera_IP>/cgi-bin/foream_remote_control?exposure=<Value> |
0 (0), 1 (1), 2 (2), 3 (-1), 4 (-2) |
Image Filter |
http://<Camera_IP>/cgi-bin/foream_remote_control?filter=<Value> |
0 (Normal), 1 (Vivid), 2 (Low Light), 3 (Water) |
Mic Sensitivity |
http://<Camera_IP>/cgi-bin/foream_remote_control?mic_sensitivity=<Value> |
0–4 (0 = lowest, 4 = highest) |
Datetime Stamp (Watermark) |
http://<Camera_IP>/cgi-bin/foream_remote_control?stamp=<Value> |
0 (Off), 1 (On) |
Field of View (FOV) |
http://<Camera_IP>/cgi-bin/foream_remote_control?fov=<Value> |
140, 115, 90 |
Thumbnail Generation |
http://<Camera_IP>/cgi-bin/foream_remote_control?thm=<Value> |
0 (Off), 1 (On) |
Language |
http://<Camera_IP>/cgi-bin/foream_remote_control?language=<Value> |
0 (English), 1 (Chinese) |
Set Camera Time |
http://<Camera_IP>/cgi-bin/foream_remote_control?set_time=<YYYY-MM-DD_HH:MM:SS> |
Format: 2021-03-01_09:35:00 (sets time to 2021/03/01 09:35) |
6.3 Live Stream Configuration
Parameter |
API Endpoint |
Valid Values (Model-Specific) |
Stream Resolution |
http://<Camera_IP>/cgi-bin/foream_remote_control?stream_res=<Value> |
Ghost XL/X3: 0 (1080P), 2 (720P), 3 (WVGA) Ghost XL Pro/X5/X5 Mini: 0 (4K), 1 (4KUHD), 2 (2.7K), 3 (1080P), 4 (720P), 5 (WVGA) |
Stream Bitrate |
http://<Camera_IP>/cgi-bin/foream_remote_control?stream_bitrate=<Value> |
In BYTE (e.g., 1000000 = 1MB = 8Mbps). Recommend: 2Mbps (720P), 6Mbps (1080P) |
Stream Framerate |
http://<Camera_IP>/cgi-bin/foream_remote_control?stream_framerate=<Value> |
Value: 30 or 60 |
6.4 Video Recording Configuration
Parameter |
API Endpoint |
Valid Values (Model-Specific) |
Video Resolution |
http://<Camera_IP>/cgi-bin/foream_remote_control?video_res=<Value> |
Same as stream_res (see Section 6.3) |
Video Bitrate |
http://<Camera_IP>/cgi-bin/foream_remote_control?video_bitrate=<Value> |
In BYTE (e.g., 1000000 = 1MB = 8Mbps) |
Video Framerate |
http://<Camera_IP>/cgi-bin/foream_remote_control?video_framerate=<Value> |
Value: 25-240FPS |
Table 6-1: Max Framerates by Resolution (Ghost XL Pro/X5/X5 Mini)
Resolution |
Aspect Ratio |
Max Framerate |
4K (4096×2160) |
17:9 |
24/25 FPS |
4KUHD (3840×2160) |
16:9 |
24/25/30 FPS |
2.7K (2704×1520) |
16:9 |
24/25/30/50 FPS |
1080P (1920×1080) |
16:9 |
24/25/30/50/60/100/120 FPS |
720P (1280×720) |
16:9 |
25/30/50/60/200/240 FPS |
WVGA (854×480) |
16:9 |
25/30 FPS |
7. Camera Status & File Management
7.1 Retrieve Camera Status
7.1.1 API Endpoint (Supported Models: X3, GHOST 4K+, Ghost XL Pro, N1, N2, X5, X5 Mini)
http://<Camera_IP>/cgi-bin/foream_remote_control?get_camera_status |
7.1.2 Sample XML Response
<?xml version="1.0" encoding="utf-8"?> <response> <status>1</status> <cam_status> <camera_status> <capture_mode>0</capture_mode> <!-- 0=Video, 1=Photo, 2=Timelapse, 3=Burst; X5 Mini: 0/1 only --> <battery>100</battery> <!-- Remaining battery (%) --> <sd_free>15804576</sd_free> <!-- Free SD card space (KB) --> <sd_total>31166464</sd_total> <!-- Total SD card space (KB) --> <rec_time>0</rec_time> <!-- Recording time (0 = idle) --> <fw_ver>1127</fw_ver> <!-- Firmware version --> <model_name>X5_Mini</model_name><!-- Camera model --> <time>2024-05-10 12:12:54</time><!-- Camera system time --> </camera_status> <video_setting> <res>2</res> <!-- Video resolution (see Section 6.4) --> <framerate>30</framerate> <!-- Video framerate --> <bitrate>2000000</bitrate> <!-- Video bitrate --> <quality>0</quality> <!-- Video quality (0=Standard) --> </video_setting> <stream_setting> <stream_res>0</stream_res> <!-- Stream resolution (see Section 6.3) --> <stream_framerate>24</stream_framerate> <!-- Stream framerate --> <stream_bitrate>2000000</stream_bitrate> <!-- Stream bitrate --> </stream_setting> <camera_setting> <dzoom>0</dzoom> <!-- Zoom level --> <filter>0</filter> <!-- Image filter --> <exposure>0</exposure> <!-- Exposure value --> <mic>5</mic> <!-- Mic sensitivity --> <led>1</led> <!-- LED status --> <fov>140</fov> <!-- FOV setting --> <thm>0</thm> <!-- Thumbnail status --> <stamp>0</stamp> <!-- Datetime stamp status --> <eis>0</eis> <!-- Electronic Image Stabilization (0=Off) --> <speaker_volume>6</speaker_volume> <!-- Speaker volume (0-10) --> <iso>0</iso> <!-- ISO setting (0=Auto) --> <voice>2</voice> <!-- Voice prompt (2=Enabled) --> <language>1</language> <!-- Language (1=Chinese) --> <cardv>0</cardv> <!-- Car DVR mode (0=Off) --> <cardv_interval>60</cardv_interval> <!-- Car DVR recording interval (seconds) --> <video_timelapse>0</video_timelapse> <!-- Timelapse mode (0=Off) --> <video_timelapse_interval>10</video_timelapse_interval> <!-- Timelapse interval (seconds) --> <wifi_frequency>0</wifi_frequency> <!-- Wi-Fi frequency (0=2.4GHz) --> </camera_setting> </cam_status> <websocket>0</websocket> <!-- WebSocket status (0=Off) --> <deviceid></deviceid> <!-- Device ID (empty if not configured) --> </response> |
7.2 File Management APIs
Function |
API Endpoint |
Notes |
List SD card folders |
http://<Camera_IP>/cgi-bin/foream_remote_control?list_folders=/tmp/SD0/DCIM |
Lists media folders (e.g., 100MEDIA) |
List SD card files |
http://<Camera_IP>/cgi-bin/foream_remote_control?list_files=/tmp/SD0/DCIM |
Lists all media files (JPG/MP4) |
List custom-named videos |
http://<Camera_IP>/cgi-bin/foream_remote_control?mediaInfo |
Lists videos recorded with record_with_param |
Delete a single file |
http://<Camera_IP>/cgi-bin/foream_remote_control?delete_media_file=<File_Path> Example: http://192.168.5.56/cgi-bin/foream_remote_control?delete_media_file=100MEDIA/VID00003.MP4
|
|
Delete multiple files |
http://<Camera_IP>/cgi-bin/foream_remote_control?delete_media_multifiles=<multi File_Paths>
Example:
|
|
7.2.1 Special Handling for iOS Apps (Multiple File Delete)
For iOS, replace the | separator with *%7C* to comply with URL encoding rules:
http://<Camera_IP>/cgi-bin/foream_remote_control?delete_media_multfiles=3*%7C*100MEDIA/VID00003.MP4*%7C*100MEDIA/VID00004.MP4*%7C*100MEDIA/VID00005.MP4 |
7.2.2 Preview/Download Media Files
Use the following URL format to preview or download files directly:
http://<Camera_IP>/DCIM/<Folder_Name>/<File_Name> |
Examples:
1) Preview MP4: http://192.168.4.148/DCIM/100MEDIA/VID00001.MP4
2) Download JPG: http://192.168.4.148/DCIM/100MEDIA/PH000011.JPG
Glossary
1) RTSP: Real-Time Streaming Protocol (for retrieving real-time video from the camera).
2) RTMP: Real-Time Messaging Protocol (for pushing live streams to a server).
3) UDP: User Datagram Protocol (for camera IP broadcast).
4) Station Mode: Wi-Fi mode where the camera acts as a client (connects to a router/hotspot).
SDK Source Code Download
iOS development source code iOS demo code
Android development source code: Android demo code
Note: If you are interested in delving deeper into this category and wish to explore more details (such as technical support, customization needs, or project collaboration), please send an email to sales@driftsee.com. In your email, kindly explain your specific requirements or objectives—this will help us provide you with more targeted assistance.