简体   繁体   中英

Getting the Count of Audio and video stream in a .MP4 files and its properties

I have to get the following information from the MP4 file

Count of video streams
Count of audio streams
For each video stream:
* language
* bitrate mode (fixed or variable)
* maximum bitrate
* length (seconds)
* stream size (megabytes)
* frame size
* framerate
* codec info
* codec profile
for each audio stream:
* language
* bitrate mode (fixed or variable)
* maximum bitrate
* length (seconds)
* stream size (megabytes)
* channels count
* codec info

This must be a completely managed and safe code, and it has to run on Windows Phone 7 (test it on Windows Phone 7).

Is anyone have any suggestion how we can do this.

Thanks Vijai

All of this information (and more) is available in the MP4 file format. If you have to do this programmatically you will probably need to parse the MP4 file but that's not too hard.

A description of the file format can be found here (OK That's Quicktime but it's pretty much exactly the same for your needs.)

You need to find a bunch of atoms and read values from them. Atoms (or boxes as they're sometimes called) are hierarchical with boxes containing other boxes.

To find the number of 'streams' you need the number of tracks - each track has a TRAK atom (atoms all have four character names) You can find this by looking at the tope level MOOV atom and counting how many TRAK atoms are inside it.

To find out what sort of track each is you need to look at

MOOV->TRAK->MDIA->HDLR atom and find the Component Subtype field of this which will be 'soun' for audio and 'vide' for video

Other atoms contain the other fields you're looking for - suggest a read through th linked document to figure it out.

That specific information can be obtained with FFMPEG. A consolea application. You could direct the output of FFMPEG to your application. But FFMPEG is probably not available on a Windows phone. I am not familiar with Windows phones.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM