Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How can I extract metadata from video?

I have a video with metadata. I have obtained all the images from the video:

include <stdio.h>

include <stdlib.h>

include<opencv\cv.h>

include<opencv\highgui.h>

int main( int argc, char** argv ) {

printf("* Filename: %s\n", "D:/Video_clip_2.mpg");   

CvCapture *capture = cvCaptureFromAVI("D:/Video_clip_2.mpg");
if(!capture) 
{
    printf("!!! cvCaptureFromAVI failed (file not found?)\n");
    return -1; 
}

int fps = (int) cvGetCaptureProperty(capture, CV_CAP_PROP_FPS);
printf("* FPS: %d\n", fps);

IplImage* frame = NULL;
int frame_number = 0;
char key = 0;   

while (key != 'q') 
{
    // get frame 
    frame = cvQueryFrame(capture);       
    if (!frame) 
    {
        printf("!!! cvQueryFrame failed: no frame\n");
        break;
    }       

    char filename[100];
    strcpy(filename, "D:/imagenes/frame_");

    char frame_id[30];
    itoa(frame_number, frame_id, 10);
    strcat(filename, frame_id);
    strcat(filename, ".jpg");

    printf("* Saving: %s\n", filename);

    if (!cvSaveImage(filename, frame))
    {
        printf("!!! cvSaveImage failed\n");
        break;
    }

    frame_number++;

    // quit when user press 'q'
    key = cvWaitKey(1000 / fps);
}

// free resources
cvReleaseCapture(&capture);

return 0;

}

Now I want extract the metadata (longitude, latitude, altitude, yaw angle, pitch angle, roll angle) from video for each image. How can I extract the metadata?

How can I extract metadata from video?

I have a video with metadata. I have obtained all the images from the video:

include <stdio.h>

include <stdlib.h>

include<opencv\cv.h>

include<opencv\highgui.h>

#include <stdio.h>
#include <stdlib.h>
#include<opencv\cv.h>
#include<opencv\highgui.h>

int main( int argc, char** argv )
{  

 printf("* Filename: %s\n", "D:/Video_clip_2.mpg");   

 CvCapture *capture = cvCaptureFromAVI("D:/Video_clip_2.mpg");
 if(!capture) 
 {
     printf("!!! cvCaptureFromAVI failed (file not found?)\n");
     return -1; 
 }

 int fps = (int) cvGetCaptureProperty(capture, CV_CAP_PROP_FPS);
 printf("* FPS: %d\n", fps);

 IplImage* frame = NULL;
 int frame_number = 0;
 char key = 0;   

 while (key != 'q') 
 {
     // get frame 
     frame = cvQueryFrame(capture);       
     if (!frame) 
     {
         printf("!!! cvQueryFrame failed: no frame\n");
         break;
     }       

     char filename[100];
     strcpy(filename, "D:/imagenes/frame_");

     char frame_id[30];
     itoa(frame_number, frame_id, 10);
     strcat(filename, frame_id);
     strcat(filename, ".jpg");

     printf("* Saving: %s\n", filename);

     if (!cvSaveImage(filename, frame))
     {
         printf("!!! cvSaveImage failed\n");
         break;
     }

     frame_number++;

     // quit when user press 'q'
     key = cvWaitKey(1000 / fps);
 }

 // free resources
 cvReleaseCapture(&capture);

 return 0;
}

}

Now I want extract the metadata (longitude, latitude, altitude, yaw angle, pitch angle, roll angle) from video for each image. How can I extract the metadata?