Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

cv::VideoCapture::open(file) causes fatal memory error

Hello. After upgrading Ubuntu to trusty, a simple video-load code became producing fatal memory error. The code is just opening an video file:

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
int main(int argc, char**argv)
{
  std::string path="sample/vout2l.avi";
  cv::VideoCapture vin(path);
  return 0;
}

Executing this causes a fatal memory error:

*** Error in `./cv2-videoread.out': free(): invalid next size (fast): 0x000000000217b590 ***
Abort (core dumped)

I compiled this code with OpenCV 2.4.8 and 2.4.13; both cases finished with the above error.

The backtrace by gdb was:

#0  0x00007fc80d659c37 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007fc80d65d028 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007fc80d6962a4 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#3  0x00007fc80d6a255e in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x00007fc80d6a42ef in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#5  0x00007fc80d6a5ba4 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x00007fc80d6a77d2 in posix_memalign () from /lib/x86_64-linux-gnu/libc.so.6
#7  0x00007fc8092d10fe in av_malloc () from /usr/lib/x86_64-linux-gnu/libavutil.so.52
#8  0x00007fc809512708 in ?? () from /usr/lib/x86_64-linux-gnu/libavformat.so.54
#9  0x00007fc8095139b3 in avio_open2 ()
  from /usr/lib/x86_64-linux-gnu/libavformat.so.54
#10 0x00007fc8095b69e3 in avformat_open_input ()
  from /usr/lib/x86_64-linux-gnu/libavformat.so.54
#11 0x00007fc80df30584 in CvCapture_FFMPEG::open(char const*) ()
  from /usr/lib/libopencv_highgui.so.2.4
#12 0x00007fc80df30719 in cvCreateFileCapture_FFMPEG ()
  from /usr/lib/libopencv_highgui.so.2.4
#13 0x00007fc80df32ac9 in cvCreateFileCapture_FFMPEG_proxy(char const*) ()
  from /usr/lib/libopencv_highgui.so.2.4
#14 0x00007fc80df1ad89 in cvCreateFileCapture ()
  from /usr/lib/libopencv_highgui.so.2.4
#15 0x00007fc80df1b045 in cv::VideoCapture::open(std::string const&) ()
  from /usr/lib/libopencv_highgui.so.2.4
---Type <return> to continue, or q <return> to quit---
#16 0x00000000004008a2 in main (argc=<optimized out>, argv=<optimized out>)
    at cv2-videoread.cpp:32

It seemed that the issue was caused by libavformat and/or libavutil, so I reinstalled them but it didn't work.

If you have any ideas to fix this issue or investigate more, please let me know. I'm struggling with this issue for these several months.

Many thanks.