1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
   |       #include <cstdlib>
      #include <iostream>
      #include <windows.h>
      #include <vfw.h> //dispo avec dev-cpp ou vc++
 
      using namespace std;
      int main(int argc, char *argv[])
 
      {
         int tmp;
         cout << "tentative de lecture d'une vidéo"<<endl<<endl;
         AVIFileInit();
         PAVIFILE avi(NULL);
         if(AVIFileOpen(&avi, "C:/DivX/Dogma.avi", OF_READ, NULL) == 0)
         {
             AVIFILEINFO avi_info;
             if(AVIFileInfo(avi, &avi_info, sizeof(AVIFILEINFO)) == 0) 
             {
                 cout << "Longueur de la trame: "<<avi_info.dwLength << endl;
                 cout << "Nombre de trame "<<avi_info.dwStreams <<endl;
                 cout << "Hauteur de l'image "<<avi_info.dwHeight <<endl;
                 cout << "Largeur de l'image "<<avi_info.dwWidth <<endl;
                 tmp = avi_info.dwRate/avi_info.dwScale;
                 cout << "Rate "<<avi_info.dwRate <<endl;
                 cout << "Scale "<<avi_info.dwScale <<endl;
                 cout << "nombre de trame par seconde "<<tmp <<endl;
             }
         }
         PAVISTREAM avi_stream(NULL);
         PGETFRAME GetFrame;
         int nb_frames;
         void *pDIB;
         BITMAPINFOHEADER *bmp_h = (BITMAPINFOHEADER *) AVIGETFRAMEF_BESTDISPLAYFMT;
         int streamNumber = 0;
         nb_frames = AVIStreamLength( avi_stream );
         printf("Nombre de frames: %d",nb_frames);
         GetFrame = AVIStreamGetFrameOpen( avi_stream, bmp_h );
         pDIB = AVIStreamGetFrame( GetFrame, 1 );
 
 
         while(AVIFileGetStream(avi, &avi_stream, streamtypeVIDEO, streamNumber++) == 0) 
         {
             AVISTREAMINFO avi_stream_info;
             if(AVIStreamInfo(avi_stream, &avi_stream_info, sizeof(AVISTREAMINFO)) == 0) 
             {
                 //AVISTREAMINFO avi_stream;
                 cout << "langue de la trame: "<<avi_stream_info.wLanguage <<endl;
                 cout << "fourCC du codec: "<<avi_stream_info.fccHandler <<endl;
                 //cout << "Dimensions : "<<avi_stream_info.rcFrame <<endl;                 
             }
 
         }
      AVIFileExit();
      system("PAUSE" );
      return EXIT_SUCCESS;
      } | 
Partager