locked
Detecting a media file type RRS feed

  • Question

  • Hi All,

    I am downloading a file, which can either be AAC (".out") format or WMA format.  They don't have file extensions though.

    Can anyone suggest a reliable way of telling whether the media file is of type WMA, ACC or "something else"?

    Thanks

    Dave

    P.S.  Any suggestions of search terms would be helpful if you don't know.  Thanks!
    • Edited by BanksySan Tuesday, December 9, 2008 4:23 PM Typo "ACC" should be "AAC"
    Tuesday, December 9, 2008 3:36 PM

Answers

  • About the only way you'll be able to tell which type of file it is would be to open the file and read the first few bytes of it.  If you google "WMA File Format" and ACC file format" you should be able to find information about the file headers.  It may take some digging to find the information you'll looking for.

     

    • Proposed as answer by Harry Zhu Friday, December 12, 2008 7:50 AM
    • Marked as answer by Harry Zhu Tuesday, December 16, 2008 10:47 AM
    Tuesday, December 9, 2008 4:01 PM
  • Hi All,

    I've found the header for a WMA file: 3026 B275 8E66 CF11 A6D9 00AA 0062 CE6C

    I'm still looking for an AAC one though.  I think there may be more than one though (?)


    • Proposed as answer by Harry Zhu Friday, December 12, 2008 7:51 AM
    • Marked as answer by Harry Zhu Tuesday, December 16, 2008 10:47 AM
    Tuesday, December 9, 2008 4:26 PM
  • Check out this site, it seems to have a couple of good references for AAC.
    http://www.hydrogenaudio.org/forums/lofiversion/index.php/t3026.html

    You might want to put the headers in your config file so that if a new version of the format comes out and the header changes you can just add the new header to the config file instead of having to make changes to the code.  You could also make the application generic that way by specifying what extension to add to each header type.
    • Proposed as answer by Harry Zhu Friday, December 12, 2008 7:51 AM
    • Marked as answer by Harry Zhu Tuesday, December 16, 2008 10:47 AM
    Tuesday, December 9, 2008 5:38 PM
  • Check out this site also...
    http://websound.ru/libs_e.htm

    Specifically look at Audio Tools Library v2.3http://mac.sourceforge.net/atl/
     It seems like it deals with about every possible audio format so may be able to get some good info from it.

    It has libraries for working with different sound files so you could probably look thru them to findout how they identify the different formats.

    Curtis
    • Proposed as answer by Harry Zhu Friday, December 12, 2008 7:51 AM
    • Marked as answer by Harry Zhu Tuesday, December 16, 2008 10:47 AM
    Tuesday, December 9, 2008 6:54 PM

All replies

  • About the only way you'll be able to tell which type of file it is would be to open the file and read the first few bytes of it.  If you google "WMA File Format" and ACC file format" you should be able to find information about the file headers.  It may take some digging to find the information you'll looking for.

     

    • Proposed as answer by Harry Zhu Friday, December 12, 2008 7:50 AM
    • Marked as answer by Harry Zhu Tuesday, December 16, 2008 10:47 AM
    Tuesday, December 9, 2008 4:01 PM
  • Hi All,

    I've found the header for a WMA file: 3026 B275 8E66 CF11 A6D9 00AA 0062 CE6C

    I'm still looking for an AAC one though.  I think there may be more than one though (?)


    • Proposed as answer by Harry Zhu Friday, December 12, 2008 7:51 AM
    • Marked as answer by Harry Zhu Tuesday, December 16, 2008 10:47 AM
    Tuesday, December 9, 2008 4:26 PM
  • Check out this site, it seems to have a couple of good references for AAC.
    http://www.hydrogenaudio.org/forums/lofiversion/index.php/t3026.html

    You might want to put the headers in your config file so that if a new version of the format comes out and the header changes you can just add the new header to the config file instead of having to make changes to the code.  You could also make the application generic that way by specifying what extension to add to each header type.
    • Proposed as answer by Harry Zhu Friday, December 12, 2008 7:51 AM
    • Marked as answer by Harry Zhu Tuesday, December 16, 2008 10:47 AM
    Tuesday, December 9, 2008 5:38 PM
  • That's a good point, there's a good chance that this is going to expand in the future.

    I've been told that the problem with AAC is that it's not one format, it's a munging of several, making it harder.

    At the moment (for speed) I'm just saying that if the file isn't WMA then it is AAC (as there are only the two formats here right now), but I'm not happy about it.  My pride is nagging me!

    I'll have a read of that article.  Thanks for pointing it out.
    Tuesday, December 9, 2008 6:03 PM
  • Check out this site also...
    http://websound.ru/libs_e.htm

    Specifically look at Audio Tools Library v2.3http://mac.sourceforge.net/atl/
     It seems like it deals with about every possible audio format so may be able to get some good info from it.

    It has libraries for working with different sound files so you could probably look thru them to findout how they identify the different formats.

    Curtis
    • Proposed as answer by Harry Zhu Friday, December 12, 2008 7:51 AM
    • Marked as answer by Harry Zhu Tuesday, December 16, 2008 10:47 AM
    Tuesday, December 9, 2008 6:54 PM