佰锐技术-高萌 发表于 2014-8-22 15:11:22

AnyChat使用攻略之独立部署Linux中心录像服务器

Windows平台中心录像服务器部署请参考:http://bbs.anychat.cn/forum.php? ... d=20&extra=page%3D1

AnyChat for Linux SDK自V5.0的r4172版本开始支持Linux中心服务器录像(打开下载页,位于SDK包bin\recordserver目录下),支持服务器单独录像和服务器合成录像,集中保存,录像任务可由客户端发起,也可由业务服务器发起,录像完成之后,将录像文件名反馈给业务服务器,业务服务器可保存到数据库中便于集中维护。录像保存路径可设置。

下面一步一步介绍如何部署中心录像服务器,以及让中心录像服务器正常工作的注意事项:

一、下载AnyChat for Linux SDK包(要求V5.0的4172及以上版本),解压缩,部署核心服务器和业务服务器(参考:AnyChat使用攻略之独立部署Linux视频服务器),让客户端能与核心服务器,以及核心服务器与业务服务器之间能正常的工作。
启动核心服务器之后,查看核心服务器的日志文件(AnyChatCoreServer.log),显示内容如下:

二、进入SDK包的bin\recordserver目录,里面包含如下图所示的文件:


三、中心录像服务器参数配置。打开AnyChatRecordServer.ini配置文件,内容如下:
DebugMode=1
ServerIpAddr=127.0.0.1
ServerUdpPort=8907
RecordRootDir=record
RecordRootURL=
ServerCallBackPathType=1
ClientCallBackPathType=2
配置项详细说明如下:
    DebugMode= , 配置为0时,不在日志中输出相关的调试信息;为1时,可输出更多的调试信息,如录像开始,录像结束,录像文件名等,便于分析故障原因;      
    ServerIpAddr=127.0.0.1    ,配置核心服务器的IP地址,录像服务器与核心服务在同一台计算机时,默认为127.0.0.1
    ServerUdpPort=8907         , 配置核心服务器的UDP通信端口,默认为8907
    RecordRootDir=record       ,表示录像文件保存的本地根目录,可以为相对地址,如:RecordRootDir=record,表示当前录像服务器目录下的record子目录,也可以为绝对路径,如:RecordRootDir=/home/recordRecordRootURL= ,表示录像文件保存本地根目录的互联网访问地址,是一个URL地址,通过该URL地址,可以访问到中心录像服务器目录下的指定文件,通常需要在Web服务器(如Apache)中设置一个虚拟路径指向【RecordRootDir】,而【RecordRootURL】就是该虚拟路径;
    ServerCallBackPathType= ,表示中心录像服务器完成录像之后,触发业务服务器回调事件中的路径类型:0 相对路径、1 绝对路径、2 URL路径;
    ClientCallBackPathType= ,表示中心录像服务器完成录像之后,触发客户端回调事件中的路径类型:0 相对路径、1 绝对路径、2 URL路径;


四、启动中心录像服务器。运行runanychatrecordserver.sh,出现如下图所示的界面

若在日志中显示“Successfully connect to the anychatcoreserver!”则表示中心录像服务器与核心服务器连接成功,工作正常;否则请检查相关参数配置是否匹配,如AnyChatRecordServer.ini中的UDP端口和AnyChatCoreServer.ini中的UDP端口是否一致,另请检查程序的版本是否符合要求。

五、启动中心录像。客户端调用API:BRAC_StreamRecordCtrl(...),或是业务服务器调用API:BRAS_StreamRecordCtrl(...)可启动或停止对目标用户的录像任务,停止录像之后,若录像成功,则会在业务服务器上触发相应的回调函数调用。


六、注意事项:
    1、由于早期的授权证书不支持中心录像服务器,若希望使用该功能(为可选模块),请与我们的商务人员联系升级授权证书;
    2、在中心服务器录像过程中,客户端网络异常掉线将会中断录像,并触发业务服务器的录像回调函数;
    3、停止录像、用户注销等操作与业务服务器触发录像回调函数的时机是异步的过程,在业务服务器编程时需要考虑这种时间差的因素,可能存在先触发用户注销的回调,然后再触发录像完成的回调;


关于回调事件路径类型:
0    相对路径,形如:2014-08-31/12-08-31-074_AnyChat4_53.mp4
1    绝对路径,形如:d:\record\2014-08-31\12-08-31-074_AnyChat4_53.mp4
2    URL路径,形如:http://www.anychat.cn/record/2014-08-31/12-08-31-074_AnyChat4_53.mp4

默认配置中:
【ServerCallBackPathType=1】表示业务服务器回调事件中返回绝对路径
【ClientCallBackPathType=2】表示客户端回调事件中返回URL地址,便于客户端可以直接通过该URL地址访问中心录像服务器上面的文件;

参考:
1、AnyChat音视频录制整体解决方案;
2、有关中心录像服务器配置项【RecordRootURL】的说明。


mylee 发表于 2015-7-16 11:36:27

视频生成的文件名称如何自定义?

admin 发表于 2015-7-16 11:40:30

您好,文件名暂时不可以自定义,您可以在业务服务器的回调函数中调用操作系统的API接口直接对已生成的文件进行改名处理。

佰锐科技—赖彬 发表于 2015-7-16 11:44:02

mylee 发表于 2015-7-16 11:36
视频生成的文件名称如何自定义?

您好,视频生成的文件名称是按时间和用户名。

mylee 发表于 2015-7-16 11:48:23

佰锐科技—赖彬 发表于 2015-7-16 11:44
您好,视频生成的文件名称是按时间和用户名。

可以修改成自定义的么?

admin 发表于 2015-7-16 11:50:49

后续的版本会考虑您的建议,谢谢。

liweiqiang888 发表于 2015-8-5 21:00:43

录像服务linu版本怎么后台运行?-d 貌似不行?

admin 发表于 2015-8-5 21:04:01

您好,请参考:关于linux服务器下让业务服务器在后台运行的解决方案,方法是类似的。

LCL5555555 发表于 2016-12-12 09:05:38

        ---------------------------AnyChat Platform Core SDK Client Log---------------------------         Load BRAnyChatCore.dll success!(V6.2 Build Time:Nov 20 2016 13:42:22)         Load BRMiscUtil.dll success!(V6.2 Build Time:Nov 20 2016 13:44:17)         Load BRMediaUtil.dll success!(V6.2 Build Time:Nov 20 2016 13:41:38)         Load BRMediaShow.dll success!(V6.2 Build Time:Nov 20 2016 13:44:22)         Load BRMediaCore.dll success!(V6.2 Build Time:Nov 20 2016 13:44:35)         Video capture device supported:                 1-Lenovo USB2.0 UVC Camera         Audio capture device supported:                 1-麦克风 (Lenovo USB2.0 Audio)         Start network engine(IPv4 mode)...         Invoke        Connect(10.7.7.100,8906)=0         Invoke        Login(username:PC端登录名)=0         Create anychatdnsserver connect:10.7.7.100(8906)         On pre-connection result, errorcode:0, anychatcoreserver, 10.7.7.100(8906, tcp:1)         CheckClientSocketLink       Connect(ip=10.7.7.100,port=8906)         On connect return, errorcode:0         Server version: V6.1(Build Time:2016-06-30 15:26:09, Linux server)         Message        OnConnect(bSuccess:1, errorcode=0)         Message        OnLoginSystem(userid=-12,errorcode=0,username=PC端登录名), msg deliver worked(1)         Server running time: 2 days, 13 hours, 43 minutes, license mode:0, cloud:0         Connection to streaming media server successfully!(udp delay:23ms)         Object InitFlags:0x2         Invoke        ObjectControl(objecttype:4, objectid:-1, ctrlcode:3, params:-12, 0, 0, 0) = 0         Sync area data finish, total area count:1                 Area object(type:4) id:10001 Area Name:中心营业厅 Guest Count:0 Agent Count:0         Invoke        ObjectControl(objecttype:4, objectid:10001, ctrlcode:401, params:0, 0, 0, 0) = 0         Area(10001) object Event, enter result errorcode:0, queue count:1         Invoke        ObjectControl(objecttype:6, objectid:-12, ctrlcode:602, params:0, 0, 0, 0) = 0         Invoke        VideoCallControl(EventType:1, UserId:-13, ErrorCode:0, dwFlags:0, dwParam:0, UserStr:)=0         Message        OnVideoCallEvent(EventType:2, UserId:-13, ErrorCode:0, dwFlags:0x0, dwParam:0         Message        OnVideoCallEvent(EventType:3, UserId:-13, ErrorCode:0, dwFlags:0x0, dwParam:1         Invoke        EnterRoom(roomid=1)         Message        OnEnterRoom(roomid=1,errorcode=0,siteindex=0)         Message        OnReceiveOnlineUser(count=1,roomid=1)         Invoke        UserCameraControl(userid=-12, bOpen=1, stream=0)         Message        OnUserEnterRoom(userid=-13,nickname=android1,siteindex=1)         Invoke        UserSpeakControl(userid=-12,bOpen=1)         WaveIn Audio Capture Driver(麦克风 (Lenovo USB2.0 Audio))         Audio Init, error:0, device:0, 1, 16000, 16, capmode:0         Audio codec init, handle:1, 11, 1, 16000, 16, 15850         Audio Playback Device Init(0, 1, 16000, 16), WaveOut Playback Driver         Audio FX Status: VAD:1, NS:1, AGC:1, AEC:1         Invoke        StreamRecordCtrlEx(-1, 1, 0x1837, 0, LCL)=0         user(-12) record audio stream parameter: codec:11, 1 channel, 16000Hz         Invoke        UserCameraControl(userid=-13, bOpen=1, stream=0)         Invoke        UserSpeakControl(userid=-13,bOpen=1)         Invoke        UserCameraControl(userid=-13, bOpen=1, stream=0)         Invoke        UserSpeakControl(userid=-13,bOpen=1)         MinCroppingSize(1280, 720)        MaxCroppingSize(1280, 720)        Format(MJPG, 0x47504a4d, 30fps)         MinCroppingSize(352, 288)        MaxCroppingSize(352, 288)        Format(MJPG, 0x47504a4d, 30fps)         MinCroppingSize(320, 240)        MaxCroppingSize(320, 240)        Format(MJPG, 0x47504a4d, 30fps)         MinCroppingSize(176, 144)        MaxCroppingSize(176, 144)        Format(MJPG, 0x47504a4d, 30fps)         MinCroppingSize(160, 120)        MaxCroppingSize(160, 120)        Format(MJPG, 0x47504a4d, 30fps)         MinCroppingSize(640, 360)        MaxCroppingSize(640, 360)        Format(MJPG, 0x47504a4d, 30fps)         MinCroppingSize(640, 480)        MaxCroppingSize(640, 480)        Format(MJPG, 0x47504a4d, 30fps)         MinCroppingSize(1280, 720)        MaxCroppingSize(1280, 720)        Format(YUY2, 0x32595559, 10fps)         MinCroppingSize(352, 288)        MaxCroppingSize(352, 288)        Format(YUY2, 0x32595559, 30fps)         MinCroppingSize(320, 240)        MaxCroppingSize(320, 240)        Format(YUY2, 0x32595559, 30fps)         MinCroppingSize(176, 144)        MaxCroppingSize(176, 144)        Format(YUY2, 0x32595559, 30fps)         MinCroppingSize(160, 120)        MaxCroppingSize(160, 120)        Format(YUY2, 0x32595559, 30fps)         MinCroppingSize(640, 360)        MaxCroppingSize(640, 360)        Format(YUY2, 0x32595559, 30fps)         MinCroppingSize(640, 480)        MaxCroppingSize(640, 480)        Format(YUY2, 0x32595559, 30fps)         Prepare config camera(1-Lenovo USB2.0 UVC Camera): 320x240, 25fps                 The best video format is detected: YUY2                 SetFormat(320x240, YUY2, 25fps) = 0                 Video Config Size(320, 240)        Format(YUY2, 25fps)         video init finish:320x240, YUY2, fps:25, codecid:1         On Remote UserCameraControl(dwUserId:-13, bOpen:1)         video codec init:codec:1, 15fps, 320x240, bitrate:90kbps, quality:3, preset:3, gop:30, handle:3         User(-12) record video stream parameter: codec:1, 320x240, 15fps         User(-12) record init successed! filepath:Stream Record         On Remote UserSpeakControl(dwUserId:-13, bOpen:1)         Message        OnP2PConnectState(userid=-13, state=1)         Message        OnP2PConnectState(userid=-13, state=3)         userid(-13) audio decode, codec:11, 1 channel, 16000Hz         userid(-13) video decode, codec:1, 320x240, delay:0ms         Invoke        SnapShot(-13, 0x0, 0)=0         Prepare create record file:C:\PROGRA~2\BAIRUI~1\ANYCHA~1\temp\snapshot\2016-12-12\09-01-22-681_android1_28.jpg, dwFlags:0x0         Invoke        TransFile(dwUserid=-1, dwTaskId:0, PathName:0)=710         Invoke        VideoCallControl(EventType:4, UserId:-13, ErrorCode:0, dwFlags:0, dwParam:0, UserStr:)=0         Message        OnVideoCallEvent(EventType:4, UserId:-13, ErrorCode:0, dwFlags:0x0, dwParam:0         Invoke        StreamRecordCtrlEx(-1, 0, 0x1837, 0, LCL)=0         Invoke        LeaveRoom(roomid=1)        Elapse:157 ms         Invoke        UserCameraControl(userid=-13, bOpen=0, stream=0)         Invoke        UserSpeakControl(userid=-13,bOpen=0)         Invoke        ObjectControl(objecttype:6, objectid:-12, ctrlcode:604, params:0, 0, 0, 0) = 0         socket error, disconnected by peer!, bTcp(1) - userid(-13)         OnSocketClose, index(3)-errorcode(0-183), flags:0x10481, bTcp(1),userid(-13), list:0

LCL5555555 发表于 2016-12-12 09:07:01

LCL5555555 发表于 2016-12-12 09:05
        ---------------------------AnyChat Platform Core SDK Client Log---------- ...

        ---------------------------AnyChat Platform Core SDK Client Log---------------------------
        Load BRAnyChatCore.dll success!(V6.2 Build Time:Nov 20 2016 13:42:22)
        Load BRMiscUtil.dll success!(V6.2 Build Time:Nov 20 2016 13:44:17)
        Load BRMediaUtil.dll success!(V6.2 Build Time:Nov 20 2016 13:41:38)
        Load BRMediaShow.dll success!(V6.2 Build Time:Nov 20 2016 13:44:22)
        Load BRMediaCore.dll success!(V6.2 Build Time:Nov 20 2016 13:44:35)
        Video capture device supported:
                1-Lenovo USB2.0 UVC Camera
        Audio capture device supported:
                1-麦克风 (Lenovo USB2.0 Audio)
        Start network engine(IPv4 mode)...
        Invoke        Connect(10.7.7.100,8906)=0
        Invoke        Login(username:PC端登录名)=0
        Create anychatdnsserver connect:10.7.7.100(8906)
        On pre-connection result, errorcode:0, anychatcoreserver, 10.7.7.100(8906, tcp:1)
        CheckClientSocketLink       Connect(ip=10.7.7.100,port=8906)
        On connect return, errorcode:0
        Server version: V6.1(Build Time:2016-06-30 15:26:09, Linux server)
        Message        OnConnect(bSuccess:1, errorcode=0)
        Message        OnLoginSystem(userid=-12,errorcode=0,username=PC端登录名), msg deliver worked(1)
        Server running time: 2 days, 13 hours, 43 minutes, license mode:0, cloud:0
        Connection to streaming media server successfully!(udp delay:23ms)
        Object InitFlags:0x2
        Invoke        ObjectControl(objecttype:4, objectid:-1, ctrlcode:3, params:-12, 0, 0, 0) = 0
        Sync area data finish, total area count:1
                Area object(type:4) id:10001 Area Name:中心营业厅 Guest Count:0 Agent Count:0
        Invoke        ObjectControl(objecttype:4, objectid:10001, ctrlcode:401, params:0, 0, 0, 0) = 0
        Area(10001) object Event, enter result errorcode:0, queue count:1
        Invoke        ObjectControl(objecttype:6, objectid:-12, ctrlcode:602, params:0, 0, 0, 0) = 0
        Invoke        VideoCallControl(EventType:1, UserId:-13, ErrorCode:0, dwFlags:0, dwParam:0, UserStr:)=0
        Message        OnVideoCallEvent(EventType:2, UserId:-13, ErrorCode:0, dwFlags:0x0, dwParam:0
        Message        OnVideoCallEvent(EventType:3, UserId:-13, ErrorCode:0, dwFlags:0x0, dwParam:1
        Invoke        EnterRoom(roomid=1)
        Message        OnEnterRoom(roomid=1,errorcode=0,siteindex=0)
        Message        OnReceiveOnlineUser(count=1,roomid=1)
        Invoke        UserCameraControl(userid=-12, bOpen=1, stream=0)
        Message        OnUserEnterRoom(userid=-13,nickname=android1,siteindex=1)
        Invoke        UserSpeakControl(userid=-12,bOpen=1)
        WaveIn Audio Capture Driver(麦克风 (Lenovo USB2.0 Audio))
        Audio Init, error:0, device:0, 1, 16000, 16, capmode:0
        Audio codec init, handle:1, 11, 1, 16000, 16, 15850
        Audio Playback Device Init(0, 1, 16000, 16), WaveOut Playback Driver
        Audio FX Status: VAD:1, NS:1, AGC:1, AEC:1
        Invoke        StreamRecordCtrlEx(-1, 1, 0x1837, 0, LCL)=0
        user(-12) record audio stream parameter: codec:11, 1 channel, 16000Hz
        Invoke        UserCameraControl(userid=-13, bOpen=1, stream=0)
        Invoke        UserSpeakControl(userid=-13,bOpen=1)
        Invoke        UserCameraControl(userid=-13, bOpen=1, stream=0)
        Invoke        UserSpeakControl(userid=-13,bOpen=1)
        MinCroppingSize(1280, 720)        MaxCroppingSize(1280, 720)        Format(MJPG, 0x47504a4d, 30fps)
        MinCroppingSize(352, 288)        MaxCroppingSize(352, 288)        Format(MJPG, 0x47504a4d, 30fps)
        MinCroppingSize(320, 240)        MaxCroppingSize(320, 240)        Format(MJPG, 0x47504a4d, 30fps)
        MinCroppingSize(176, 144)        MaxCroppingSize(176, 144)        Format(MJPG, 0x47504a4d, 30fps)
        MinCroppingSize(160, 120)        MaxCroppingSize(160, 120)        Format(MJPG, 0x47504a4d, 30fps)
        MinCroppingSize(640, 360)        MaxCroppingSize(640, 360)        Format(MJPG, 0x47504a4d, 30fps)
        MinCroppingSize(640, 480)        MaxCroppingSize(640, 480)        Format(MJPG, 0x47504a4d, 30fps)
        MinCroppingSize(1280, 720)        MaxCroppingSize(1280, 720)        Format(YUY2, 0x32595559, 10fps)
        MinCroppingSize(352, 288)        MaxCroppingSize(352, 288)        Format(YUY2, 0x32595559, 30fps)
        MinCroppingSize(320, 240)        MaxCroppingSize(320, 240)        Format(YUY2, 0x32595559, 30fps)
        MinCroppingSize(176, 144)        MaxCroppingSize(176, 144)        Format(YUY2, 0x32595559, 30fps)
        MinCroppingSize(160, 120)        MaxCroppingSize(160, 120)        Format(YUY2, 0x32595559, 30fps)
        MinCroppingSize(640, 360)        MaxCroppingSize(640, 360)        Format(YUY2, 0x32595559, 30fps)
        MinCroppingSize(640, 480)        MaxCroppingSize(640, 480)        Format(YUY2, 0x32595559, 30fps)
        Prepare config camera(1-Lenovo USB2.0 UVC Camera): 320x240, 25fps
                The best video format is detected: YUY2
                SetFormat(320x240, YUY2, 25fps) = 0
                Video Config Size(320, 240)        Format(YUY2, 25fps)
        video init finish:320x240, YUY2, fps:25, codecid:1
        On Remote UserCameraControl(dwUserId:-13, bOpen:1)
        video codec init:codec:1, 15fps, 320x240, bitrate:90kbps, quality:3, preset:3, gop:30, handle:3
        User(-12) record video stream parameter: codec:1, 320x240, 15fps
        User(-12) record init successed! filepath:Stream Record
        On Remote UserSpeakControl(dwUserId:-13, bOpen:1)
        Message        OnP2PConnectState(userid=-13, state=1)
        Message        OnP2PConnectState(userid=-13, state=3)
        userid(-13) audio decode, codec:11, 1 channel, 16000Hz
        userid(-13) video decode, codec:1, 320x240, delay:0ms
        Invoke        SnapShot(-13, 0x0, 0)=0
        Prepare create record file:C:\PROGRA~2\BAIRUI~1\ANYCHA~1\temp\snapshot\2016-12-12\09-01-22-681_android1_28.jpg, dwFlags:0x0
        Invoke        TransFile(dwUserid=-1, dwTaskId:0, PathName:0)=710
        Invoke        VideoCallControl(EventType:4, UserId:-13, ErrorCode:0, dwFlags:0, dwParam:0, UserStr:)=0
        Message        OnVideoCallEvent(EventType:4, UserId:-13, ErrorCode:0, dwFlags:0x0, dwParam:0
        Invoke        StreamRecordCtrlEx(-1, 0, 0x1837, 0, LCL)=0
        Invoke        LeaveRoom(roomid=1)        Elapse:157 ms
        Invoke        UserCameraControl(userid=-13, bOpen=0, stream=0)
        Invoke        UserSpeakControl(userid=-13,bOpen=0)
        Invoke        ObjectControl(objecttype:6, objectid:-12, ctrlcode:604, params:0, 0, 0, 0) = 0
        socket error, disconnected by peer!, bTcp(1) - userid(-13)
        OnSocketClose, index(3)-errorcode(0-183), flags:0x10481, bTcp(1),userid(-13), list:0



录制到服务器的日志如上,为什么录制不到服务器呢???????
页: [1] 2 3
查看完整版本: AnyChat使用攻略之独立部署Linux中心录像服务器