![]() So, what this does, is create a container video of a given size and framerate, and codec. Var bitmapData = ImageData.FromPointer(bitLock.Scan0, ImagePixelFormat.Bgr24, bitmap.Size) į(bitmapData) // Encode the frame Var bitLock = bitmap.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb) Var bitmap = Bitmap.FromStream(memInput) as Bitmap Var memInput = new MemoryStream(binInputFile) Var binInputFile = File.ReadAllBytes(inputFile) Var file = files = (var inputFile in files) Settings.EncoderPreset = EncoderPreset.Fast I used the FFMediaToolkit Nuget package, and also FFmpegLoader.FFmpegPath settings = new VideoEncoderSettings(width: 960, height: 544, framerate: 30, codec: VideoCodec.H264) ![]() ![]() If you’ve seem my earlier example of capturing video from a webcam and saving to a video, this approach is more elegant, since it doesn’t involve chopping the header off the bitmap array, and swapping the red and blue channels, however, this solution is for Windows only, it’s not cross platform. ![]() I’m also assuming you have a collection of images in c:\input, and you want the output video in C:\out-video\out.mp4 – all these paths can be changed. So, as a pre-requisite, you’ll need to download FFMpeg and put it in a folder, I’m calling it “C:\FFmpeg\” – but you can put it anywhere. You want to create a dynamic video, from a collection of images – Here is where FFMpeg is a great tool to use with C# ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |