Bitmap size must be of the same as video size, which was specified on opening video file.

在使用AForge.Video.FFMPEG录制视频时可能出现因位图大小与视频大小不符导致的异常。确保设备(如海康威视和ONTOP)的分辨率与在VideoFileWriter.Open()中设置的分辨率一致,避免出现错误。调整设置以匹配硬件设备的分辨率可以解决此问题。
摘要由CSDN通过智能技术生成

在通过AForge.Video.FFMPEG对视频进行录制会会产生这样的问题,异常大致意思是 :位图大小必须与打开视频文件时指定的视频大小相同。

解决办法,在这里我们要确认调用的硬件设备的分辨率与设置的分辨率是否相同。

我们目前使用的海康威视分辨率是2048*1536,ONTOP分辨率是1920*1080

在我们VideoFileWriter.Open();时设置的分辨率要与设备相同否则就会出现类似的问题。

`create_bitmap_area_size` 是一个与位图(Bitmap)操作相关的函数或方法,通常用于创建具有指定大小和区域的位图。这个函数的具体实现和参数可能因编程语言和使用的图形库而异。以下是一个可能的实现示例: ```c #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdint.h> typedef struct { uint8_t *data; int width; int height; } Bitmap; Bitmap* create_bitmap_area_size(int width, int height) { Bitmap *bitmap = (Bitmap*)malloc(sizeof(Bitmap)); if (!bitmap) { fprintf(stderr, "Failed to allocate memory for bitmap\n"); return NULL; } bitmap->data = (uint8_t*)malloc(width * height * 4); // Assuming 4 bytes per pixel (RGBA) if (!bitmap->data) { fprintf(stderr, "Failed to allocate memory for bitmap data\n"); free(bitmap); return NULL; } bitmap->width = width; bitmap->height = height; // Initialize the bitmap data to zero memset(bitmap->data, 0, width * height * 4); return bitmap; } int main() { int width = 100; int height = 100; Bitmap *bitmap = create_bitmap_area_size(width, height); if (bitmap) { printf("Bitmap created successfully with width: %d and height: %d\n", bitmap->width, bitmap->height); // Use the bitmap as needed free(bitmap->data); free(bitmap); } return 0; } ``` 在这个示例中,`create_bitmap_area_size` 函数接受宽度和高度作为参数,并返回一个指向新创建的位图结构的指针。位图数据被初始化为零,并且每个像素占用4个字节(RGBA格式)。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值