• 小D视讯系列
  • X1+

    X1+

小D视讯

第一视角视频通话

小D图传

多机位移动直播

小D即视

穿戴式拍摄,视频维保

小D智影

智能云剪辑,自动分析视频

小D全景

全景拍摄,子弹时间

小D开源

开放平台

附件保存

2019-03-19浏览(115)

Drift Camera Remote Control API

2019-03-04浏览(133)


1  Overview

 

This document provides the client APP the guide how to control Drift cameras over network such as taking photo, configuring setting or getting the live stream from camera. The command transfer protocol is TCP/IP,  and the command set is defined in JSON format.

 

1.png 

    Figure 1-1.  Communication between a Handhold Device and Drift Camera.

 

1.1  The Sequential Diagram of Command

 

The APP in the following pictures represents the client which might have connection ability. Every request from the client must have a response which is send out by the camera. The camera can only be controlled with an unique client.

 

The APP establishes a tcp connection with the camera on 7878 port over network for request, response and notification before the session starts.  Every application should get the session from the camera first before any operations are performed.

 

2.png 

 

1.2 JSON command

 

Any client capable of issuing JSON commands over network can control one or more GHOST X cameras. For comprehensive detail on JSON syntax, please refer to http://json.org.

 

JSON command from the client to the Camera follow simple key:value pairs. Each pair is separated by a comma "," and each key is in the form of a string wrapped in quotation marks "."  The value may take the form of alphanumeric character. For example,

 

{"token":0, "msg_id":1}

 

The arguments in the commands above are defined:

 

• token - Session token. Only one App client can connect to one camera at a time. The token number will change with every session.

• msg_id - Command number. This is the number assigned to a particularly remote command.

 

1.3   Establish Connection

 

In the normal operations, the client will send the request command to the camera and the camera will give the response of the operation result to the client. Before the client sends any request command, it should connect to command server on port 7878 by using TCP socket. The client will keep the connections until it wants to disconnect, and the camera will not issue close connection with the client actively.

 

1.4  Get Valid Token

 

The camera has a valid token management mechanism. Therefore, the client should check whether it can get a valid token or not, If the client fails to get a valid token and start session, the client should break this connection with the camera and check what error has occurred. When the connection is broken, it means that the valid token has been acquired by other client. That is to say, the camera is controlled by one client at the same time. It is not possible to control the camera through multiple clients at the same time.

 

1.5  Response

 

The client must check whether it can get the return value of zero or not after it sends out the request command. If the client gets a non-zero return value, it should perform appropriate error handling. However, the client also should handle notification which the camera send out. Notification is not necessary for each request command which the client sends out, but the response is necessary for each request command which the client sends out.

 

1.6  Examples of communication between App Client and Camera: How to take photos?

 

Step1. Build TCP connection on port 7878 with Drift Camera.

Step2. Issue "START_SESSION" command and got the TokenNumber.

Step3. Issue “ RECORD_START” command to switch the mode to photo mode.

Step4. Issue " RECORD_STOP" command and the final filename will be returned if the process if taking photo is completed successfully.

Step4. Issue other command.

Step5. Issue "STOP_SESSION" command to stop session.

Step6. Disconnect with Drift Camera.

 

1.7 Example Code in C language

int tcp_send_cmd(void)

{

 

int  err,iLen;

SOCKET sockSrv = socket(AF_INET,SOCK_STREAM,0);

if(sockSrv == INVALID_SOCKET){

printf("socket error\n");;

return -2;

}

 

SOCKADDR_IN addrSrv;

addrSrv.sin_family = AF_INET;

addrSrv.sin_addr.S_un.S_addr = inet_addr("192.168.42.1");

addrSrv.sin_port = htons(7878);

 

           int ret = connect(sockSrv,(SOCKADDR*)&addrSrv,sizeof(SOCKADDR));

if (ret>=0)

{

 

char sndbuf[256]={0};

char recvbuf[1024]={0};

 

// StartSession

strcpy(sndbuf, "{\"msg_id\": 257, \"token\": 0}");

ret=send(sockSrv,sndbuf,strlen(sndbuf)+1,0);

// recv response

memset(recvbuf,0x00,sizeof(recvbuf));

ret=recv(sockSrv, recvbuf, 256, 0);

 

// start record

strcpy(sndbuf, "{\"msg_id\": 513, \"token\": 2}");

ret=send(sockSrv,sndbuf,strlen(sndbuf)+1,0);

// recv response

memset(recvbuf,0x00,sizeof(recvbuf));

ret=recv(sockSrv, recvbuf, 256, 0);

 

//stop record

strcpy(sndbuf, "{\"msg_id\": 514, \"token\": 2}");

ret=send(sockSrv,sndbuf,strlen(sndbuf)+1,0);

// recv response

memset(recvbuf,0x00,sizeof(recvbuf));

ret=recv(sockSrv, recvbuf, 256, 0);

 

// stop session

strcpy(sndbuf, "{\"msg_id\": 258, \"token\": 2}");

ret=send(sockSrv,sndbuf,strlen(sndbuf)+1,0);

// recv response

memset(recvbuf,0x00,sizeof(recvbuf));

ret=recv(sockSrv, recvbuf, 256, 0);

}

closesocket(sockSrv);

return 0;

}

 

1.8 Examples Tools to test the API commands.

     We also provide the Windows Tools to help to verifying actions in  Drift camera .

3.png 

 

 

2 Session Commands

 

2.1 START_SESSION

Message ID: msg_id: 0x00000101(257)

Description:  This API is used to request the start of a session from the handheld to the camera.

Direction:  From the APP to the camera.

Returns:  Return value (rval) and the session TokenNumber used in all subsequent command   exchanges.

Example:

Start session and get the token number::

{"token": 0, "msg_id":257}

Successful return:

{"rval":0,"msg_id":257,"param":TokenNumber}

Error return:

{"rval":-3,"msg_id":257}  //someone holds the session

 

2.2 STOP_SESSION

Message ID:  msg_id: 0x00000102(258)

Description:   This API is used to request session termination between the APP and the camera.

Direction:   From the APP to the camera.

Example:

Stop session:

{"token":TokenNumber, "msg_id":258}

Successful return:

{"rval":0,"msg_id":258}

 

3 Capture Commands

 

3.1   RECORD_START

Message ID: msg_id: 0x00000201(513)

Description:  This API is used to initiate camera video recording.

Direction:  From the APP to the camera.

Example:

Start recording:

{"msg_id" : 513,"token" : 1}

Successful return:

{"rval":0,"msg_id": 518}

 

3.2   RECORD_STOP

Message ID: msg_id: 0x00000202(514)

Description: This API is used to terminate camera video recording on the camera.

Direction:  From the APP to the camera.

Example:

Stop recording:

{"msg_id" : 514,"token" : 1}

Successful return:

{"rval":0,"msg_id":514}

 

3.3   TAKE_PHOTO

Message ID: msg_id: 0x00000301(769)

Description:  This API is used to capture a still image.

Direction:  From the APP to the camera.

Example:

Take photo:

{"msg_id" : 769,"token" : 1}

Successful return:

{"rval":0,"msg_id":769}

 

3.4   START_TIMELAPSE_TAKE_PHOTO

Message ID: msg_id: 0x00000301(769)

Description: This API is used to capture a serial of timelapse image.

Direction:  From the APP to the camera.

Example:

Start timelapse capture:

{"msg_id" : 769,"token" : 1}

Successful return:

{"rval":0,"msg_id":769}

 

3.5   STOP_TIMELAPSE_TAKE_PHOTO

Message ID: msg_id: 0x00000302(770)

Description:  This API is used to capture a still image.

Direction:  From the APP to the camera.

 

Example:

Stop timelapse capture:

{"msg_id" : 770,"token" : 1}

Successful return:

{"rval":0,"msg_id":770}

 

4 Switch Mode command

 

4.1   SWITCH_RECORD_MODE

Message ID:  msg_id: 0x0000012(18)

Description:  This API is used to switch the capture mode to record mode.

Direction:   From the APP to the camera.

Example:

Switch to video mode:

{"msg_id" : 18,"token" : 1}

Successful return:

{"rval":0,"msg_id": 18}

 

4.2   SWITCH_SINGLE_PHOTO_MODE

Message ID:  msg_id: 0x0000013(19)

Description:  This API is used to switch the capture mode to single photo mode.

Direction:   From the APP to the camera.

Example:

Switch to photo mode:

{"msg_id" : 19,"token" : 1}

Successful return:

{"rval":0,"msg_id": 19}

 

4.3   SWITCH_PHOTO_TIMELAPSE_MODE

Message ID:  msg_id: 0x0000014(20)

Description:  This API is used to switch the capture mode to single photo mode.

Direction:   From the APP to the camera.

Example:

Switch to timelapse mode:

{"msg_id" : 20,"token" : 1}

Successful return:

{"rval":0,"msg_id": 20}

 

5 System Commands

 

5.1 GET_DEVICEINFO  

Message ID:  msg_id: 0x0000000b(11)

Description:  This API is used to retrieve information related to the camera device itself, such as the model name, serial number and firmware version.

Direction:   From the APP to the camera.

Example:

Get device information:

{"token": TokenNumber, "msg_id":11}

Successful return:

{"rval":0,"msg_id":11,"brand":"Foream","model":"GHOST X","fw_ver":"1523","serial_number":"62EJTMYXUPF8IR63","mac":""}

 

5.2 GET_DEVICE_STATUS  

Message ID:  msg_id: 0x00000011(17)

Description:  This API is used to retrieve current status related to the camera device itself, such as the recording status, capture mode etc..

Direction:   From the APP to the camera.

Example:

Get device status:

{"token": TokenNumber, "msg_id":17}

Successful return:

{"rval":0,"msg_id":17,"video_resolution":"1","video_frame":"0","photo_size":"0","capture_mode":"1","adapter":"1","battery":"60","available":"15027072","capacity":"15151104","rec_timelapse":"0","vdzoom_step":"0"}

 

5.3   FORMAT

Message ID:  msg_id: 0x00000004(4)

Description:  This API is used to format the camera SD card.

Direction:   From the APP to the camera.

Example:

Format SD card:

{"msg_id" : 4,"param" : "C:","token" : 1}

Successful return:

{"rval":0,"msg_id":4}

 

5.4   VIDEO_DZOOM

Message ID:  msg_id: 0x0000001E(30)

Description:  This API is used to digital dzoom .

Direction:   From the APP to the camera.

Example:

Digital dzoom to 5X:

{"msg_id" : 30,"param" : "5:","token" : 1}

Successful return:

{"rval":0,"msg_id":30}

 

5.5  RESET_SETTING

Message ID:  msg_id: 0x0000001D(29)

Description:  This API is used to restore the setting to default the factory default value .

Direction:   From the APP to the camera.

Example:

Reset setting:

{"msg_id" : 29,"token" : 1}

Successful return:

{"rval":0,"msg_id":29}

 

 

6 Setting Commands

 

6.1   GET_ALL_CURRENT_SETTINGS

Description:  This API is used to retrieve all setting related to the camera device itself, such as the video resolution, photo size etc.

Direction:   From the APP to the camera.

Example:

Get all settings of device:

{"token": TokenNumber, "msg_id":3}

Successful return:

{"rval":0,"msg_id":3,"param":[{"video_resolution":"0"},{"video_frame":"1"},{"photo_size":"2"},{"timelapse_size":"2"},{"timelapse_interval":"0"},{"burst_size":"0"},{"burst_rate":"2"},{"fov":"2"},{"exposure":"0"},{"self_timer":"0"},{"video_quality":"1"},{"video_filter":"0"},{"iso":"0"},{"video_tagging":"0"},{"video_tagging_interval":"0"},{"car_dvr_mode":"0"},{"car_dvr_loop_interval":"1"},{"mic_sensitity":"3"},{"speaker_volume":"3"},{"led_indicator":"1"},{"wifi":"2"},{"stand_record":"0"},{"date":"2018-09-28 19

:05:22"},{"date_stamp":"0"},{"language":"0"},{"camera_off":"0"},{"thumbnails":"1"},{"capture_mode":"0"},{"stream_resolution":"0"},{"stream_bitrate":"0"},{"stream_type":"0"},{"streaming":"0"},{"video_res_frame":"256"}]}

Note: The setting value please refer to “setting item define”.

 

6.2   SET_SETTING

Message ID:  msg_id: 0x00000002(2)

Description:  This API is used to set the single setting related to the camera device itself, such as the video resolution, photo size etc.

Direction:   From the APP to the camera.

Example:

Set the video resolution to 1080P

{"msg_id" : 2,"param" : "3","token" : TokenNumber,"type" : "video_resolution"}

Successful return:

{ "rval": 0, "msg_id": 2 , "param": "1"}

   

7 NOTIFICATION

 

Message ID:  msg_id: 0x00000007(7)

Description:  Notifications are send from the camera to the APP to notify it of events, such as manual button presses and task completions.

Direction:   From the camera to APP

 

Notification List:

start_video_record:      start record button pressed

start_photo:    photo capture button pressed

start_burst:              photo capture button pressed on burst mode

start_timelapse_capture:   start photo timelapse button pressed

Example:

{ "msg_id": 7, "type": "start_timelapse_capture" }

 

switch_to_video_mode:    mode button pressed and switch to video mode

switch_to_photo_mode:      mode button pressed and switch to photo mode

switch_to_timelapse_mode:  mode button pressed and switch timelapse mode

switch_to_burst_mode:  mode button pressed and switch to  timelapse mode

Example:

{ "msg_id": 7, "type": "switch_to_cap_mode" }

 

photo_taken:    complete photo taken and return the photo path and the free space

Example: { "msg_id": 7, "type": "photo_taken" ,"param":{"path":"/tmp/fuse_d/DCIM/100MEDIA/IMGN0033.jpg","available":4526816}}

video_record_complete:      complete recording and return the video path and the free space

Example:

{ "msg_id": 7, "type": photo_taken" ,"param":{"path":"/tmp/fuse_d/DCIM/100MEDIA/IMGN0033.jpg","available":4526816}}

 

battery:    battery changed, and return the battery value

Example: { "msg_id": 7, "type": "battery" ,"param": 40}

adapter:    USB cabel connected

Example:

 { "msg_id": 7, "type": "adapter" ,"param":0}

 

sd card status:              card inserted or removed

Example: { "msg_id": 7, "type": "sd_card_status" ,"param":"remove"}

    { "msg_id": 7, "type": "sd_card_status" ,"param":"insert"}

 

Error notification:

STORAGE_RUNOUT

STORAGE_IO_ERROR

LOW_SPEED_CARD

CARD_REMOVED

 

8 Stream Commands

 

8.1   STOP_STREAM

Message ID:  msg_id: 0x0000001A(26)

Description:  This API is used to stop stream preview.

Direction:   From the APP to the camera.

Example:

Stop streaming:

{"msg_id" : 26,"token" : 1}

Successful return:

{"rval":0,"msg_id":26}

 

8.2   START_STREAM

Message ID:  msg_id: 0x0000001B(27)

Description:  This API is used to start stream preview.

Direction:   From the APP to the camera.

Example:

Start streaming:

{"msg_id" : 27,"token" : 1}

Successful return:

{"rval":0,"msg_id":27}

 

9 File System Command

 

9.1   DEL_FILE

Message ID:  msg_id: 0x00000501(1281)

Description:  This API is used to delete a file.

Direction:   From the APP to the camera.

Example:

Delete a file:

{"msg_id" : 1281,"token" : 1,param:”/tmp/SD0/DCIM/100MEDIA/VID00001.MP4”}

Successful return:

{"rval":0,"msg_id":1281}

 

9.2   LS

Message ID:  msg_id: 0x00000502(1282)

Description:  This API lists the contents of the directory which is current or specified by parameter, analogous to the command ls.

Direction:   From the APP to the camera.

Example:

{"msg_id" : 1282,"token" : 1,param:”/tmp/SD0/}

Successful return:

{"rval":0,"msg_id":1282,"listing":[{"FOREAM X1":"2015-01-12 04:52:56"},{"DCIM/":"2015-01-01 00:24:20"},{"MISC/":"2015-01-01 00:24:24"},{"EVENT/":"2018-09-14 14:06:58"},{"sdlog_sdlog.txt":"2015-01-12 04:18:30"},{"fmcam.conf":"2018-09-25 15:47:24"}]}

 

9.3   CD

Message ID:  msg_id: 0x00000503(1283)

Description:  This API changes current working directory, analogous to the command cd.

Direction:   From the APP to the camera.

Example:

{"msg_id" : 1283,"token" : 1,param:”/tmp/SD0/}

Successful return:

{"rval":0,"msg_id":1283,"pwd":"/tmp/SD0"}

 

9.4   PWD

Message ID:  msg_id: 0x00000504(1284)

Description:  This API obtains current working directory, analogous to the command pwd.

Direction:   From the APP to the camera.

Example:

{"msg_id" : 1284,"token" : 1}

Successful return:

{"rval":0,"msg_id":1284,"pwd":"/tmp/SD0"}

 

9.5   GET_FILE

Message ID:  msg_id: 0x00000505(1285)

Description:  This API is used to retrieve a file.

Direction:   From the APP to the camera.

4.png 

5.png 

6.png 

 

10 Bluetooth Live stream Command

 

Message ID:  msg_id: 0x00000020(32)

Description:  This API set the Wi-Fi router SSID,Password and the live stream information such as resolution, bitrate etc. Through Bluetooth protocol.

Direction:   From the APP to the camera.

Example:

{"msg_id" : 32,"token" : 1,param:{router_ssid:foream_test,router_password:1234567890, rtmp_url:”rtmp://115.231.182.113:1935/livestream/hy9ekxmn”,stream_resolution:WVGA,stream_bitrate:3000000, rtmp_cbr:1}}

router_ssid:  router (AP) ssid

router_password:  router (AP) password.

rtmp_url: live stream address

 “stream_resolution”: it is used to set the video streaming resolution, the value can be set below:

² 4KUHD:  3840*2160

² 1080P:   1920*1080

² 720P:    1280*720

² WVGA:   848*420

 “stream_bitrate”: it is used to set the video streaming bitrate, value 1000000 means 1Mbps, value 25000000 means 25Mbps, value 800000 means 800kbps.

rtmp_cbr: it means if it use the constant bitrate when live stream.

Successful return:

{"rval":0,"msg_id":30}

 

11 setting items define

 

"video_resolution"

0: 1080P [1920*1080], support 25fps, 30fps

1:        960P1280*960[], support 25fps, 30fps

2:  720P  [1280*720], support 25fps, 30fps, 50fps, 60fps

3:  WVGA  [848x480], support 25fps, 30fps, 50fps, 60fps

 

"video_frame" :

0: 25fps

1: 30fps

2: 50fps

3: 60fps

 

"photo_size" :

0: 12M

1: 8M

2: 4M

 

“timelapse_size” :

0: 12M

1: 8M

2: 4M

 

“timelapse_interval” :

0:   1s

1:   2s

2:   3s

3:   5s

4:   10s

5:   30s

6:   1m

7:   2m

8:   5m

9:   10m

10:   30m

11:    1h

 

“burst_size” :

0: 4M

 

“burst_rate” :

0:    5p

1:    10p

2:   15p

 

“fov” :

0: 90

1: 115

2: 140

 

“exposure” :

0:     0

1: +1

2: +2

3:    -1

4:     -2

 

“self_timer” :

0: off

1: 3s

2: 5s

3: 10s

 

“video_quality” :

0: high

1: medium

2: low

 

“video_filter” :

0: normal

1: vivid

2: lowlight

3: water

 

“iso” :

0: 0

1: 100

2: 200

3:     400

4:     800

 

“video_tagging” :

0: Disable

1: Enable

 

“video_taggint_interval” :

0: 10s

1: 30s

2: 1m

3: 2m

 

“car_dvr_mode” :

0: Disable

1: Enable

 

“car_dvr_loop_interval” :

0: 10s

1: 30s

2: 1m

3: 2m

4: 5m

5: 10m

 

“mic_sensitity” :

0: off

1: 1

2: 2

3: 3

4: 4

5: 5

 

“speaker_volume” :

0: off

1: low

2: medium

3: high

 

“led_indicator” :

0: off

1: on

 

“wifi” :

0: disconnect

1: AP mode

2: Sta mode

 

“date_stamp” :

0: disable

1: enable

 

“language” :

0: english

1: chinese


“camera_off” :

0: off

1: 2m

2: 5m

3: 10m

4: 20m

 

“date_stamp” :

0: off

1: on

 

“thumbnails” :

0: off

1: on

 

capture_mode” :

0: video mode

1: photo mode

2:      timelapse_mode

3:      burst_mode

 

 

 



Drift智能剪辑开发SDK文档

2019-03-04浏览(126)


Drift智能剪辑 API是一种访问Drift剪辑服务器的简单方法,用于创建高质量视频并使其可供下载。通过选择自己喜欢的主题风格或音乐(不选择则智能匹配),将需要剪辑的文件URL及主题、音乐等参数提交剪辑接口即可,任务创建成功后,系统会返回任务ID,通过该ID来获取剪辑。

使用条件

使用剪辑API您只需申请API密钥

协议

Drift API请求使用标准的GET / POST HTTP方法; 响应采用JSON格式。

JSON中返回的数据始终包含“status”字段,其中包含两个值之一:“OK”或“FAIL”。在“FAIL”的情况下,将提供一个或多个附加字段,其中包含解释失败的信息。

流程

TIM截图20190304100822.png


认证

API身份验证使用Drift提供的API KEY和API SECRET执行。这些密钥用于为每个API请求生成唯一的请求签名。每个API请求必须具有以下授权字段:

api_key:Drift提供的API KEY。

api_signature:请求的签名。有关如何创建签名的详细信息,请参阅下面的签名生成。

api_timestamp:RFC3339格式的请求的时间戳。

签名生成

使用以下过程生成签名:

1. 以格式创建规范字符串,请求URL:请求主机:请求时间戳。例如:/smartvideo/create:api.driftlife.co:2018-08-08T18:30:02Z

2. 使用SHA-256哈希函数使用Drift API SECRET键创建上述字符串的HMAC(RFC 2104)3. 创建摘要的base 64编码字符串

签名示例:

import datetime

import base64, hmac, hashlib

import json

import requests

 

API_KEY = '

API_SECRET = '

HOST = 'api.driftlife.co'

 

def canonical_string(url, host, timestamp):

    return "{}:{}:{}".format(url, host, timestamp)

 

 

def sign_request(api_secret, url, host, timestamp):

    canonical = canonical_string(url, host, timestamp)

    sig_hmac = hmac.new(api_secret, canonical, digestmod=hashlib.sha256)

    b64_hmac = base64.encodestring(sig_hmac.digest()).strip()

    return b64_hmac

 

 

def request(path, extra_data=None, protocol='http'):

 

    if not extra_data or not isinstance(extra_data, dict):

        extra_data = {}

        

    timestamp = datetime.datetime.utcnow().isoformat("T") + "Z"

    api_signature = sign_request(API_SECRET, path, HOST, timestamp)

    

    data = {'api_key': api_key,

            'api_signature': api_signature,

            'api_timestamp': timestamp}

            

    data.update(extra_data)

 

    headers = {'Content-Type': 'application/json'}

    response = requests.post('{}://{}{}'.format(protocol, HOST, path), data=json.dumps(data), headers=headers)

    

    return json.loads(response.text)


接口

一、 选择主题

URL

/smartvideo/themes

返回结果(JSON)

正确

status

1

tips


data

themes主题列表,见Theme Object说明

错误

status

0

tips

提示信息

data


Theme Object说明

Field

Type

Descripton

theme_id

String

theme id

name

String

主题名称

desc

String

主题说明

large_thumb_url

String

大缩略图地址

thumb_url

String

缩略图地址

preview_url

String

Demo地址

Theme Object示例:

{

    "name": " Happy Holidays!",

    "preview_url": "http://musiclib.sightera.com.s3.amazonaws.com/theme/holidays_2017/187/example.mp4",

    "theme_id": "187",

    "thumb_url": "http://musiclib.sightera.com.s3.amazonaws.com/theme/holidays_2017/187/thumb.jpg",

    "large_thumb_url": "http://musiclib.sightera.com.s3.amazonaws.com/theme/holidays_2017/187/lthumb.jpg",

    "desc": "Celebrate ALL season long with this festive theme! Make your own holiday greeting to share with family and friends"

}

接口调用示例:

def get_themes(api_key, api_secret, host='api.driftlife.co'):

    url = '/smartvideo/themes'

    

    timestamp = datetime.datetime.utcnow().isoformat("T") + "Z"

    sig = sign_request(api_secret, url, host, timestamp)

    

    data = {'api_key': api_key,

            'api_signature': sig,

            'api_timestamp': timestamp}

 

    response = requests.get('https://{}{}'.format(host, url), data)

    

    return response

二、 选择音乐

URL

/smartvideo/tracks





返回结果(JSON)

正确

status

1

tips


data

tracks主题列表,见下面Track Object说明

错误

status

0

tips

提示信息

data


Track Object说明

Field

Type

Descripton

track_id

String

track id

name

String

音乐名称

preview_url

String

Mp3预览地址

thumb_url

String

缩略图地址

album

String

专辑

artist

String

艺术家

licensed

Boolean

是否有版权

Track Object示例:

{

    "album": "",

    "name": "Together We Can",

    "artist": "Nicholas Michael Hill",

    "preview_url": "http://local.musiclib.sightera.com.s3.amazonaws.com/tracknew/nicholas_michael_hill_564/together_we_can_564_pr.mp3",

    "track_id": "23471",

    "thumb_url": "http://local.musiclib.sightera.com.s3.amazonaws.com/tracknew/nicholas_michael_hill_138/together_we_can_138.jpg",

    "licensed": true

}

接口访问示例:

def get_tracks(api_key, api_secret, host='api.driftlife.co'):

    url = '/smartvideo/tracks'

    

    timestamp = datetime.datetime.utcnow().isoformat("T") + "Z"

    sig = sign_request(api_secret, url, host, timestamp)

 

    data = {'api_key': api_key,

            'api_signature': sig,

            'api_timestamp': timestamp,

            'filter_tags': {'name': 'instrumental'}

    }

 

    headers = {'Content-Type': 'application/json'}

    response = requests.post('https://{}{}'.format(host, url), json.dumps(data), headers=headers)

    

    return response


三、 制作视频

URL

/smartvideo/create

请求参数

参数名称

类型

说明

必填

sources

[]

资源源文件列表,如:sources = [{'url': 'https:///1.jpg'}, {'url': 'https:///2.jpg'},{'url': 'https:///3.jpg'},{'url': 'https:///4.jpg'},{'url': 'https:///5.jpg'},{'url': 'https:///6.jpg'},{'url': 'https:///9.jpg'}]

必填

track_id

int

通过tracks获取的曲目id,默认智能选择

可选

theme_id

int

通过themes获取的主题id,默认智能选择

可选

quality

string

结果视频的质量。默认质量是'sd'。根据您的帐户配置,您可以传递以下值:'fullhd','hd','hq','sd'。

可选

product_name

string

显示的文字

可选

logo_url

string

logo地址

可选





返回结果(JSON)

正确

status

1

tips


data

video_sessions

错误

status

0

tips

提示信息

data


接口访问示例:

def create_video(api_key, api_secret, host='api.driftlife.co'):

    url = '/smartvideo/create'

 

    timestamp = datetime.datetime.utcnow().isoformat("T") + "Z"

    sig = sign_request(api_secret, url, host, timestamp)

 

    data = {'api_key': api_key,

            'api_signature': sig,

            'api_timestamp': timestamp}

 

    sources = [

        {'url': 'https://secure.api.driftlife.co/1.jpg'},

        {'url': 'https://secure.api.driftlife.co/2.jpg'},

        {'url': 'https://secure.api.driftlife.co/3.jpg', 'mandatory': 'as-is'},

        {'url': 'https://secure.api.driftlife.co/4.jpg'},

        {'url': 'https://secure.api.driftlife.co/5.jpg', 'mandatory': 'as-is'},

        {'url': 'https://secure.api.driftlife.co/6.jpg', 'mandatory': 'as-is'},

        {'url': 'https://secure.api.driftlife.co/7.jpg', 'mandatory': 'as-is'}]

 

    data['sources'] = sources

    data['product_name'] = 'Hello Drift'

 

    data['logo_url'] = 'https://secure.api.driftlife.co/drift.png'

 

    headers = {'Content-Type': 'application/json'}

    response = requests.post('https://{}{}'.format(host, url), json.dumps(data), headers=headers)

    

    return response


四、 获取视频

URL

/smartvideo/get

请求参数

参数名称

类型

说明

必填

video_session_id

string

create时返回的video_session_id

必填





返回结果(JSON)

正确

status

1

tips


data

video_session包含下载url及progress等

错误

status

0

tips

提示信息

data


接口访问示例:

def get_video(api_key, api_secret, host='api.driftlife.co'):

    url = '/smartvideo/get'

 

    timestamp = datetime.datetime.utcnow().isoformat("T") + "Z"

    sig = sign_request(api_secret, url, host, timestamp)

 

    data = {'api_key': api_key,

            'api_signature': sig,

            'api_timestamp': timestamp,

            'video_session_id': 'video_session_id'

    }

 

    response = requests.get('https://{}{}'.format(host, url), data)

    

    return response



网卡模组说明书

2019-02-27浏览(165)

,规格

名称:有线网卡模组

网速:100Mbps

接口:RJ45

POE供电:支持

视频流协议支持:RTSP,RTMP,H264 RAW.

视频流格式:H264视频编码,AAC音频编码

功能:把GHOST 4K/GHOST X的视频流通过网线传输到PC端或者云直播平台,支持斗鱼,虎牙,YY等各大主流直播平台。

外观:

8.png 

二,PC端通过RTSP获取相机的视频流

    1. 相机固件版本号: GHOST 4K为1.6.2.1以上,GHOST X为1.2.8.1以上

    2. 准备一张SD卡,在根目录下建立一个fmcam.conf文件(请注意有些系统配置会自动加上.txt的扩展名变为“fmcam.conf.txt”,请注意删除.txt,确保文件名只为“fmcam.conf”)

            usb_asix=1

            usb_asix_ip=192.168.5.2

            usb_asix_gateway=192.168.5.1

            usb_asix_mask=255.255.255.0

            stream_resolution=4KUHD

            stream_bitrate=25000000

2.png

配置说明:

usb_asix”表示相机使用有线网卡模式,相机开机检测到到这个文件,并判断 “usb_asix”关键字为”1”的话,相机开机后会开启有线网卡模式,这时相机的USB端口会被禁用。

usb_asix_ip”设置为相机的静态IP地址,此IP地址不要与局域网已有的IP地址冲突。

usb_asix_gateway”设置为局域网的网关地址。

usb_asix_mask”设置为局域网的子网掩码。

“usb_asix_ip”,“usb_asix_gateway”和“usb_asix_mask”三个中一个为空,或三个都为空时, 相机会采用动态分配IP,动态分配IP通常在直播中使用, 如果是RTSP获取相机视频流建议采用静态分配IP地址。

stream_resolution”用于设置相机视频流的分辨率,可以为”4KUHD/1080P/720P/WVGA”, 均为30fps, 分别代表如下分辨率:

            4KUHD:  3840*2160

            1080P:   1920*1080

            720P:    1280*720

            WVGA:   848*420

“stream_bitrate”用于设置相机视频流的码率,其中1000000代表1Mbps, 25000000代表25Mbps,  800000代表800kbps.

3. 把有线网卡模块插到相机的的30Pin接口处,确保网卡红灯亮。(注意如果使用的是GHOST 4K不要插入普通的USB线连电脑,或充电器)相机开机后进入有线网卡模式后,网卡的绿色指示灯会亮, 如果IP,网关配置正常,接上网线后,ping通网关后,相机的WIFI灯会变绿。

微信图片_20190307153824.png 

 

    4. 获取RTSP视频流

        PC安装VLC播放器, 在菜单“媒体/打开网络串流”中输入“rtsp://192.168.5.2/live”,即可获得RTSP协议的视频流, 其中“192.168.5.2”为相机的IP地址。

4.png

 

三、相机有线RTMP直播

    如果要使用相机直播,首先要生成一个有效的直播地址,把这个地址写到脚本文件中,如:

        usb_asix=1

        stream_resolution=1080P

        stream_bitrate=4000000

        rtmp_url=rtmp地址

    以上的配置直播的视频流为1080P,4Mbps。

    如果是直播到内网,带宽够的话,GHOST 4K可以支持的视频流的分辨率为4KUHD,45Mbps.

        usb_asix=1

        stream_resolution=4KUHD

        stream_bitrate=45000000

        rtmp_url=rtmp://192.168.3.3/test

四、边录影边直播功能

    边录边传功能是指相机在直播的同时,会自动录制到本地相机的TF卡中。有两种方式:

    1. 直播第一路视频流(可最高支持到4KUHD的分辨率), 同时录制第一路视频流,这种方式录制的视频分辨率及码率与直播的分辨率及码率一样,相当于在本地多一个视频流的备份。

        增加如下配置即可实现该功能。

            usb_asix=1

            stream_resolution=1080P

            stream_bitrate=4000000

            rtmp_url=rtmp地址

            rtmp_record_to_sd=1

            rtmp_2nd_stream=0

            rtmp_cbr=1

    2. 直播第二路视频流(最高只支持到1080P分辨率),同时录制第一路视频流,这种方式录制的视频分辨率及码率可以与直播的分辨率及码率不一样。 这种方式通常是针对需要本地录制高清高码率视频,比如1080P,30Mbps, 或 4KUHD, 60Mbps,因为带宽限制而直播一路低码率的视频流。增加如下配置即可实现该功能。(注意如果录制4KUHD, 则直播只能支持WVGA的分辨率)

        增加如下配置可实现该功能

            usb_asix=1

            stream_resolution=1080P

            stream_bitrate=4000000

            rtmp_url=rtmp地址

            rtmp_record_to_sd=1

            rtmp_2nd_stream=1

            rtmp_cbr=0

            video_resolution=1080P

            video_bitrate=30000000

FAQ:

问:配置fmcam.conf好后,开机摄像机没有反应

答:1)保证fmcam.conf的命名是否为fmcam.conf.

       2)确保网卡模组跟摄像机连接正常


问:机子已亮起绿灯,但没有直播正常。

答:1)确保所配的IP网段跟路由器是同一个网段。

       2) 判断PC与相机是否可以PING通, 检测方法如下:从电脑开始里找到运行,然后在运行对话框中输入" CMD “命令,之后按回车键,键入CMD命令操作界面,如下图:

5.png

        输入命令符按回车键(或点确认键)后即可进入CMD命令操作框,然后我们再输入ping命令,输入:ping 192.168.5.2, 其中192.168.5.2是相机脚本文件“fmcam.conf”中用户设定的相机IP:

6.png

        如果能PING通,说明相机与PC建立TCP/IP连接成功。

 

问:摄像机的USB口能否与有线网卡同时使用?

答:不能,同时使用时会产生冲突。因为有线网卡与摄像机的USB口使用同一个接口,需要读取SD卡内容时,建议使用读卡器读取。或者把有线网卡拔出后,再把摄像机接入电脑。


 


局域网投屏取流教程

2019-01-22浏览(336)

局域网投屏取流教程

 

安装Mshow直播软件平台(点击下载),并保证电脑连接在路由器下面的局域网,并且可以上网。


开启Mshow软件,并点击视频栏目 + 号,选择 其他设备 下面的 +

111.png


连接方式选择 局域网

222.png 

复制局域网接入地址,  记事本打开摄像机fmcam.conf文件,将配置文件中的路由器名称和密码修改成电脑连接的同一个网络。并替换掉文件中的rtmp://192.168.88.88:1935/live/1

地址,点击确定即可,在开启摄像机就可以看到视频画面了。

333.png 

 

X1摄像机

X1文件夹内的配置文件拷贝到X1相机的卡内,用记事本打开夹名称为 fmcam.conf

它可以设置摄像机的码率,分辨率,WIFI 名称与密码,推流地址

一个标准的 fmcam.conf, 如:

router_ssid=royizu

router_password=Royizu123

stream_resolution=720P

stream_bitrate=1.0

rtmp_url=rtmp://192.168.88.88:1935/live/1

 

router_ssid 为无线网络名称。

router_password 为无线网络密码。

stream_resolution 为 摄 像 机 推 流 到 PC 端 的 分 辨 率, 支 持

1080P/720P/WVGA

stream_bitrate 为摄像机码率清晰度的设置,支持 0.8-2.5

rtmp_url 为摄像机推流的地址,复制上面提到的Mshow的局域网接入地址即可。

 

Ghost X摄像机

Ghost X文件夹内的配置文件拷贝到Ghost X相机的卡内,配置文件名称为 fmcam.conf

它可以设置摄像机的码率,分辨率,WIFI 名称与密码,推流地址

一个标准的 fmcam.conf, 如:

usb_wifi=1

router_ssid=royizu

router_password=Royizu123

stream_resolution=720P

stream_bitrate=3000000

rtmp_url=rtmp://192.168.88.88:1935/live/1

 

usb_wifi=1 为固定命令,不能作修改。

router_ssid 为无线网络名称。

router_password 为无线网络密码。

stream_resolution 为 摄 像 机 推 流 到 PC 端 的 分 辨 率, 支 持

1080P/720P/WVGA

stream_bitrate 为摄像机码率清晰度的设置,支持 600000

6000000

rtmp_url 为摄像机推流的地址,复制上面提到的Mshow的局域网接入地址即可。

 



虎牙直播平台操作教程

2019-01-11浏览(516)

虎牙直播平台操作教程

 

1. 打开 http://www.huya.com,点击右上角“登录”,选择微信登录。

虎牙图片1.png 

 

2. 登录后,点击右上角“开播”

虎牙图片2.png 

 

3. 按教程绑定手机和实名认证

虎牙图片3.png

 

 

4. 认证后,在“个人中心”点击“我是主播”,选择“主播设置”。在“主播设置”里选择“开通远程直播”,再点击“获取推流地址并开播”

虎牙图片4.png 

 

5.复制“推流地址”的信息

虎牙图片5.png 

 

 

6.打开http://www.driftlife.co/smartlive,把WIFISSID和密码填到对应的输入框,直播平台选择“其它”。再把上一步的“推流地址”,输入到RTMP地址栏上。

虎牙图片6.png 

 

 

7.点击“创建直播脚本”,即可生成一个直播脚本fmcam.conf,fmcam.conf复制到摄像机的目录下。开机后,摄像就会把画面直播到虎牙平台。


8.直播平台的“直播码”会定时刷新,请再次使用前确认“直播码”是否已刷新。    

 



斗鱼直播平台操作教程

2019-01-11浏览(385)

斗鱼直播平台操作教程

1.打开http://www.douyu.com 点击右上角“登录”,选择微信登录。

斗鱼图片1.png 

 

2. 登录后,选择“开播”

斗鱼图片2.png 

 

3. 按照斗鱼的教程进行“绑定手机”,“实名认证”和“填写直播间信息”

斗鱼图片3.png 

 

4. 认证成功后,在“个人中心”点击“主播中心”

斗鱼图片4.png 

 

 

5.在“主播中心”里,点击“直播相关”,选择“直播设置”。在“直播设置”里,打开“直播开关”。打开后,就可以得到“RTMP地址”和“直播码”。

斗鱼图片5.png 

 

 

6.打开http://www.driftlife.co/smartlive,把WIFISSID和密码填到对应的输入框,直播平台选择“其它”。再把上一步的“rtmp地址”和“直播码”,输入到RTMP地址栏上。

斗鱼图片6.png 

 

 

7.点击“创建直播脚本”,即可生成一个直播脚本fmcam.conf,fmcam.conf复制到摄像机的目录下。开机后,摄像就会把画面直播到斗鱼平台。


8.斗鱼平台的“直播码”会定时刷新,请再次使用前确认“直播码”是否已刷新。



YY直播平台操作教程

2019-01-11浏览(324)

YY直播平台操作教程

1.打开http://www.yy.com.点击右上角,使用微信扫一扫登录

 YY图片1.png

 

 

2.登录后,点击自己的头像,选择“个人中心”。

YY图片2.png 

 

3.在“个人中心”申请“成为主播”,实名认证后才能成为主播,要等1-3日审核。

 

4.在通过审核后,在“个人中心”会有一个开播设置,点击后,即可找到“推流地址”和“直播码”

 YY图片3.png

 

 

5.打开http://www.driftlife.co/smartlive,把WIFISSID和密码填到对应的输入框,直播平台选择“其它”。再把上一步的“推流地址”和“直播码”,输入到RTMP地址栏上。

YY图片4.png 

 

 

6.点击“创建直播脚本”,即可生成一个直播脚本fmcam.conf,fmcam.conf复制到摄像机的SD卡目录下。开机后,摄像就会把画面直播到YY平台。


7.直播平台的“直播码”会定时刷新,请再次使用前确认“直播码”是否已刷新。



GHOST 4K USB网卡使用

2019-01-04浏览(363)

一、简述

    本文档主要描述GHOST 4K相机如何工作在USB网卡模式(符合RNDIS规范),如何PC端通过USB连接相机后与相机TCP/IP通讯,并通过RTSP或RTMP视频通讯协议获取到相机的视频流方法。本方法使用了RNDIS (Remote Network Driver Interface Specification)即远程网络驱动接口规范, 就是在USB设备上跑TCP/IP, 让相机看上去像一块PC的网卡。 RNDIS是Windows7的一部分, 但遗憾的是如果默认安装(插上符合RNDIS的设备时)一般均会安装失败,本文档会描述如何重新安装RNDIS驱动。

二、如何enable GHOST 4K 相机为USB网卡模式

    1. 相机固件版本号: v2.0以上

    2. 在相机SD卡的根目录下创建文件名为”fmcam.conf”的文本文件(请注意有些系统配置会自动加上.txt的扩展名变为“fmcam.conf.txt”,请注意删除.txt,确保文件名只为“fmcam.conf”),文件内容如下:

        usb_net=1

        usb_net_host=192.168.5.1

        usb_net_ip=192.168.5.2

        其中 “usb_net=1”表示相机使用USB网卡模式,相机开机检测到到这个文件,并判断 “usb_net”关键字为”1”的话,相机开机后会开启USB网卡模式,即接USB到PC会被PC识别为USB网卡,而不是MSC存储设备。

        usb_net_host设置为PC端的IP地址。

        usb_net_ip设置为相机本地的IP地址,相机的IP地址须要与PC的IP地址同一个网段。

    3. 相机进入USB网卡模式后,相机WIFI指示灯会亮绿灯。

三、如何在Windows7上安装RNDIS驱动

    1. 相机使用如上“fmcam.conf”脚本文件开机后,插入USB并连接到PC,Windows会弹出正在安装设备驱动程序软件消息。

    注: 请确保相机先开机,识别到有效的“fmcam.conf”脚本文件才会进USB网卡模式,如果是关机插入USB连接电脑,会进入到MSC U盘模式。

image.png

    2. Windows会自动搜索并安装RNDIS驱动,不过,片刻之后您会发现安装失败。

image.png

    3. 右键点击桌面“计算机”图标,选择“管理”——“设备管理”,可以看到“RNDIS/Ethernet Gadget”设备,并且处于驱动未安装状态。

image.png

    4. 右键点击“RNDIS/Ethernet Gadget”设备,选择“更新驱动程序软件”,在如何搜索设备软件提示窗口中,选择“浏览计算机查找驱动程序软件(R)”。选择从设备列表中选择“网络适配器”。

image.png

    5. 选择“从计算机的设备驱动程序列表中选择(L) ”.

image.png

    6. 在硬件设备列表中往下拉,找到“网络适配器”,选中并”下一步”

image.png

    7. 在网络适配器窗口的制造商列表中选择微软公司(Microsoft Corporation),右侧列表中选择远端NDIS兼容设备(Remote NDIS Compatible Device)。

image.png

    8. 弹出如下警告窗口,请选YES

image.png

    9. 点击”是”并等待安装结束,RNDIS 设备将会安装成功

image.png

    10. 在”控制面板”中选择“网络和Internet”下的”查看网络状态和任务”:

image.png

    11. 选择“更改适配器设置”

image.png

    12.可以看到网络连接中多了一个本地连接(RNDIS/Ethernet Gedget)

image.png

    13. 设置新增的USB网卡的IP地址(要求与相机配置文件“fmcam.conf”指定的“usb_net_host”的值一致)

        1) 右击 “本地连接(RNDIS/Ethernet Gadget)”

image.png

        2) 选中 “Internet 协议版本 4(TCP/IPv4)”,点击”属性”按键,指定PC网卡的IP地址为: 192.168.5.1

image.png

    14. 判断PC与相机是否可以PING通, 检测方法如下:从电脑开始里找到运行,然后在运行对话框中输入" CMD “命令,之后按回车键,键入CMD命令操作界面,如下图:

image.png

        输入命令符按回车键(或点确认键)后即可进入CMD命令操作框,然后我们再输入ping命令,输入:ping 192.168.5.2, 其中192.168.5.2是相机脚本文件“fmcam.conf”中用户设定的相机IP:

image.png

        如果能PING通,说明相机与PC建立TCP/IP连接成功。

四、PC如何获取相机的视频流

    1. 设置视频流的分辨率及码率

        在相机SD卡中的配置文件fmcam.conf增加两个选项”stream_resolution”和 “stream_bitrate”如:

            usb_net=1

            usb_net_host=192.168.5.1

            usb_net_ip=192.168.5.2

            stream_resolution=4KUHD

            stream_bitrate=25000000

        “stream_resolution”用于设置相机视频流的分辨率,可以为”4KUHD/1080P/720P/WVGA”, 均为30fps, 分别代表如下分辨率:

            4KUHD:  3840*2160

            1080P:   1920*1080

            720P:    1280*720

            WVGA:   848*420

        “stream_bitrate”用于设置相机视频流的码率,其中1000000代表1Mbps, 25000000代表25Mbps,  800000代表800kbps.

    2. 获取RTSP视频流

        PC安装VLC播放器, 在菜单“媒体/打开网络串流”中输入“rtsp://192.168.5.2/live”,即可获得RTSP协议的视频流, 其中“192.168.5.2”为相机的IP地址。

image.png

五、如何PC通过USB网卡模式获取多台GHOST 4K的视频流

    1. 配置相机为USB网卡模式,并配置为不同的网段:

        CAM1的脚本文件“fmcam.conf”如下:

            usb_net=1

            usb_net_host=192.168.5.1

            usb_net_ip=192.168.5.2

            stream_resolution=4KUHD

            stream_bitrate=25000000

        CAM2 的脚本文件如下:

            usb_net=1

            usb_net_host=192.168.6.1

            usb_net_ip=192.168.6.2

            stream_resolution=4KUHD

            stream_bitrate=25000000

        CAM3 的脚本文件如下:

            usb_net=1

            usb_net_host=192.168.7.1

            usb_net_ip=192.168.7.2

            stream_resolution=4KUHD

            stream_bitrate=25000000

        CAM4 的脚本文件如下:

            usb_net=1

            usb_net_host=192.168.8.1

            usb_net_ip=192.168.8.2

            stream_resolution=4KUHD

            stream_bitrate=25000000

    2. 当这4台相机通过USB连接PC后, 会分别提示安装“RNDIS/Ethernet Gedget”驱动,按上述方法安装驱动成功后,在网络连接中会多4个“RNDIS/Ethernet Getget”网卡,分别设置对应相机的USB网卡地址为如:

        CAM1 USB网卡IP地址:192.168.5.1

        CAM2 USB网卡IP地址:192.168.6.1

        CAM3 USB网卡IP地址:192.168.7.1

        CAM4 USB网卡IP地址:192.168.8.1

    3. 获取多台设备的视频流, 这4台设备的RTSP视频流地址分别为:

        CAM1 USB网卡IP地址:rtsp://192.168.5.2/live

        CAM2 USB网卡IP地址:rtsp://192.168.6.2/live

        CAM3 USB网卡IP地址:rtsp://192.168.7.2/live

        CAM4 USB网卡IP地址:rtsp://192.168.8.2/live


GHOST 4K 有线网口的使用

2019-01-04浏览(247)

一、简述

    本文档主要描述GHOST 4K相机外接一块30Pin的有线网卡实现有线上网的模式,如何通过RTSP视频通讯协议获取到相机的视频流以及如何直播的方法。

二、如何enable GHOST 4K 相机为有线网卡模式

    1. 相机固件版本号: v2.0以上

    2. 在相机SD卡的根目录下创建文件名为”fmcam.conf”的文本文件(请注意有些系统配置会自动加上.txt的扩展名变为“fmcam.conf.txt”,请注意删除.txt,确保文件名只为“fmcam.conf”),文件内容如下:

        usb_asix=1

        usb_asix_ip=192.168.5.2

        usb_asix_gateway=192.168.5.1

        usb_asix_mask=255.255.255.0

        其中 “usb_asix=1”表示相机使用有线网卡模式,相机开机检测到到这个文件,并判断 “usb_asix”关键字为”1”的话,相机开机后会开启有线网卡模式,这时相机的USB端口会被禁用。

        “usb_asix_ip”设置为相机的静态IP地址,此IP地址不要与局域网已有的IP地址冲突。

        “usb_asix_gateway”设置为局域网的网关地址。

        “usb_asix_mask”设置为局域网的子网掩码。

        当 “usb_asix_ip”,“usb_asix_gateway”和“usb_asix_mask”三个中一个为空,或三个都为空时, 相机会采用动态分配IP,动态分配IP通常在直播中使用, 如果是RTSP获取相机视频流建议采用静态分配IP地址。

    3. 把有线网卡模块插到相机的的30Pin接口处,确保网卡红灯亮。(注意相机不要插入普通的USB线连电脑,或充电器)相机开机后进入有线网卡模式后,网卡的绿色指示灯会亮, 如果IP,网关配置正常,接上网线后,ping通网关后,相机的WIFI灯会变绿。

    4. 判断PC与相机是否可以PING通, 检测方法如下:从电脑开始里找到运行,然后在运行对话框中输入" CMD “命令,之后按回车键,键入CMD命令操作界面,如下图:

image.png

        输入命令符按回车键(或点确认键)后即可进入CMD命令操作框,然后我们再输入ping命令,输入:ping 192.168.5.2, 其中192.168.5.2是相机脚本文件“fmcam.conf”中用户设定的相机IP:

image.png

        如果能PING通,说明相机与PC建立TCP/IP连接成功。

三、PC如何通过RTSP获取相机的视频流

    1. 设置视频流的分辨率及码率

        在相机SD卡中的配置文件fmcam.conf增加两个选项”stream_resolution”和 “stream_bitrate”如:

            usb_asix=1

            usb_asix_ip=192.168.5.2

            usb_asix_gateway=192.168.5.1

            usb_asix_mask=255.255.255.0

            stream_resolution=4KUHD

            stream_bitrate=25000000

        “stream_resolution”用于设置相机视频流的分辨率,可以为”4KUHD/1080P/720P/WVGA”, 均为30fps, 分别代表如下分辨率:

            4KUHD:  3840*2160

            1080P:   1920*1080

            720P:    1280*720

            WVGA:   848*420

        “stream_bitrate”用于设置相机视频流的码率,其中1000000代表1Mbps, 25000000代表25Mbps,  800000代表800kbps.

    2. 获取RTSP视频流

        PC安装VLC播放器, 在菜单“媒体/打开网络串流”中输入“rtsp://192.168.5.2/live”,即可获得RTSP协议的视频流, 其中“192.168.5.2”为相机的IP地址。

image.png

四、如何通过有线连网方式获取多台GHOST 4K的视频流

    1. 配置相机为有线网卡模式:

        CAM1的脚本文件“fmcam.conf”如下:

            usb_asix=1

            usb_asix_ip=192.168.5.2

            usb_asix_gateway=192.168.5.1

            usb_asix_mask=255.255.255.0

            stream_resolution=4KUHD

            stream_bitrate=25000000

        CAM2 的脚本文件如下:

            usb_asix=1

            usb_asix_ip=192.168.5.3

            usb_asix_gateway=192.168.5.1

            usb_asix_mask=255.255.255.0

            stream_resolution=4KUHD

            stream_bitrate=25000000

        CAM3 的脚本文件如下:

            usb_asix=1

            usb_asix_ip=192.168.5.4

            usb_asix_gateway=192.168.5.1

            usb_asix_mask=255.255.255.0

            stream_resolution=4KUHD

            stream_bitrate=25000000

        CAM4 的脚本文件如下:

            usb_asix=1

            usb_asix_ip=192.168.5.5

            usb_asix_gateway=192.168.5.1

            usb_asix_mask=255.255.255.0

            stream_resolution=4KUHD

            stream_bitrate=25000000

    3. 获取多台设备的视频流, 这4台设备的RTSP视频流地址分别为:

        CAM1 视频流地址:rtsp://192.168.5.2/live

        CAM2 视频流地址:rtsp://192.168.5.3/live

        CAM3 视频流地址:rtsp://192.168.5.4live

        CAM4 视频流地址:rtsp://192.168.5.5/live

五、如何通过脚本文件实现相机直播

    如果要使用相机直播,首先要生成一个有效的直播地址,把这个地址写到脚本文件中,如:

        usb_asix=1

        stream_resolution=1080P

        stream_bitrate=4000000

        rtmp_url=rtmp地址

    以上的配置直播的视频流为1080P,4Mbps。

    如果是直播到内网,带宽够的话,GHOST 4K可以支持的视频流的分辨率为4KUHD,45Mbps.

        usb_asix=1

        stream_resolution=4KUHD

        stream_bitrate=45000000

        rtmp_url=rtmp://192.168.3.3/test

六、如何实现边录边传功能

    边录边传功能是指相机在直播的同时,会自动录制到本地相机的TF卡中。有两种方式:

    1. 直播第一路视频流(可最高支持到4KUHD的分辨率), 同时录制第一路视频流,这种方式录制的视频分辨率及码率与直播的分辨率及码率一样,相当于在本地多一个视频流的备份。

        增加如下配置即可实现该功能。

            usb_asix=1

            stream_resolution=1080P

            stream_bitrate=4000000

            rtmp_url=rtmp地址

            rtmp_record_to_sd=1

            rtmp_2nd_stream=0

            rtmp_cbr=1

    2. 直播第二路视频流(最高只支持到1080P分辨率),同时录制第一路视频流,这种方式录制的视频分辨率及码率可以与直播的分辨率及码率不一样。 这种方式通常是针对需要本地录制高清高码率视频,比如1080P,30Mbps, 或 4KUHD, 60Mbps,因为带宽限制而直播一路低码率的视频流。增加如下配置即可实现该功能。(注意如果录制4KUHD, 则直播只能支持WVGA的分辨率)

        增加如下配置可实现该功能

            usb_asix=1

            stream_resolution=1080P

            stream_bitrate=4000000

            rtmp_url=rtmp地址

            rtmp_record_to_sd=1

            rtmp_2nd_stream=1

            rtmp_cbr=0

            video_resolution=1080P

            video_bitrate=30000000