优视平台远程录像,文件命名时间错误
如题:优视平台远程录像,文件命名时间错误,文件命名上表现为多8个小时,但在音视频实时预览界面,查看的时间信息是正确的,没有时间戳错误。如下图,为今天上午平台远程录像录制的视频,文件名称:
发送音视频帧时间戳实现如下:
gettimeofday(&stTime,NULL);
s64time = (int64_t)stTime.tv_sec*1000000 + stTime.tv_usec;
stPacket.bLostFrame = 0;
stPacket.iDataType = BVCSP_DATA_TYPE_VIDEO;
stPacket.iPTS = s64time;//stFrameData.u64TimeStamp;
stPacket.bKeyFrame = 1;
stPacket.pData = azIframe;
stPacket.iDataSize = stFrameData.u32DataLength;
enResult = BVCSP_Dialog_Write(s_stDialogInfo.hDialog, &stPacket);
if (BVCU_RESULT_S_OK != enResult)
{
MLOGE("BVCSP_Dialog_Write I frame! %#x\n", enResult);
}
您好,设备端本地录像文件名中的时间是如何生成的呢?能否贴下 fanghj90 post on2019-4-25 11:59
您好,设备端本地录像文件名中的时间是如何生成的呢?能否贴下
本地文件生成:
struct tm *t = HI_NULL;
structtimeval tv;
if(0 != gettimeofday(&tv,HI_NULL))
{
DTCF_LOG(HI_DTCF_LOG_LEVEL_ERR,"gettimeofday error, errno:%d\n", errno);
perror("gettimeofday");
return HI_DTCF_ERR_SYSTEM_ERROR;
}
if(tv.tv_usec > 500000)
{
tv.tv_sec++;
}
t = localtime(&tv.tv_sec);
if(HI_NULL == t)
{
DTCF_LOG(HI_DTCF_LOG_LEVEL_ERR,"localtime error, errno:%d\n", errno);
perror("localtime");
return HI_DTCF_ERR_SYSTEM_ERROR;
}
DTCF_LOG(HI_DTCF_LOG_LEVEL_INFO,"%4d_%02d%02d_%02d%02d%02d%ld\n", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec,tv.tv_usec);
LGL-UM post on2019-4-25 15:21
本地文件生成:
struct tm *t = HI_NULL;
structtimeval tv;
那就奇怪了,跟我们这边生成文件名是一样的过程,tim就是设备码流中的时间戳。
不过服务器是转换成服务器的本地时间。
time_t nowTime = tim/SAV_TIME_BASE;
tmnt;
localtime_s(&nt,&nowTime);
// past error video pack
if ((nt.tm_year + 1900) < 2000)
{
nowTime = time(NULL);
if (nowTime - openTime < 30) // 30 s
return NULL;
localtime_s(&nt, &openTime);
// create file name
sprintf_s(dst, len, "%s%s_%02d_%4d%02d%02d_%02d%02d%02d_(local).mkv", path, devID, channel, nt.tm_year + 1900, nt.tm_mon + 1, nt.tm_mday, nt.tm_hour, nt.tm_min, nt.tm_sec);
}
else
sprintf_s(dst,len,"%s%s_%02d_%4d%02d%02d_%02d%02d%02d.mkv",path,devID,channel,nt.tm_year + 1900,nt.tm_mon + 1,nt.tm_mday,nt.tm_hour,nt.tm_min,nt.tm_sec);
memset(dst + strlen(dst), 0, len - strlen(dst)); LGL-UM post on2019-4-25 15:21
本地文件生成:
struct tm *t = HI_NULL;
structtimeval tv;
我用客户端登陆上去看看。 LGL-UM post on2019-4-25 15:21
本地文件生成:
struct tm *t = HI_NULL;
structtimeval tv;
我这边用客户端登陆拉流查看,码流时间戳是多了8个小时,希望您那边BVCSP_Dialog_Write时将时间戳打印出来,验证下。 fanghj90 post on2019-4-25 15:43
我这边用客户端登陆拉流查看,码流时间戳是多了8个小时,希望您那边BVCSP_Dialog_Write时将时间戳打印出 ...
好的,我们再验证下
page:
[1]