使用 aforge FFMPEG 时出错

编程


嗨,大家好
我在我的项目中使用 Aforge lib 从网络摄像头捕获图像并录制实时视频…
但是当使用 ffmpeg.dll 从网络摄像头保存 AVI 文件时,发送此错误:

C#
private VideoFileWriter FileWriter = new VideoFileWriter();
        FileWriter.Open("test.avi", 460, 500, 25, VideoCodec.Default, 5000000);
            img = (Bitmap)videoSourcePlayer.GetCurrentVideoFrame().Clone();
        FileWriter.WriteVideoFrame(img);

错误图片:

[^]

如何处理这个错误?
谢谢

我尝试过的:

如何处理这个错误?
我不知道工作

解决方案1

VideoFileReader类[^] 有关安装和使用的说明。

解决方案2

使用picturebox进行延时拍摄并使用ffmpeg.exe创建视频,AForge.Video.FFMPEG似乎不起作用!

private void button4_Click(object sender, EventArgs e)
{
    //timelapse
    string basepath = Application.StartupPath.ToString();
    var imagescount = 60;
    var fps = 10;

    timer1.Enabled = true;
    timer1.Interval = 1000;
    timer1.Start();
   
}

private void timer1_Tick(object sender, EventArgs e)
{
    string basepath = Application.StartupPath.ToString();
    var imagescount = 60;
    int width = 1280;
    int height = 720;            

    // write 60 video frames            
    Bitmap image = (Bitmap)pictureBox1.Image.Clone();
    pictureBox4.Image = image;
    pictureBox4.Refresh();

}

コメント

タイトルとURLをコピーしました