如何在 Visual C 中对视频进行编码?

发布于 2024-07-26 19:40:14 字数 243 浏览 14 评论 0原文

我有一个视频解密器库,可以解码过时的视频格式,并通过回调函数返回 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我为君王 2024-08-02 19:40:15

在 Windows 上,您有两种本机选择。

  1. 旧的 Windows 多媒体 库太古老了认真考虑,但确实有视频压缩管理器。
  2. 然后是 DirectShow

通过 DirectShow 当然可以实现,但您最好喜欢 COM 编程以及过滤器、图形和名字对象的概念(天哪)。 请参阅本教程以获取速成课程:

重新压缩 AVI 文件< /a>

以及 MSDN 文档

更简单的方法确实是使用像 FFMPEGVLC

On Windows, you have two native choices.

  1. The old Windows Multimedia library which is too ancient to seriously consider, but does have the Video Compression Manager.
  2. And then there's DirectShow.

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.

旧伤还要旧人安 2024-08-02 19:40:15

为了避免让自己心痛,我同意 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.

音盲 2024-08-02 19:40:15

我建议查看 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文