{"action":"opened","issue":{"url":"https://api.github.com/repos/mshabunin/test2/issues/289","labels_url":"https://api.github.com/repos/mshabunin/test2/issues/289/labels{/name}","comments_url":"https://api.github.com/repos/mshabunin/test2/issues/289/comments","events_url":"https://api.github.com/repos/mshabunin/test2/issues/289/events","html_url":"https://github.com/mshabunin/test2/issues/289","id":95183040,"number":289,"title":"CvCapture_FFMPEG::retrieveFrame(...) gives SIGSEGV for high-framerate AVI","user":{"login":"mshabunin","id":3304494,"avatar_url":"https://avatars.githubusercontent.com/u/3304494?v=3","gravatar_id":"","url":"https://api.github.com/users/mshabunin","html_url":"https://github.com/mshabunin","followers_url":"https://api.github.com/users/mshabunin/followers","following_url":"https://api.github.com/users/mshabunin/following{/other_user}","gists_url":"https://api.github.com/users/mshabunin/gists{/gist_id}","starred_url":"https://api.github.com/users/mshabunin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mshabunin/subscriptions","organizations_url":"https://api.github.com/users/mshabunin/orgs","repos_url":"https://api.github.com/users/mshabunin/repos","events_url":"https://api.github.com/users/mshabunin/events{/privacy}","received_events_url":"https://api.github.com/users/mshabunin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mshabunin/test2/labels/affected:%202.4","name":"affected: 2.4","color":"ededed"},{"url":"https://api.github.com/repos/mshabunin/test2/labels/auto-transferred","name":"auto-transferred","color":"ededed"},{"url":"https://api.github.com/repos/mshabunin/test2/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/mshabunin/test2/labels/category:%20highgui-video","name":"category: highgui-video","color":"ededed"},{"url":"https://api.github.com/repos/mshabunin/test2/labels/priority:%20normal","name":"priority: normal","color":"ededed"},{"url":"https://api.github.com/repos/mshabunin/test2/labels/status:%20open","name":"status: open","color":"ededed"},{"url":"https://api.github.com/repos/mshabunin/test2/labels/target:%20-","name":"target: -","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-15T12:44:35Z","updated_at":"2015-07-15T12:44:36Z","closed_at":null,"body":"Converted from http://code.opencv.org/issues/3030\r\n```\n|| by Brian TheLion on 2013-05-16 06:48\n|| Status: Open\n|| Priority: Normal\n|| Affected: 2.4.5 (latest release)\n|| Target: -\n|| Category: highgui-video\n|| Tracker: bug\n```\n\nCvCapture_FFMPEG::retrieveFrame(...) gives SIGSEGV for high-framerate AVI\n-----------\n```\nBasic video capture-and-display scenario using compiled 2.4.5 libraries:\n\n    /* cvvideoshow.cpp */\n    #include <opencv2/highgui/highgui.hpp>\n    #include <iostream>\n    using namespace cv;\n    using namespace std;\n\n    int main( int argc, char** argv ) {\n      if( argc != 2) {\n        cout <<\" Usage: cvimshow [video_file]\" << endl;\n        return -1;\n      }\n\n      VideoCapture cap(argv[1]);\n      if (!cap.isOpened()) {       //check if video device has been initialized\n        cout << \"Cannot open file\" << endl;\n      }\n\n      Mat cameraFrame;\n\n      //unconditional loop\n      while (true) {\n        if (!cap.read(cameraFrame)) break;\n        imshow(\"cam\", cameraFrame);\n        if (waitKey(30) >= 0) break;\n      }\n      return 0;\n    }\n\n    $ gcc cvvideoshow.cpp -o cvvideoshow -lopencv_highgui -lopencv_core -lstdc++\n    $ ./cvvideoshow 1000fps.avi # file available for download at https://docs.google.com/file/d/0Bz_2ACaA7oKEV2d6eF93WDd6YVk/edit?usp=sharing\n    Segmentation Fault\n    $ (install)br@breach:~/dev/proj/cv/build/cvhelpers/src/cvimshow$ gdb --args ./cvimshow 1000fps.avi \n    GNU gdb (GDB) 7.5.91.20130417-cvs-ubuntu\n    Copyright (C) 2013 Free Software Foundation, Inc.\n    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n    This is free software: you are free to change and redistribute it.\n    There is NO WARRANTY, to the extent permitted by law.  Type \"show copying\" \n    and \"show warranty\" for details.\n    This GDB was configured as \"x86_64-linux-gnu\".\n    For bug reporting instructions, please see:\n    <http://www.gnu.org/software/gdb/bugs/>...\n    Reading symbols from cvvideoshow...(no debugging symbols found)...done.\n    (gdb) r\n    Starting program: ./cvvideoshow 1000fps.avi\n    warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000\n    [Thread debugging using libthread_db enabled]\n    Using host libthread_db library \"/lib/x86_64-linux-gnu/libthread_db.so.1\".\n    Program received signal SIGSEGV, Segmentation fault.\n    0x00007ffff31c3e51 in ?? ()\n       from /usr/lib/x86_64-linux-gnu/libswscale.so.2\n    (gdb) bt\n    #0  0x00007ffff31c3e51 in ?? ()\n       from /usr/lib/x86_64-linux-gnu/libswscale.so.2\n    #1  0x00007ffff31a9e16 in sws_scale ()\n       from /usr/lib/x86_64-linux-gnu/libswscale.so.2\n    #2  0x00007ffff7bae851 in CvCapture_FFMPEG::retrieveFrame(int, unsigned char**, int*, int*, int*, int*) ()\n       from /usr/lib/libopencv_highgui.so.2.4\n    #3  0x00007ffff7bae8fb in cvRetrieveFrame_FFMPEG ()\n       from /usr/lib/libopencv_highgui.so.2.4\n    #4  0x00007ffff7badc49 in CvCapture_FFMPEG_proxy::retrieveFrame(int) () from /usr/lib/libopencv_highgui.so.2.4\n    #5  0x00007ffff7bac607 in cv::VideoCapture::retrieve(cv::Mat&, int) () from /usr/lib/libopencv_highgui.so.2.4\n    #6  0x00007ffff7bac407 in cv::VideoCapture::read(cv::Mat&) ()\n       from /usr/lib/libopencv_highgui.so.2.4\n    #7  0x00000000004017a1 in main ()\n    (gdb) q\n    A debugging session is active.\n\n        Inferior 1 [process 30800] will be killed.\n\n    Quit anyway? (y or n) y\n```\n\nHistory\n-------\n##### by Alexander Shishkov on 2013-05-17 02:02\n```\nThank you for reporting the issue. Could you add more details about your\nOS and FFMPEG versions? Does this code work with other videos?\n-   Assignee set to Brian TheLion\n-   Category set to highgui-video\n```\n##### by Brian TheLion on 2013-05-17 04:26\n```\nYes, example code works fine for other videos. Here's how I discovered\nthe issue:\n\n1) The example code was initially implemented on Ubuntu 12.10 using the\ndistro's libopencv-dev (OpenCV v2.3.1-7) package. It worked fine.  \n2) Last week I upgraded from Ubuntu 12.10 to 13.04.  \n3) I rebuilt the example code against the distro's libopencv-dev\npackage, now because of the upgrade at OpenCV v2.4.2.  \n4) The bug appeared.  \n5) I uninstalled libopencv-dev and built OpenCV v2.4.5 from the source\ntarball.  \n6) I rebuilt the example code and still found the bug.\n\nI had someone else here in the office verify this scenario as well.\nThus, the bug appears to have been introduced somewhere between v2.3.1-7\nand v2.4.2.\n```\n##### by Brian TheLion on 2013-05-17 06:29\n```\nFFMPEG-related functionality on Ubuntu 13.04 is provided by libavutil.\nHere are the relevant dependencies from apt:\n\n    br@breach:~$ aptitude show libopencv-highgui2.4 \n    Package: libopencv-highgui2.4            \n    State: installed\n    Automatically installed: yes\n    Version: 2.4.2+dfsg-0exp2ubuntu1\n    Priority: optional\n    Section: universe/libs\n    Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>\n    Architecture: amd64\n    Uncompressed Size: 313 k\n    Depends: libavcodec53 (>= 6:0.8.3-1~) | libavcodec-extra-53\n             (>= 6:0.8.4), libavformat53 (>= 6:0.8.3-1~) |\n             libavformat-extra-53 (>= 6:0.8.4), libavutil51 (>=\n             6:0.8.3-1~) | libavutil-extra-51 (>= 6:0.8.4), libc6\n             (>= 2.15), libdc1394-22, libgcc1 (>= 1:4.1.1),\n             libglib2.0-0 (>= 2.31.8), libgtk2.0-0 (>= 2.8.0),\n             libilmbase6 (>= 1.0.1), libjasper1, libjpeg8 (>= 8c),\n             libopencv-core2.4, libopencv-imgproc2.4 (=\n             2.4.2+dfsg-0exp2ubuntu1), libopenexr6 (>= 1.6.1),\n             libpng12-0 (>= 1.2.13-4), libstdc++6 (>= 4.1.1),\n             libswscale2 (>= 6:0.8.3-1~) | libswscale-extra-2 (>=\n             6:0.8.4), libtiff5 (> 4.0.0-1~), libv4l-0 (>= 0.5.0)\n\nAnd the versions of the libav dependencies:\n\nlibavcodec53 6:0.8.6-1ubuntu2  \nlibavcodec-extra-53 6:0.8.6ubuntu2  \nlibavformat53 6:0.8.6-1ubuntu2  \nlibavformat-extra-53 6:0.8.6ubuntu2  \nlibavutil51 6:0.8.6-1ubuntu2  \nlibavutil-extra-51 6:0.8.6ubuntu2  \nlibswscale2 6:0.8.6-1ubuntu2  \nlibswscale-extra-2 6:0.8.6ubuntu2\n```\n##### by Brian TheLion on 2013-05-22 02:53\n```\nCan someone upstream please confirm this bug? I am now blocking on it. I\nhave provided the code, the configuration, and an example video for\nwhich it fails. Cheers!\n```\n##### by Jaime  Alemany on 2013-08-17 12:32\n```\nHi\n\nI recently upgrade to ubuntu 13.04 and had the same problem. I resolved\nthis setting the frame position to 0 before reading first frame with\ncvSetCaptureProperty().\n\nAfter that the video plays again but now i found a new problem: some of\nthe frames show corrupted data... (im trying to find why)\n```"}}