Hello Kazuhiko,
On 11/27/2012 07:26 PM, Kazuhiko Kido wrote:
+----------------------------------------------------------------+
All attached files have been encrypted and changed name for
security purposes. The password will be sent to you later.
+----------------------------------------------------------------+
hmm, ok, but just for your information the mailing list is public, so
the password mail is now also world readable. If in the future you have
something that you require to remain confidential you can always ask on
this list for a private email of the developers.
I am trying to create a movie file by using VideoGrab library
(libVideoGlab.dll).
But it seems to raise memory error at following code.
OSGAVCode.cpp
257 AVCodecEncoder::initCodec
280 _video_outbuf_size= 200000;
281 _video_outbuf= (unsigned char*)av_malloc(_video_outbuf_size);
When the actual out buffer size is over the allocated size, the program
crashes after calling avcodec_encode_video.
yeah, this hardcoded size is not so good :(
Buffer size should be allocated more flexibly or big enough(1024*1024),
or prepare interface to specify the size.
Please refer a sample program attached in this mail for reproduction the crash.
Unfortunately the whole VideoGrab Foreground seems to have bit-rotted
quite badly, to the point that I have trouble building it against the
version of ffmpeg that comes with my Fedora 16 system.
I'm attaching a (untested) patch that makes _video_outbuf the same size
as the input buffer which should be safe - assuming that encoding
generally compresses the data.
Would you mind giving it a try and let us know if it fixes the problem
you are running into? Thank you!
Cheers,
Carsten
Index: Source/Contrib/VideoGrab/OSGAVCodec.cpp
===================================================================
RCS file: /cvsroot/opensg/OpenSG/Source/Contrib/VideoGrab/OSGAVCodec.cpp,v
retrieving revision 1.6
diff -u -p -r1.6 OSGAVCodec.cpp
--- Source/Contrib/VideoGrab/OSGAVCodec.cpp 26 Oct 2011 03:07:37 -0000 1.6
+++ Source/Contrib/VideoGrab/OSGAVCodec.cpp 28 Nov 2012 20:02:53 -0000
@@ -277,8 +277,10 @@ void AVCodecEncoder::initCodec()
_video_outbuf= NULL;
if (!(_format_ctx->oformat->flags & AVFMT_RAWPICTURE))
{
- _video_outbuf_size= 200000;
- _video_outbuf= (unsigned char*)av_malloc(_video_outbuf_size);
+ // assume that encoding produces an image that is at most as big as the
+ // input
+ _video_outbuf_size = avpicture_get_size(c->pic_fmt, c->width, c->height);
+ _video_outbuf = (unsigned char*)av_malloc(_video_outbuf_size);
}
/* allformat_ctxate the encoded raw picture */
------------------------------------------------------------------------------
Keep yourself connected to Go Parallel:
INSIGHTS What's next for parallel hardware, programming and related areas?
Interviews and blogs by thought leaders keep you ahead of the curve.
http://goparallel.sourceforge.net
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users