如何在 Visual C 中对视频进行编码?
我有一个视频解密器库,可以解码过时的视频格式,并通过回调函数返回 BMP 格式的视频帧和 WAV 格式的音频。 现在我需要在windows下以任何标准格式编码一个新视频。
执行此操作的标准方法可能是什么? 我使用的是Win32/C。 我猜Windows有自己的编码库和驱动程序,我不需要使用FFMPEG。 任何指向示例代码或至少指向要查看的库的指针都会非常有帮助。
编辑:我接受。 FFMPEG 是最简单的方法。
I have a video decrypter library that can decode an obsolete video format, and returns video frames in BMP and audio in WAV through callback functions. Now I need to encode a new video in any standard format under windows.
What might be the standard way to do this? I am using Win32/C. I guess Windows has its own encoding library and drivers and I don’t need to use FFMPEG. Any pointer to an example code or at least to a library to look at will be greatly helpful.
Edit: I accept. FFMPEG is the easiest way to do it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 Windows 上,您有两种本机选择。
通过 DirectShow 当然可以实现,但您最好喜欢 COM 编程以及过滤器、图形和名字对象的概念(天哪)。 请参阅本教程以获取速成课程:
重新压缩 AVI 文件< /a>
以及 MSDN 文档。
更简单的方法确实是使用像 FFMPEG 或 VLC。
On Windows, you have two native choices.
It's certainly doable through DirectShow, but you better enjoy COM programming and the concepts of Filters, Graphs, and Monikers (oh my). See this tutorial for a crash course:
Recompressing an AVI File
And the MSDN documentation.
A simpler approach is indeed to use an library like FFMPEG or VLC.
为了避免让自己心痛,我同意 Frank 的建议,即只使用 FFMPEG。 使用正确的参数执行单独的 FFMPEG 进程将 100% 是实现编码目标的最简单方法。
您的其他选项包括:
libavcodec - FFMPEG 中使用的中央库。 我警告说,似乎没有很多可用的 Windows 二进制文件 libavcodec,因此您可能必须编译自己的二进制文件,这至少需要设置 Cygwin 或 MingW。
ffdshow-tryouts - 作为基于 DirectShow 过滤器实现的视频编解码器库在 libavcodec 上。 他们似乎确实有一个 API 用于操作它,但它是一个 .NET 库。
To save yourself heartache, I echo Frank's suggestion of just using FFMPEG. Executing a separate FFMPEG process with the correct arguments will 100% be the easiest way to achieve your goals of encoding.
Your other options include:
libavcodec - The central library used in FFMPEG. I warn there don't appear to be many Windows binaries of libavcodec available, so you'd probably have to compile your own, which, at minimum, would require a Cygwin or MingW set up.
ffdshow-tryouts - A video codec library implemented as a DirectShow filter based on libavcodec. They do seem to have an API for manipulating it, but it's a .NET library.
我建议查看 VirtualDub 源代码。 这是一个众所周知的使用 VFW 的编码器。 您也许可以从该软件中获得一些想法。
I would suggest looking at the VirtualDub source code. It's a well known encoder that uses VFW. You may be able to get some ideas from that software.