1
if (_capture == null)
        {
            try
            {
                _capture = new Capture("video1.mpg");
            }
            catch (NullReferenceException ex)
            {   //show errors if there is any
                MessageBox.Show(ex.Message);
            }
        }

video1.mpg 文件位于 bin 文件夹中。我已经使用任何视频转换器将 avi 文件转换为 MPEG-1 格式。 但是这种格式仍然不起作用。我也尝试过mencoder。但仍然是同样的错误。

Unable to create capture from video1.mpg

如何使其与 emgu 兼容Capture

4

2 回答 2

3

将视频转换为 i420 fromat。

下载这个转换器。

执行转换的命令:

mencoder inputVideo.avi -ovc raw -vf format=i420 -o convertedVideo.avi

这个convertedVideo.avi 现在可以被捕获了。

于 2015-03-07T01:18:23.320 回答
1

首先,您需要将您的视频文件转换为 .avi 格式。然后使用其他工具来转换所需的视频文件。您现在使用的工具可能是演示版,这就是为什么它可能无法正确隐藏它的原因......然后尝试以下代码:

   string nameOfFile = @"D:\somefile.avi";// your vedio path
Capture _capture = new Capture(name);
      try
        {
            _capture = new Capture(nameOfFile);
        }
        catch (NullReferenceException ex)
        {   //show errors if there is any
            MessageBox.Show(ex.Message);
        }
于 2015-03-06T08:01:41.620 回答