Is it possible to find mpg file bitrate after opening the file in c?
EDIT: It has to do with video. not mp3. It is not clear whether it is 1,2 or 4 as of yet. Is the header standard different for each? I did find the mp3 article on wiki but I haven't fo开发者_如何学JAVAund mpeg 1,2,4 header structure information
Yes, it is part of the header, you didn't specify which type of mpg, so I'll go with MP3, but it's the same idea for all.
In wikipedia, you can see the file header structure, in this structure you can see the location of the bit rate (bytes 17-20). just read them.
It is possible to do it, but for that you need to know the specific header formats of the file type that you are trying to get data from.
If you don't have any limitations on the libraries to use, I would suggest you to use libavformat and libavcodec that are provided by the FFmpeg project.
Here are some tutorials if you want to try these libraries:
http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html
How to Write a Video Player in Less Than 1000 Lines
精彩评论