How can I extract metadata from video?

asked 2013-09-17 04:07:29 -0600

Ana M. gravatar image

updated 2013-09-17 04:28:14 -0600

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?

edit retag flag offensive close merge delete

Comments

opencv can't extract metadata, not even from images.

also i kinda doubt, that your mpeg even contains the information you mentioned.

berak gravatar imageberak ( 2013-09-17 04:31:44 -0600 )edit

Thanks Berak, but my mpeg file contains the image of the video accompanied with the metadata of the camera (geotagging).

Ana M. gravatar imageAna M. ( 2013-09-17 05:27:04 -0600 )edit

@Ana M. Were you able to solve this?

prakharmohan gravatar imageprakharmohan ( 2014-03-14 00:05:25 -0600 )edit