我想通过GET的请求,从一架IP照相机接收吉大港山区上空的图像。 我写了一个节目,制作与摄像机有关的短片,并向摄影机发出以下GET申请:
GET /mjpeg?res=full HTTP/1.1
Host: 143.205.116.14
After that, I receive images with the following function in a while loop:
while((tmpres = recv(sock,(void *) buf, SIZE, 0)) > 0 && check<10)
.....
where SIZE
represents the size of the buffer. I, infact, don t know what size to define here. I am receiving a color image of size 2940x1920. So I define SIZE=2940x1920x3
. After receiving the MJPEG image, I decode it with ffmpeg. But I observe that ffmpeg just partially/uncorrectly decodes the image and I just see a half (or even less) of the image. I assume it could be a size problem.
Any help in this regard would be highly appreciated.
Regards,
Khan