关于AForge录像,保存后文件长度和录制时长不一致的问题

木v知 木v知 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
最近在用AForge做一个监控的案例,发现例如设置3分钟录制时间,大多情况是2分59秒这样,但是偶尔也会出现录制时长为2分10秒或者2分30秒的情况。咨询下大佬们时长不一致可能是因为什么原因?frame_rate目前设置为30.





//[640,480][800,448][864,480][1024,576][960,720][800,600][1600,896][1712,960][1280,960] [1920,1080]
int width = videoSource.VideoCapabilities[0].FrameSize.Width;
int height = videoSource.VideoCapabilities[0].FrameSize.Height;
int fps = 30;

string path = "D:\\视频监控";
fileName = System.DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".mp4";

if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
path = path + "\\" + fileName;
writer = new VideoFileWriter();
writer.Open(path, width, height, fps, VideoCodec.MPEG4);

this.is_record_video = true;
aTimer.Enabled = true;
aTimer.Interval = MonitorMaxSecond * 500;
// lblmontior.Text = "视频监控中";
IsTimeOut = true;
videoSource.Start();

...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部
木v知
C# 111,130 成员 642,539 内容