<div dir="ltr">I'm not an expert but maybe I can give u a simpler solution.... just ignore if I'm talking nonsense stuffs..<div><br></div><div>maybe if u just av_init_packet before av_free_packet your problem is solved and you don't have memory leak.</div><div>I haven't tested this theory, its just an idea.</div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-03-05 8:30 GMT-03:00 Johannes Rehm <span dir="ltr"><<a href="mailto:hahne.rehm@gmx.de" target="_blank">hahne.rehm@gmx.de</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:Verdana;font-size:12.0px"><div>
<div>Hi All,</div>

<div> </div>

<div>there is a known bug in the VideoCapture ffmpeg module of OpenCV. It occurs while loading videos without  a codec:</div>

<div><a href="http://code.opencv.org/issues/1915" target="_blank">http://code.opencv.org/issues/1915</a></div>

<div>I had some time now to debug this bug and found the issue in:</div>

<div>CvCapture_FFMPEG::grabFrame()</div>

<div>In the function</div>

<div>avcodec_decode_video2(video_st->codec, picture, &got_picture, &packet);</div>

<div>the AVFrame picture get set. But after</div>

<div>av_free_packet (&packet);</div>

<div>I get: "error: Cannot access memory at address..." for picture.data[0] which leads to a segmentation fault later in the function sws_scale().</div>

<div>I can encode this video with a video codec using ffmpeg or whatever and I get no segmentation fault (memory in picture.data[0] can still be accessed).</div>

<div>Of course there is an easy fix for this bug: Simply comment out / delete</div>

<div>av_free_packet (&packet);</div>

<div>This is working fine for me. Now I can process videos with and without codecs. But I am not sure if this will lead to memory issues if av_free_packet gets not called. Is there anybody who is familiar with the FFmpeg interface of OpenCV and can help me here?</div>

<div>Thanks a lot!</div>

<div> </div>

<div>Best regards,</div>

<div>Johannes Rehm</div>
</div></div></div>
<br>_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">-----------------------------------------------------------------<div>Rafael Lúcio</div></div></div>
</div>