在 C++ 中保存为 Flash

发布于 2024-10-18 14:40:03 字数 65 浏览 1 评论 0原文

如何将OpenCV的IPLImage保存为Flash文件?也许有一个图书馆可以做到这一点?

How to save an IPLImage of OpenCV as a Flash file? Maybe there is a library that does that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(4

一世旳自豪 2024-10-25 14:40:03

如果您的意思是将输出存储为 Flash 视频 (.flv),只需使用 ffmpeg (libavcodec/libavformat)。它是跨平台的,支持 .flv 格式(除了大量其他格式),并且应该很容易做到。您也可以嵌入音频。

请注意:ffmpeg 部分包含在 opencv 中(取决于您的构建)作为视频编码器/解码器,我不知道您是否可以强制它从 opencv 中写入 .flv (通过选择正确的编解码器字符串) 。无论如何,将 IplImage 转换为 ffmpeg 缓冲区并从那里存储并不难。

您可能遇到的问题是最新的 opencv (2.1) 无法使用 ffmpeg 支持进行构建,或者是针对您不想要的某些 ffmpeg 版本进行构建。但如上所述,您不需要通过 opencv 2.1 api 使用 ffmpeg,因为您可以直接使用 ffmpeg api 来使用它。

在 libavcodec 中查找有关如何编写视频的示例,并检查 opencv 源代码以了解如何从 IplImage 转换为 AVPacket/AVFrame。我以前做过这个,而且效果很好
很容易做到。

If you mean storing your output as a flash video (.flv) just use ffmpeg (libavcodec/libavformat). It is cross platform and supports the .flv format (besides a massive amout of others) and should be quite easy to do. You can embed audio too.

As a note: ffmpeg is partially included in opencv (depending on your build) as a video coder/decoder, i don't know though if you can force it to write as .flv (by choosing the right codec string) from within opencv. Anyways it's not too hard to convert IplImage to a ffmpeg buffer and store from there.

A problem you might have is that latest opencv (2.1) has trouble to build with ffmpeg support or is build against some ffmpeg version you don't want. But as mentioned above you don't need to use ffmpeg via the opencv 2.1 api, since you can use it directly by using the ffmpeg api.

Look for the examples in libavcodec on how to write a video, and check the opencv source on how to convert from IplImage to AVPacket/AVFrame. I've done this before and it was quite
easy to do.

无尽的现实 2024-10-25 14:40:03

我不太了解Flash,但是您可以操作IplImage(名为char *imageData)的数据指针。数据可以以 1 到 4 位计划之间的形式访问,格式您肯定知道。尝试从此数据指针写入 Flash 文件。

I don't know Flash much, but you can manipulate the data pointer of an IplImage (named char *imageData). Data is accessible as between 1 and 4 bit plans, in a format you surely know. Try writing your Flash file from this data pointer.

孤独难免 2024-10-25 14:40:03

lital,据我所知openCV不支持创建flash。
我对此类问题的解决方案是 Red5 Server

,正如他们的页面所说

Red5 是一个开源 Flash 服务器
用 Java 编写,支持:

  • 流媒体视频(FLV、F4V、MP4)

    • ...

lital , Well to my knowledge openCV doesn't support creating flash .
My solution for such a problem is Red5 Server

and as their page says

Red5 is an Open Source Flash Server
written in Java that supports:

  • Streaming Video (FLV, F4V, MP4)

    • ....
把梦留给海 2024-10-25 14:40:03

您可以将图像转储到一系列文件中,例如 img00000.ppm、img00001.ppm...,然后将视频编码委托给 MEncoder,根据 docs,支持 flv。

这就是我们通常做的事情,以便准备诸如这个之类的视频。

You could dump your images in a sequence of files, say img00000.ppm, img00001.ppm, ..., and then delegate the video encoding to MEncoder, which, according to docs, supports flv.

That's what we usually do in order to prepare videos such as this one.

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