Erreur lorsque j’utilise aforge FFMPEG

la programmation


salut les gars
J’utilise la bibliothèque Aforge dans mon projet pour capturer une image et enregistrer une vidéo en direct à partir d’une webCam…
mais lorsque vous utilisez ffmpeg.dll pour enregistrer le fichier AVI de la webCam, envoyez cette erreur :

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

Erreur sur l’image :

[^]

comment gérer cette erreur ?
merci

Ce que j’ai essayé :

comment gérer cette erreur ?
je ne connais pas le travail

Solution 1

Voir Classe VideoFileReader[^] pour obtenir des instructions sur l’installation et l’utilisation.

Solution 2

Utilisez Picturebox pour le timelapse et ffmpeg.exe pour créer la vidéo, AForge.Video.FFMPEG semble ne pas fonctionner !

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