微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用Kinesis WebRTC C SDK从Kinesis流中获取帧数据

如何解决使用Kinesis WebRTC C SDK从Kinesis流中获取帧数据

我目前正在使用Kinesis webRTC JS SDK将数据从前端(网络摄像头)流式传输到Kinesis Signaling Channel,并且我想在后端使用此数据,为此,我尝试使用Kinesis webRTC C的示例代码SDK kvsWebrtcclientViewer 。我需要使用查看器中的数据并将其存储到图像中或将其发送到 Rekognition

VOID sampleFrameHandler(UINT64 customData,PFrame pFrame)
{
UNUSED_ParaM(customData);
STATUS retStatus = STATUS_SUCCESS;
 DLOGV("Frame received. TrackId: %" PRIu64 ",Size: %u,Flags %u",pFrame->trackId,pFrame->size,pFrame->flags);
printf("\n Frame received. TrackId: %" PRIu64 ",pFrame->flags);

    FILE  *fp;
    fp =fopen("../outputimages/image2.jpg","w");
    fwrite(&pFrame->frameData,1,sizeof(pFrame->frameData),fp);

PSampleStreamingSession pSampleStreamingSession = (PSampleStreamingSession) customData;
if (pSampleStreamingSession->firstFrame) {
    pSampleStreamingSession->firstFrame = FALSE;
    pSampleStreamingSession->startUpLatency = (GETTIME() - pSampleStreamingSession->offerReceiveTime) / HUNDREDS_OF_NANOS_IN_A_MILLISECOND;
    printf("Start up latency from offer to first frame: %" PRIu64 "ms\n",pSampleStreamingSession->startUpLatency);
}

    retStatus = writeFile("../outputimages/image.h264",TRUE,pFrame->frameData,(UINT64)pFrame->size);
    printf("Trying to write file");
    if (retStatus != STATUS_SUCCESS) {
    printf("[KVS Master] readFile(): operation returned status code: 0x%08x \n",retStatus);
}
}

代码段来自kinesis webRTC C SDK的示例代码。将pFrame iamge / byte数据写入jpg或png图像的正确方法是什么?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。