VideoCapture crashes just after opening (Bug #2528)


Added by David Frenay over 12 years ago. Updated over 11 years ago.


Status:Done Start date:2012-11-09
Priority:Normal Due date:
Assignee:Alexander Smorkalov % Done:

0%

Category:highgui-video
Target version:2.4.7
Affected version:branch '2.4' (2.4-dev) Operating System:Windows
Difficulty: HW Platform:x64
Pull request:

Description

I run the following code
"
cv::VideoCapture Capture;
Capture.open("Video.avi");
"
and it crashes at the opening of the video file. The only error I've got is "0xC0000005" and no other message. It crashes when using the "debug" or the "release" mode.

I work with Windows 7 64bits, OpenCV 2.4.9, CMake 2.8, and GCC 4.6.1. I develop with CodeBlocks.

Most important : I build the opencv library unchecking the variable "build_shared_libs" to work with static library. I've attached the CMakeCache file.

The rest of OpenCV works fine. Finally, the closest related issue is this one : https://code.ros.org/trac/opencv/ticket/752.


CMakeCache.txt (92.5 kB) David Frenay, 2012-11-09 09:09 pm

CMakeLists.txt (38 kB) Yury Schwarzman, 2013-02-18 03:07 pm

ffmpeg_crash_test.mov (1.1 MB) Yury Schwarzman, 2013-02-18 03:07 pm

CMakeCache.txt (115.7 kB) Yury Schwarzman, 2013-02-18 03:09 pm


Associated revisions

Revision 6c12f203
Added by Andrey Pavlenko almost 11 years ago

Merge pull request #2528 from mlyashko:back_proj_fix

History

Updated by Maria Dimashova over 12 years ago

  • Category set to highgui-video

Updated by David Frenay over 12 years ago

By the way, it works perfectly when I use my webcam with the code
"
cv::VideoCapture Capture;
Capture.open(0);
cv::Mat Cam;
Capture >> Cam;
cv::imshow("Cam", Cam);
"

Updated by Marco Fiocco over 12 years ago

This happens also to me with versions of opencv up to 2.4.3 x64 while opening a video made with the GoPro camera, but somewhat randomly. It crashes somewhere in read_InputMediaStream_FFMPEG(). But the plain ffplay.exe from ffmpeg 1.0 can play it always perfectly!

Updated by Marco Fiocco over 12 years ago

By the way my code is:
videoCapture = new cv::VideoCapture("video.mp4");

Updated by Joseph Donovan over 12 years ago

I hit a related (I think) issue. Using the cv2 python bindings from the 2.4.2 or 2.4.3 releases on win7, I get a crash a couple frames into RAW video. It seems to happen only with RAW video, when I tested with the same videos compressed into other avi formats it seems to work fine. I used to use the same sort of videos on an older release with the old cv python binds and that worked with RAW video.
I did figured out a work around, basically if I set the position each time after the first read I don't get a crash. Since I'm in python I can't debug it further easily, but maybe something isn't getting reset/released properly between RAW frames?
Anyways, here's the pseudocode that seems to work around the issue:

cap = cv2.VideoCapture(filename)
if not cap.isOpened():
       print "ERROR WITH VIDEO" 
    raise 

frame=cap.read()[1]
count = 0
while True: 
    #do some stuff with the frame here
    count +=1
    cap.set(cv2.cv.CV_CAP_PROP_POS_FRAMES, float(count) );
    frame = cap.read()[1]

Maybe this bug is related?: http://code.opencv.org/issues/1915

Updated by Anna Kogan over 12 years ago

  • Assignee set to Andrey Morozov

Updated by Yury Schwarzman about 12 years ago

I narrowed it down to streams with AAC audio. I used one captured with iPhone4S (attached). When I stripped the audio, the program didn't crash.
I have the same configuration (OpenCV 2.4.3 x64 for Windows VS2010, also verified that the problem persists in 2.4.4 beta).
The problem doesn't exist with 32-bit libraries.
I used lkdemo example to reproduce the problem. When running the x64 program from command line, it runs fine. When launching it from VS (either as Debug or Run), access violation exception is raised in cvCreateFileCapture_FFMPEG @ opencv_ffmpeg243_64.dll:
Unhandled exception at 0x66de1f30 in cpp-example-lkdemo.exe: 0xC0000005: Access violation reading location 0xffffffffffffffff.
I attach CMakeCache.txt (version 2.4.4 beta) and a test stream.

Updated by Yury Schwarzman about 12 years ago

Added the correct file for CMakeCache.txt

Updated by Anna Kogan about 12 years ago

Hello Yury,

Thank you for the detailed information! If you could solve the issue on your side, a patch or pull request in the GitHub repo: http://opencv.org/opencv-pull-requests-test-results.html would be highly appreciated!

  • Target version set to 3.0
  • Affected version set to branch '2.4'

Updated by Simion Venshtain almost 12 years ago

I get the exact same issue as the OP. I am trying to playback a RAW RGBA video stream with no audio from an avi. The frame size is 1600x1200.
I think Joseph is right when saying that the fact its a RAW stream has significance, otherwise people will make a lot more noise.
I think Yury's issue is different.

Updated by dak tor almost 12 years ago

Yury: I've run into the same issue as you. Wanted you to know you are not the only one.

Updated by Sly Chief over 11 years ago

I can confirm that removing the audio stream from the video file with ffmpeg prevents OpenCV from crashing.

Updated by Kirill Kornyakov over 11 years ago

We should probably consider it for 2.4.x releases...

  • Target version changed from 3.0 to 2.4.7
  • HW Platform set to x64
  • Operating System set to Windows
  • Affected version changed from branch '2.4' to branch '2.4' (2.4-dev)

Updated by Alexander Smorkalov over 11 years ago

There was some FFMPEG related changes in OpenCV last month and issue could be already solved. @David Frenay, could you try OpenCV 2.4 branch?

  • Assignee changed from Andrey Morozov to Alexander Smorkalov

Updated by Alexander Smorkalov over 11 years ago

Issue has been fixed by recent FFMPEG update and FFMPEG related improvements.

  • Status changed from Open to Done

Also available in: Atom PDF