mobile CCTV,mobile surveillance,police body worn cameras

 forgetPW
 registerNow
search
view: 1720|reply: 6
打印 prevThread nextThread

优视平台远程录像,文件命名时间错误

[copyURL]

7

主题

16

帖子

69

积分

member

Rank: 2

积分
69
jumpTo
owner
poston 2019-4-25 11:35 | authorOnly 回帖奖励 |倒序浏览 |阅读模式
如题:优视平台远程录像,文件命名时间错误,文件命名上表现为多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[s32Idx].hDialog, &stPacket);
        if (BVCU_RESULT_S_OK != enResult)
        {
                MLOGE("BVCSP_Dialog_Write I frame! %#x\n", enResult);
        }



本帖子中包含更多资源

pls login 才可以下载或查看,没有帐号?registerNow

x
reply

使用道具 report

1

主题

580

帖子

1999

积分

vipMem

Rank: 6Rank: 6

积分
1999
sofa
poston 2019-4-25 11:59 | authorOnly
您好,设备端本地录像文件名中的时间是如何生成的呢?能否贴下
reply agree Against

使用道具 report

7

主题

16

帖子

69

积分

member

Rank: 2

积分
69
bench
 Owner| poston 2019-4-25 15:21 | authorOnly
fanghj90 post on2019-4-25 11:59
您好,设备端本地录像文件名中的时间是如何生成的呢?能否贴下

本地文件生成:
    struct tm *t = HI_NULL;
    struct  timeval    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);
reply agree Against

使用道具 report

1

主题

580

帖子

1999

积分

vipMem

Rank: 6Rank: 6

积分
1999
ground
poston 2019-4-25 15:29 | authorOnly
LGL-UM post on2019-4-25 15:21
本地文件生成:
    struct tm *t = HI_NULL;
    struct  timeval    tv;

那就奇怪了,跟我们这边生成文件名是一样的过程,tim就是设备码流中的时间戳。
不过服务器是转换成服务器的本地时间。

time_t nowTime = tim/SAV_TIME_BASE;
    tm  nt;
    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));
reply agree Against

使用道具 report

1

主题

580

帖子

1999

积分

vipMem

Rank: 6Rank: 6

积分
1999
5#
poston 2019-4-25 15:36 | authorOnly
LGL-UM post on2019-4-25 15:21
本地文件生成:
    struct tm *t = HI_NULL;
    struct  timeval    tv;

我用客户端登陆上去看看。
reply agree Against

使用道具 report

1

主题

580

帖子

1999

积分

vipMem

Rank: 6Rank: 6

积分
1999
6#
poston 2019-4-25 15:43 | authorOnly
LGL-UM post on2019-4-25 15:21
本地文件生成:
    struct tm *t = HI_NULL;
    struct  timeval    tv;

我这边用客户端登陆拉流查看,码流时间戳是多了8个小时,希望您那边BVCSP_Dialog_Write时将时间戳打印出来,验证下。
reply agree Against

使用道具 report

7

主题

16

帖子

69

积分

member

Rank: 2

积分
69
7#
 Owner| poston 2019-4-25 15:47 | authorOnly
fanghj90 post on2019-4-25 15:43
我这边用客户端登陆拉流查看,码流时间戳是多了8个小时,希望您那边BVCSP_Dialog_Write时将时间戳打印出 ...

好的,我们再验证下
reply agree Against

使用道具 report

creditRule

QQ|wireless surveillance

GMT+8, 2024-4-19 12:56 , Processed in 0.062503 second(s), 20 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

QuickReply backToTop BackToList