Generating video from a sequence of images in C#

后端 未结 4 1155
走了就别回头了
走了就别回头了 2020-12-16 06:59

I have a task of generating video from a sequence of images in my app and while searching for that i found out that FFMPEG is able to do that.Can anyone provide me any tutor

相关标签:
4条回答
  • 2020-12-16 07:30

    I bit late but I have made a tutorial on how I solved my similar problem if you did not succeed yet: Image sequence to video stream?

    0 讨论(0)
  • 2020-12-16 07:37

    I could not manage to get the above example to work. However I did find another library that works amazingly well once. Try via NuGet "accord.extensions.imaging.io", then I wrote the following little function:

        private void makeAvi(string imageInputfolderName, string outVideoFileName, float fps = 12.0f, string imgSearchPattern = "*.png")
        {   // reads all images in folder 
            VideoWriter w = new VideoWriter(outVideoFileName, 
                new Accord.Extensions.Size(480, 640), fps, true);
            Accord.Extensions.Imaging.ImageDirectoryReader ir = 
                new ImageDirectoryReader(imageInputfolderName, imgSearchPattern);
            while (ir.Position < ir.Length)
            {
                IImage i = ir.Read();
                w.Write(i);
            }
            w.Close();
        }
    

    It reads all images from a folder and makes a video out of them.

    If you want to make it nicer you could probably read the image dimensions instead of hard coding, but you got the point.

    0 讨论(0)
  • 2020-12-16 07:39

    Same question asked here.

    The answer there points to here, which is not exactly what you're doing, but is easily configurable to do the job.

    0 讨论(0)
  • 2020-12-16 07:42

    http://electron.mit.edu/~gsteele/ffmpeg/
    http://www.codeproject.com/Articles/7388/A-Simple-C-Wrapper-for-the-AviFile-Library
    http://ffmpeg.org/ffmpeg.html -> search for For creating a video from many images:

    All the links are from this question on SO

    Link related to FFMPEG in .net (From this question);

    FFMpeg.NET
    FFMpeg-Sharp
    FFLib.NET
    http://ivolo.mit.edu/post/Convert-Audio-Video-to-Any-Format-using-C.aspx

    Other resources
    Expression Encoder
    VLC

    0 讨论(0)
提交回复
热议问题