MP4 file extract information

Amitojc

Member
Dec 4, 2009
186
0
0
Hi,
Currently, I am trying to write a code that takes Mp4 video files and can create gifs from it. I am doing it just for fun.
I was wondering how on a MP4 file format I can extract the following information:

1. Width/Height of the video file
2. RBC Color Space
3. Image JIF

I am not sure if this is the right place for the thread but it is worth a shot to see what people think.
 

razel

Platinum Member
May 14, 2002
2,337
90
101
1. Width/Height is usually in the metadata header.
2. I think you mean RGB and probably you want to know the color space used. That's in the metadata.
3. Image JIF? or GIF?

A good example of software that exposes this is MediaInfo. Sometimes you can even right click the file in Windows explorer and dig into it's properties. I'm sure there's plenty of open source software that does it. I remember extracting EXIF data from photos for web usage at work years ago and it was all built into a Windows object using VBScript.

This may not be a fun ride for you. MP4 uses different video codecs. Meaning you'll need to know the codec and decode it. Obviously you will not reinvent the wheel and write the decode. You'll just use any video decoder's library that's available to you... I imagine that's where you'll spend most of your time. Best of luck.
 
Last edited:

andy04

Senior member
Dec 14, 2006
999
0
71
I remember using gspot back in the day :D is it still around? cannot even do a search for it on the internet at work :biggrin:
 

Amitojc

Member
Dec 4, 2009
186
0
0

To Razel, that sounds good. But I am having a hard time finding open source software for this. If there is open source software for this we can use it and build it into our app.
What do you suggest for the approach for this? Currently we have an program written in C++ that can create a gif if we load a mp4 with the correct parameters. So now we need to get those parameters to do this? An open source approach sounds good because we can look at the code and use it in our own.
 

razel

Platinum Member
May 14, 2002
2,337
90
101
Not GSpot... MediaInfo. It is open source. An example using .NET is here. You are more interested in using the mediainfo library. If you are more comfortable with C++, port their example into C#.

The high level:
1. Extract from the metadata, the MP4 video codec string.
2. Enumerate the video codecs and check to see if it's libraries are available for you to use
3. Feed that MP4 into the proper decoder.
4. Choose frames to encode into a GIF.

This will not be a fun ride. I suggest just using a program to generate the animated GIF.
 
Last edited:

Amitojc

Member
Dec 4, 2009
186
0
0
That sounds good. I am thinking that we will use a program (open source) and make it part of our application to create the gif. That is the only way. Doing it from scratch might be too much. Let me looking into the .NET and get back to you. I am comfortable and will have my friend look into it.
 

Amitojc

Member
Dec 4, 2009
186
0
0
Not GSpot... MediaInfo. It is open source. An example using .NET is here. You are more interested in using the mediainfo library. If you are more comfortable with C++, port their example into C#.

The high level:
1. Extract from the metadata, the MP4 video codec string.
2. Enumerate the video codecs and check to see if it's libraries are available for you to use
3. Feed that MP4 into the proper decoder.
4. Choose frames to encode into a GIF.

This will not be a fun ride. I suggest just using a program to generate the animated GIF.

Hi Razel,
I am still a little confused with the metadata extraction aspect. I went to the site and not sure what exactly do I want to extract. Could you give some examples of the data that is available to extract. I am having a hard time understanding that and then that is leading me not able to do 2.