mobile CCTV,mobile surveillance,police body worn cameras

 forgetPW
 registerNow
search
view: 1700|reply: 15
打印 prevThread nextThread

音视频获取与命令下发

[copyURL]

1

主题

11

帖子

51

积分

member

Rank: 2

积分
51
jumpTo
owner
poston 2020-7-31 18:51 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式
关于MFCDemo。我们需要对音视频数据需要再次进行处理,音视频数据怎么获取?
下发一些自定义命令,让安全帽播放特定的语音,该怎么做?
头一次做项目,希望能解答的详细一点
reply

使用道具 report

1

主题

11

帖子

51

积分

member

Rank: 2

积分
51
sofa
 Owner| poston 2020-7-31 22:17 | 显示全部楼层
hardfire post on2020-7-31 20:34
这部分代码开源了,您下载编译先跑起来。
CUSDK for windows client, open source(32bit only),
https:// ...

代码已经跑起来了,跟下发命令和音视频获取的部分在哪?代码看了快一周了,我只是稍微看懂了界面相关的部分,然后改了一下。
reply agree Against

使用道具 report

1

主题

11

帖子

51

积分

member

Rank: 2

积分
51
bench
 Owner| poston 2020-8-15 21:43 | 显示全部楼层
hardfire post on2020-8-1 09:44
下发命令估计没有。
但获取视频的肯定有啊,因为你能把视频显示出来啊。
你可以用设备模拟器当实际的设备 ...

您好,音视频流的处理是不是都封装在ManagedLayer.dll里了?我看例程里视频显示都是直接调用已经写好的方法。项目现在的需求是要对音视频做二次处理,该怎样做?
reply agree Against

使用道具 report

1

主题

11

帖子

51

积分

member

Rank: 2

积分
51
ground
 Owner| poston 2020-8-17 23:52 | 显示全部楼层
hardfire post on2020-8-16 18:33
有解码后的YUV BUFFER

这是BVCU_DialogParam定义中的一行
BVCU_Result (*afterDecode)(BVCU_HDialog hDialog, SAVCodec_Context* pCodec, SAV_Frame* pFrame);
我在调用BVCU_Dialog_Open的地方,添加一行
dlgParam.afterDecode = afterDecode;
然后在BVCU_Result CMLibBVCU::afterDecode(BVCU_HDialog hDialog, SAVCodec_Context* pCodec,SAV_Frame* pFrame)
{
}
内部直接写对pFrame的处理过程是不是就可以了?此时*(*pFrame).ppData[0]是不是就是解码后的音视频数据?
reply agree Against

使用道具 report

1

主题

11

帖子

51

积分

member

Rank: 2

积分
51
5#
 Owner| poston 2020-8-22 20:01 | 显示全部楼层
每个通道的数据应该是按行顺序存储的吧,我引用的应该没错吧
BVCU_Result CMLibBVCU::afterDecode(BVCU_HDialog hDialog, SAVCodec_Context* pCodec, SAV_Frame* pFrame)
{
    //YUV转BGR,openCV默认BGR
    unsigned char Y, U, V;
    Mat frame(1080, 1920, CV_8UC3);
    for (int i = 0; i < 1080; i++)
        for (int j = 0; j < 1920; j++)
        {
            Y= *((*pFrame).ppData[0] + 1920 * i + j);
            U= *((*pFrame).ppData[1] + 960 * (i / 2) + (j / 2));
            V= *((*pFrame).ppData[2] + 960 * (i / 2) + (j / 2));
            frame.at<Vec3b>(i, j)[0] = unsigned char(1.164 * Y + 2.017 * U - 276.8);
            frame.at<Vec3b>(i, j)[1] = unsigned char(1.164 * Y - 0.392 * U - 0.823 * V + 135.6);
            frame.at<Vec3b>(i, j)[2] = unsigned char(1.164 * Y + 1.596 * V - 222.9);
        }
    imshow("camera", frame);
    waitKey(0);
    return BVCU_RESULT_S_OK;
}
reply agree Against

使用道具 report

1

主题

11

帖子

51

积分

member

Rank: 2

积分
51
6#
 Owner| poston 2020-9-17 20:51 | 显示全部楼层
pFrame里只有视频数据吗?音频数据在哪?
我运行时发现pframe->data[0],pframe->data[1],pframe->data[2]是视频的YUV数据,pframe->data[3]为NULL
reply agree Against

使用道具 report

1

主题

11

帖子

51

积分

member

Rank: 2

积分
51
7#
 Owner| poston 2020-9-19 18:04 | 显示全部楼层
我查看BVCU_DialogParam类创建的dlgParam对象,可以有3个函数指针,分别是afterRecv,afterDecode,afterRender,后两个的入参pFrame什么时候是音频数据?什么时候是视频数据?
音频数据要获取出来进行处理,怎么做?
reply agree Against

使用道具 report

1

主题

11

帖子

51

积分

member

Rank: 2

积分
51
8#
 Owner| poston 2020-9-23 18:59 | 显示全部楼层
besovideo post on2020-9-19 21:35
http://61.191.27.18:8081/doc.html
WEB SDK的文档和DEMO您都看过了吗?这个是最基础的,应该都有代码示例 ...

可是这不是Web端的文档吗?我现在用的代码是C++写的MFC程序,MFC程序获取音频应该可以做到吧,不需要再用Web吧
reply agree Against

使用道具 report

1

主题

11

帖子

51

积分

member

Rank: 2

积分
51
9#
 Owner| poston 2020-9-24 20:57 | 显示全部楼层
fanghj90 post on2020-9-24 10:46
您好,
afterRecv,afterDecode,afterRender回调的音频/视频类型,根据pCodec->eCodecID判断。
afterRec ...

线程还没有开,但有个问题,调试时发现pCodec->eCodecID一直是SAVCODEC_ID_H264。我在else里int i=1处打断点,程序不会跳到断点处。根据网上的资料,H264是只有视频数据没有音频数据的。这是什么情况?
开线程可以在Browse里面开吗?pFrame和pCodec是全局的吗?
BVCU_Result CMLibBVCU::afterDecode(BVCU_HDialog hDialog, SAVCodec_Context* pCodec, SAV_Frame* pFrame)
{
   
    static int count = 0;
    if (count >= 0)//用于丢帧,count>=n,每n+1帧丢n帧
    {
        count = 0;
        //thread t(AVDataAcquire, pCodec, pFrame);
        if ((*pCodec).eCodecID == SAVCODEC_ID_H264)
        {
            int height = (*pCodec).stVideoParam.iHeight, width = (*pCodec).stVideoParam.iWidth;
            int yStride = (*pFrame).iDataSize[0];
            //YUV420p
            Mat frame(height * 3 / 2, width, CV_8UC1);
            for (int i = 0; i < height; i++)
            {
                memcpy_s(frame.ptr(i), width, (*pFrame).ppData[0] + i * yStride, yStride);
            }
            for (int i = 0; i < height / 4; i++)
            {
                memcpy_s(frame.ptr(i + height), width, (*pFrame).ppData[1] + i * yStride, yStride);
            }
            for (int i = 0; i < height / 4; i++)
            {
                memcpy_s(frame.ptr(i + height * 5 / 4), width, (*pFrame).ppData[2] + i * yStride, yStride);
            }
            cvtColor(frame, frame, COLOR_YUV420p2RGB);
            imshow("camera", frame);
            waitKey(1);
        }
        else
        {
            int i = 1;
        }
    }
    else
    {
        count++;
    }
    return BVCU_RESULT_S_OK;
}
reply agree Against

使用道具 report

creditRule

QQ|wireless surveillance

GMT+8, 2024-5-3 21:07 , Processed in 0.058596 second(s), 19 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

QuickReply backToTop BackToList