Lỗi khi tôi sử dụng aforge FFMPEG

lập trình


chào các cậu
tôi sử dụng lib Aforge trong dự án của mình để chụp ảnh và quay video trực tiếp từ webCam …
nhưng khi sử dụng ffmpeg.dll để lưu tệp AVI từ webCam, hãy gửi Lỗi này:

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

Hình ảnh lỗi:

[^]

làm thế nào để xử lý lỗi này?
Cảm ơn

Những gì tôi đã thử:

làm thế nào để xử lý lỗi này?
tôi không biết công việc

Giải pháp 1

Nhìn thấy Lớp VideoFileReader[^] để được hướng dẫn cài đặt và sử dụng.

Giải pháp 2

Sử dụng picturebox cho timelapse và ffmpeg.exe để tạo video, AForge.Video.FFMPEG có vẻ không hoạt động!

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をコピーしました