Ask Your Question

Revision history [back]

I check on Mac OS X 10.8.5 + OpenCV 2.4.6 ( gcc => Apple LLVM version 5.0 (clang-500.2.76) with Qt IDE)

It works fine. No crash, the 30 images can be dumped OK for both file. program end normally.

I think the problem is not caused by OpenCV itself.

The problem maybe "You don't have the correct codec for this file".

Since codec is something independent from OpenCV.

As I know, you install codec into system, OpenCV use them.

The codec of the avi is "rawvideo", which is reported by FFmpeg (installed separately, not from OpenCV).

It seems I have correct codec on my system, because FFmpeg can dump jpg also normally.

here is the information from my FFmpeg of your 41.avi


configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-nonfree --enable-postproc --enable-libfdk-aac --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-libtheora --enable-libvorbis --enable-libvpx --enable-shared --enable-mmx --arch=x86_64 --enable-swscale --enable-runtime-cpudetect --enable-pthreads --enable-avfilter --enable-libspeex --enable-libopenjpeg

libavutil 52. 46.100 / 52. 46.100

libavcodec 55. 33.100 / 55. 33.100

libavformat 55. 18.102 / 55. 18.102

libavdevice 55. 3.100 / 55. 3.100

libavfilter 3. 87.100 / 3. 87.100

libswscale 2. 5.100 / 2. 5.100

libswresample 0. 17.103 / 0. 17.103

libpostproc 52. 3.100 / 52. 3.100

Input #0, avi, from '41.avi':

Duration: 00:00:01.20, start: 0.000000, bitrate: 16930 kb/s

Stream #0:0: Video: rawvideo, pal8, 351x240, 25 tbr, 25 tbn, 25 tbc

Metadata:

  title           : F:\video\Journal\NLM\Suzie\41.avi

I check on Mac OS X 10.8.5 + OpenCV 2.4.6 ( gcc => Apple LLVM version 5.0 (clang-500.2.76) with Qt IDE)

It works fine. No crash, the 30 images can be dumped OK for both file. program end normally.

I think the problem is not caused by OpenCV itself.

The problem maybe "You don't have the correct codec for this file".

Since codec is something independent from OpenCV.

As I know, you install codec into system, OpenCV use them.

The codec of the avi is "rawvideo", which is reported by FFmpeg (installed separately, not from OpenCV).

It seems I have correct codec on my system, because FFmpeg can dump jpg also normally.

here is the information from my FFmpeg of your 41.avi


configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-nonfree --enable-postproc --enable-libfdk-aac --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-libtheora --enable-libvorbis --enable-libvpx --enable-shared --enable-mmx --arch=x86_64 --enable-swscale --enable-runtime-cpudetect --enable-pthreads --enable-avfilter --enable-libspeex --enable-libopenjpeg

libavutil 52. 46.100 / 52. 46.100

libavcodec 55. 33.100 / 55. 33.100

libavformat 55. 18.102 / 55. 18.102

libavdevice 55. 3.100 / 55. 3.100

libavfilter 3. 87.100 / 3. 87.100

libswscale 2. 5.100 / 2. 5.100

libswresample 0. 17.103 / 0. 17.103

libpostproc 52. 3.100 / 52. 3.100

Input #0, avi, from '41.avi':

Duration: 00:00:01.20, start: 0.000000, bitrate: 16930 kb/s

Stream #0:0: Video: rawvideo, pal8, 351x240, 25 tbr, 25 tbn, 25 tbc Metadata: tbc

Metadata:

title : F:\video\Journal\NLM\Suzie\41.avi F:\video\Journal\NLM\Suzie\41.avi


here is the code, but I think nothing different


#include <iostream>
#include <string>
#include <sstream>
#include "opencv/highgui.h"

using namespace std ;
using namespace cv ;

int main()
{
    string fname = "/your/path/to/41.avi" ;
    string savep = "/your/path/to/save/frames/" ;

    VideoCapture video(fname) ;
    Mat frame ;

    if( !video.isOpened() ) {
        cout << "Open file failed" << endl ;
        return false ;
    }

   int c = 0 ;

   for(;;++c)
   {
       if( video.read( frame ) == false )
           break ;

       stringstream ss ;
       ss << savep << c << ".jpg" ;

       imwrite( ss.str() , frame ) ;
   }
   cout << c << " frame dumped" << endl ;
   return true ;
}

I check on Mac OS X 10.8.5 + OpenCV 2.4.6 ( gcc => Apple LLVM version 5.0 (clang-500.2.76) with Qt IDE)

It works fine. No crash, the 30 images can be dumped OK for both file. Suize and Forman video. program end normally.

I think the problem is not caused by OpenCV itself.

The problem maybe "You don't have the correct codec for this file".

Since codec is something independent from OpenCV.

As I know, you install codec into system, OpenCV use them.

The codec of the avi is "rawvideo", which is reported by FFmpeg (installed separately, not from OpenCV).

It seems I have correct codec on my system, because FFmpeg can dump jpg also normally.

here is the information from my FFmpeg of your 41.aviSuize.avi


configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-nonfree --enable-postproc --enable-libfdk-aac --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-libtheora --enable-libvorbis --enable-libvpx --enable-shared --enable-mmx --arch=x86_64 --enable-swscale --enable-runtime-cpudetect --enable-pthreads --enable-avfilter --enable-libspeex --enable-libopenjpeg

libavutil 52. 46.100 / 52. 46.100

libavcodec 55. 33.100 / 55. 33.100

libavformat 55. 18.102 / 55. 18.102

libavdevice 55. 3.100 / 55. 3.100

libavfilter 3. 87.100 / 3. 87.100

libswscale 2. 5.100 / 2. 5.100

libswresample 0. 17.103 / 0. 17.103

libpostproc 52. 3.100 / 52. 3.100

Input #0, avi, from '41.avi':

Duration: 00:00:01.20, start: 0.000000, bitrate: 16930 kb/s

Stream #0:0: Video: rawvideo, pal8, 351x240, 25 tbr, 25 tbn, 25 tbc

Metadata:

title : F:\video\Journal\NLM\Suzie\41.avi


here is the code, but I think nothing different


#include <iostream>
#include <string>
#include <sstream>
#include "opencv/highgui.h"

using namespace std ;
using namespace cv ;

int main()
{
    string fname = "/your/path/to/41.avi" ;
    string savep = "/your/path/to/save/frames/" ;

    VideoCapture video(fname) ;
    Mat frame ;

    if( !video.isOpened() ) {
        cout << "Open file failed" << endl ;
        return false ;
    }

   int c = 0 ;

   for(;;++c)
   {
       if( video.read( frame ) == false )
           break ;

       stringstream ss ;
       ss << savep << c << ".jpg" ;

       imwrite( ss.str() , frame ) ;
   }
   cout << c << " frame dumped" << endl ;
   return true ;
}

I check on Mac OS X 10.8.5 + OpenCV 2.4.6 ( gcc => Apple LLVM version 5.0 (clang-500.2.76) with Qt IDE)

It works fine. No crash, the 30 images can be dumped OK for both Suize and Forman video. program end normally.

I think the problem is not caused by OpenCV itself.

The problem maybe "You don't have the correct codec for this file".

Since codec is something independent from OpenCV.

As I know, you install codec into system, OpenCV use them.

The codec of the avi is "rawvideo", which is reported by FFmpeg (installed separately, not from OpenCV).

It seems I have correct codec on my system, because FFmpeg can dump jpg also normally.

here is the information from my FFmpeg of your Suize.avi41.avi


configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-nonfree --enable-postproc --enable-libfdk-aac --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-libtheora --enable-libvorbis --enable-libvpx --enable-shared --enable-mmx --arch=x86_64 --enable-swscale --enable-runtime-cpudetect --enable-pthreads --enable-avfilter --enable-libspeex --enable-libopenjpeg

libavutil 52. 46.100 / 52. 46.100

libavcodec 55. 33.100 / 55. 33.100

libavformat 55. 18.102 / 55. 18.102

libavdevice 55. 3.100 / 55. 3.100

libavfilter 3. 87.100 / 3. 87.100

libswscale 2. 5.100 / 2. 5.100

libswresample 0. 17.103 / 0. 17.103

libpostproc 52. 3.100 / 52. 3.100

Input #0, avi, from '41.avi':

Duration: 00:00:01.20, start: 0.000000, bitrate: 16930 kb/s

Stream #0:0: Video: rawvideo, pal8, 351x240, 25 tbr, 25 tbn, 25 tbc

Metadata:

title : F:\video\Journal\NLM\Suzie\41.avi


here is the code, but I think nothing different


#include <iostream>
#include <string>
#include <sstream>
#include "opencv/highgui.h"

using namespace std ;
using namespace cv ;

int main()
{
    string fname = "/your/path/to/41.avi" ;
    string savep = "/your/path/to/save/frames/" ;

    VideoCapture video(fname) ;
    Mat frame ;

    if( !video.isOpened() ) {
        cout << "Open file failed" << endl ;
        return false ;
    }

   int c = 0 ;

   for(;;++c)
   {
       if( video.read( frame ) == false )
           break ;

       stringstream ss ;
       ss << savep << c << ".jpg" ;

       imwrite( ss.str() , frame ) ;
   }
   cout << c << " frame dumped" << endl ;
   return true ;
}