| @@ -10,12 +10,12 @@ void OnDASServerStart(XSDK_HANDLE hServer, int nResult) | |||||
| void OnDASDeviceReg(XSDK_HANDLE hDevice, SXSDKDASDeviceInfo *pDASInfo, int dPos) | void OnDASDeviceReg(XSDK_HANDLE hDevice, SXSDKDASDeviceInfo *pDASInfo, int dPos) | ||||
| { | { | ||||
| printf("hDevice::%d, dPos::%d\r\n",hDevice,dPos); | |||||
| printf("hDevice::%d, dPos::%d, DeiveID::%s\r\n",hDevice,dPos,pDASInfo->sDevId); | |||||
| hDeviceArr[dPos] = hDevice; | hDeviceArr[dPos] = hDevice; | ||||
| strncpy(DeviceIdArr[dPos], pDASInfo->sDevId, 127); | strncpy(DeviceIdArr[dPos], pDASInfo->sDevId, 127); | ||||
| // hDevice---等同于XSDK_DevLoginSyn/XSDK_DevLogin的返回值 | // hDevice---等同于XSDK_DevLoginSyn/XSDK_DevLogin的返回值 | ||||
| printf("OnDASDeviceReg-->\r\nIP:%s\r\nPort:%d\r\nDeiveID:%s\r\nUserName:%s\r\nPassword:%s\r\nChannelNum:%d\r\nEncryptyType:%s\r\n", | |||||
| pDASInfo->sDevIP, pDASInfo->nDevPort, pDASInfo->sDevId, pDASInfo->sUserName, pDASInfo->sPassword, pDASInfo->nChannelNum, pDASInfo->sEncryptType); | |||||
| //printf("OnDASDeviceReg-->\r\nIP:%s\r\nPort:%d\r\nDeiveID:%s\r\nUserName:%s\r\nPassword:%s\r\nChannelNum:%d\r\nEncryptyType:%s\r\n", | |||||
| // pDASInfo->sDevIP, pDASInfo->nDevPort, pDASInfo->sDevId, pDASInfo->sUserName, pDASInfo->sPassword, pDASInfo->nChannelNum, pDASInfo->sEncryptType); | |||||
| } | } | ||||
| XSDK_HANDLE g_hDasServer = 0; | XSDK_HANDLE g_hDasServer = 0; | ||||
| @@ -30,14 +30,14 @@ int CALLBACK Test_MediaCallBack(XSDK_HANDLE hMedia, const unsigned char *pData, | |||||
| if (pFrame->nType == XSDK_FRAME_TYPE_VIDEO) | if (pFrame->nType == XSDK_FRAME_TYPE_VIDEO) | ||||
| { | { | ||||
| int pos = getPos(hMedia); | int pos = getPos(hMedia); | ||||
| string fmt("/media-file/origin/%s/%04d-%02d-%02d-%02d.dat"); | |||||
| string fmt("/extdisk/origin/%04d-%02d-%02d-%02d.dat"); | |||||
| char file_name[1024]; | char file_name[1024]; | ||||
| snprintf(file_name,sizeof(file_name),fmt.c_str(),DeviceIdArr[pos],pFrame->nYear,pFrame->nMonth,pFrame->nDay,pFrame->nHour) ; | |||||
| snprintf(file_name,sizeof(file_name),fmt.c_str(),pFrame->nYear,pFrame->nMonth,pFrame->nDay,pFrame->nHour) ; | |||||
| printf("path: %d ,%s \r\n", pos,file_name); | printf("path: %d ,%s \r\n", pos,file_name); | ||||
| // ABFile("video_header.dat", pFrame->pHeader, pFrame->nLength); | // ABFile("video_header.dat", pFrame->pHeader, pFrame->nLength); | ||||
| ABFile(file_name, pFrame->pContent, pFrame->nFrameLength); | ABFile(file_name, pFrame->pContent, pFrame->nFrameLength); | ||||
| } | } | ||||
| printf("Media[hMedia:%ld][Len:%d][Type:%d/%d][%04d-%02d-%02d %02d:%02d:%02d-%03d]\r\n", hMedia, nDataLen, pFrame->nType, pFrame->nSubType, pFrame->nYear, pFrame->nMonth, pFrame->nDay, pFrame->nHour, pFrame->nMinute, pFrame->nSecond, (int)(pFrame->nTimeStamp % 1000)); | |||||
| //printf("Media[hMedia:%ld][Len:%d][Type:%d/%d][%04d-%02d-%02d %02d:%02d:%02d-%03d]\r\n", hMedia, nDataLen, pFrame->nType, pFrame->nSubType, pFrame->nYear, pFrame->nMonth, pFrame->nDay, pFrame->nHour, pFrame->nMinute, pFrame->nSecond, (int)(pFrame->nTimeStamp % 1000)); | |||||
| } | } | ||||
| else if (EXSDK_DATA_MEDIA_ON_PLAY_STATE == nDataType) | else if (EXSDK_DATA_MEDIA_ON_PLAY_STATE == nDataType) | ||||
| { | { | ||||
| @@ -7,8 +7,8 @@ import subprocess | |||||
| import time | import time | ||||
| import os | import os | ||||
| DAT_FOLDER = "./" | |||||
| TARGET_FOLDER = "/media-file/camera" | |||||
| DAT_FOLDER = "/extdisk/origin" | |||||
| TARGET_FOLDER = "/extdisk/camera" | |||||
| SUFFIX = ".dat" | SUFFIX = ".dat" | ||||
| TARGET_SUFFIX = ".mp4" | TARGET_SUFFIX = ".mp4" | ||||
| @@ -20,12 +20,12 @@ def list_folder(org_folder, tar_folder, code): | |||||
| if current_time + ".dat" == f: | if current_time + ".dat" == f: | ||||
| print("{0} ignore".format(os.path.join(root, f))) | print("{0} ignore".format(os.path.join(root, f))) | ||||
| continue | continue | ||||
| convert(os.path.join(root, f), os.path.join(tar_folder, list(root.split("/"))[-1], f+TARGET_SUFFIX)) | |||||
| convert(os.path.join(root, f), os.path.join(tar_folder, code, f.replace(SUFFIX,"")+TARGET_SUFFIX)) | |||||
| def convert(origin, target): | def convert(origin, target): | ||||
| print("origin: {0} ,target: {1}".format(origin,target)) | print("origin: {0} ,target: {1}".format(origin,target)) | ||||
| cmd = "ffmpeg -i " + origin + "-c copy " + target | |||||
| cmd = 'ffmpeg -i {0} -c copy {1}'.format(origin,target) | |||||
| print("cmd:: {0}".format(cmd)) | print("cmd:: {0}".format(cmd)) | ||||
| status, output = subprocess.getstatusoutput(cmd) | status, output = subprocess.getstatusoutput(cmd) | ||||
| print("status:: {0}, output {1}".format(status, output)) | print("status:: {0}, output {1}".format(status, output)) | ||||