开发者

Saving as Flash in C++

开发者 https://www.devze.com 2023-02-13 05:25 出处:网络
How to save an IPLImage of OpenCV as a Flash file?Maybe there is a librar开发者_如何学Cy that does that?If you mean storing your output as a flash video (.flv) just use ffmpeg (libavcodec/libavformat)

How to save an IPLImage of OpenCV as a Flash file? Maybe there is a librar开发者_如何学Cy that does that?


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.


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.


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)

    • ....


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消