|
报的错误是:“AForge.Video.VideoException”类型的未经处理的异常在 AForge.Video.VFW.dll 中发生 using System;
using System.Collections.Generic;
//using System.Linq;
//using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Drawing;
using System.Drawing.Imaging;
using System.Collections;
using WindowsFormsApplication2;
using System.IO;
using AForge.Video.VFW;
namespace WindowsFormsApplication2
{
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
DirectoryInfo dir = new DirectoryInfo(@"D:\Image");
DirectoryInfo[] listdir = dir.GetDirectories();
FileInfo[] listfile = dir.GetFiles();
AVIWriter avi = new AVIWriter("wmv3");
//AVIWriter avi = new AVIWriter();
qavi.Open(@"d:"+System.DateTime.Now.ToString("yyyyMMMddhhmmss")+".avi", 358, 472);
foreach (FileInfo s in listfile)
{
//获得图像
Bitmap img = new Bitmap(@"D:\Image" + s.Name);
//载入图像
avi.AddFrame(img);
}
////释放资源
avi.Close();
}
}
}
这个是我参考的网站:http://blog.csdn.net/halen0820/article/details/6897144 关键代码是这个:AVIWriter avi = new AVIWriter(“wmv3”);为什么不能用压缩呢? |
|
|
AVIWriter avi = new AVIWriter(“wmv3”);
这是什么格式,没见过,不是应该wmv么 你不敢跟例子一样,用 |
|
|
我是参考那个教程帖写的,若要压缩,请参考以下网站 http://www.fourcc.org/codecs.php 选择要压缩的格式编码
|
|
|
先换成MPG4试试
然后WMV大写试试,有可能小写不认识 |
|
|
直接用ffmpeg压压就好了。
|
|
|
试了,还是报那个错误啊 |
|
|
那个怎么压啊?有没有相关资料啊? |
|
|
那个可能没用,因为我是要把功能做到项目里面的,不能引入外部exe |
|
| 40分 |
压缩,要有对应的压缩编码库。
你的系统里也许就没有安装压缩编码库,你直接调用压缩编码当然是出错了。 |
|
我把源码传上去了,知道的麻烦看下啊
链接: http://pan.baidu.com/s/1c0vlcuW 密码: 2pvg |
|
|
好像是这个原因啊,谢谢哈,我找找看 |
|
|
果然是这个原因,下一个xvoid就可以了,谢谢 |
|
|
应该是Xvid。 |
|
|
我想问下,xvoid那个exe文件,安装后,怎么使用啊, AVIWriter aviWriter = new AVIWriter(“MPG4”);加了“MPG4”后运行还是出错
|
|