获取特定视频帧
我一直在这里浏览(堆栈溢出),试图找到一种稳定的方法来从视频文件中获取图像(像素数组)。在 C# .NET 中我发现:
http://www.codeproject.com/KB/graphics /ExtractVideoFrames.aspx
这几乎正是我正在寻找的,但我不断收到此错误:
Could not load file or assembly 'Interop.DexterLib,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
or one of its dependencies. An attempt was made to load
a program with an incorrect format.
一切都编译正常,但运行时 .net 运行时不喜欢“Interop.DexterLib”,我已经仔细检查过它是在带有 exe 的 bin 中,项目将它们正确链接并编译良好。
经过一番谷歌搜索后,错误似乎与 x86 .dll 以及在 x64 位操作系统中运行它们有关。为了否定这一点,他们建议为 x86 构建,VS2010 没有这个选项,因为他们用“任何 CPU”替换了它?这是问题所在吗?有什么好的办法可以解决吗?
有没有更好的方法在 C# 中获取视频帧,我看过 DirectShow.Net,但我一生都无法理解直接显示中发生的情况。我还没有找到像这样简单的解决方案(如果可行的话)。
我的最终目标是能够从字节数组中的 2 个视频文件中获取帧...修改它们,然后将它们保存回新视频。首先要做的是将视频存入内存。
I have been browsing around here (stack overflow) attempting to find a stable way to get images (an array of pixels) out of video files in general. In C# .NET I have found:
http://www.codeproject.com/KB/graphics/ExtractVideoFrames.aspx
Which is almost exactly what I am looking for but I keep getting this error:
Could not load file or assembly 'Interop.DexterLib,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
or one of its dependencies. An attempt was made to load
a program with an incorrect format.
Everything compiles fine but when run the .net runtime does not like 'Interop.DexterLib', I have double checked that it is in the bin with the exe and the project has them linked properly and compiles fine.
After some googleing the error seems to revolve around x86 .dlls and running them in x64 bit operating systems. To negate this they recommended building for x86, VS2010 does not have this option as they replaced it with "Any CPU"? Is this the problem? and is there any good way to fix it?
Is there a better way to get video frames in C#, I have looked at DirectShow.Net and for the life of me I cannot understand what is going on within direct show. I have yet to find a solution as simple as this (if it would work).
My final objective is to be able to get frames from 2 video files in byte arrays... modify them, and then save them back to a new video. First things first is getting the video into memory.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您的 Visual Studio 有问题。我的 2010 有以下选项:
Something is wrong with your Visual Studio. My 2010 has these options:
您可以使用
corflags
使 64 位程序集与 x86 平台兼容Corflags 描述
You can use
corflags
to make your 64 bit assembly compatible with x86 platformCorflags description
该文章中的 MediaDet 是 DirectShow 的一部分。只需使用 DirectShow.NET,您的链接问题就会消失。如果您需要将修改后的帧保存到另一个视频,则必须构建 DirectShow 图表,仅使用 MediaDet 不会对您有帮助。
The MediaDet from that article is part of DirectShow. Just use DirectShow.NET and your linking problems will go away. If you need to save modified frames to another video, you'll have to build a DirectShow graph, using just MediaDet will not help you.