C# 从图像文件中创建视频?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1155802/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Create Video out of image files?
提问by MRFerocius
I'm trying to make a video out of a folder full of jpeg files. I tried Google, and everybody is stuck with this. I have downloaded the WM SDK and the Encoder, but since the moment I don't know their object model I cant do much.
我正在尝试从一个充满 jpeg 文件的文件夹中制作视频。我试过谷歌,每个人都坚持这个。我已经下载了 WM SDK 和编码器,但是从我不知道它们的对象模型的那一刻起,我就无能为力了。
Does somebody here have some code WORKING about how to create a WMV or an AVI or a MPEG video file out of a folder full of jpegs? (In C#)
这里有人有一些关于如何从一个充满 jpeg 的文件夹中创建 WMV 或 AVI 或 MPEG 视频文件的代码吗?(在 C# 中)
I can see on the answers that apparently there is no way to do it from C#, just using a third party. I will check your suggestions.
我可以在答案中看到,显然没有办法从 C# 中做到这一点,只能使用第三方。我会检查你的建议。
采纳答案by Jon Galloway
Take a look at Corinna John's AVIFile wrapper. I used it in the AVI output plugin for Cropper.
看看Corinna John 的 AVIFile 包装器。我在Cropper的AVI 输出插件中使用了它。
回答by MyItchyChin
回答by Falaina
VirtualDubis capable of making a video out of several image files. Here'sa quite overview of how to do it.
VirtualDub能够从多个图像文件中制作视频。这是如何做到这一点的概述。
FFMPEG, as CptSkippy mentioned, also has this feature.
FFMPEG,正如CptSkippy 提到的,也有这个功能。
回答by Jim Mischel
I finally settled on Splicer. Free, simple to use, and it works. More info at Working way to make video from images in C#
我最终选择了Splicer。免费,易于使用,并且有效。在 C# 中从图像制作视频的工作方式中的更多信息
回答by vkancthev
See the AVBlocks Slideshow sample. It creates a video (like MP4) from images. The input is a series of JPEG images. The output is configured with an AVBlocks preset.
请参阅AVBlocks 幻灯片示例。它从图像创建视频(如 MP4)。输入是一系列 JPEG 图像。输出配置有 AVBlocks 预设。
回答by SCBuergel.eth
Try via NuGet "accord.extensions.imaging.io", then I wrote the following little function:
通过NuGet“accord.extensions.imaging.io”尝试,然后我写了以下小函数:
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.
如果你想让它变得更好,你可以阅读图像尺寸而不是硬编码,但你明白了。