Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have an MP3 file and I would like to see the file's binary.

How can I do this (preferably on a Mac)?

share|improve this question
4  
Questions on Stack Exchange are generally expected to show evidence of own research effort. The first hit for me on Google searching for display file as binary is Display contents of file as binary on Stack Overflow. That question has a few possibilities as answers; do any of them do what you want, and if not, what is it that you want that is different? (For one, this answer appears to do exactly what you want, if you have Ruby available.) –  Michael Kjörling Sep 13 '13 at 19:19
2  
@MichaelKjörling in the OP's defense, I'm pretty sure ruby is not installed by default in OSX and it the answer in question will be scary to a non coder. Also consider that the OP is clearly not a coder and your google results depend on your own search history and you need to know what to search for, the OP did not even know that this is called 'binary'. –  terdon Sep 13 '13 at 19:35
1  
@terdon The original question title did use the word 'binary', so there must have been some familiarity with the term. I know Google hit ordering depends on the previous search history, which is why I said it was the top hit for me. I don't know what comes with a default OS X installation, but even so, the Ruby answer isn't the only one there and a simple "I found this, this, and this, but when I tried them all I got was the error message X" would have shown own effort to answer the question before asking (the "research effort" part of the question voting reasons). –  Michael Kjörling Sep 13 '13 at 19:40
    
@MichaelKjörling absolutely, the OP could definitely have done more research. I am just pointing out that said research would be harder for the OP than for you or me. Your basic complaint is absolutely valid. –  terdon Sep 13 '13 at 19:43
    
@terdon Ruby 1.8.7 is shipped with OS X, by the way. (Such is Python 2.7.2) –  slhck Sep 14 '13 at 9:28
add comment

1 Answer

You can use xxd for this. Open a terminal and do this:

xxd -b foo.mp3 

This will give you output like the following:

0000000: 01001001 01000100 00110011 00000100 00000000 00000000  ID3...
0000006: 00000000 00000001 00111011 01011001 01010100 01001001  ..;YTI

To get only the 1s and 0s and no spaces or extra information, do this:

xxd -b foo.mp3 | cut -d ' ' -f 2-8 | sed 's/ //g'
share|improve this answer
    
Plain and easy, also it comes by default! –  Braiam Sep 13 '13 at 19:52
    
Thanks for this but it not working. It say " xxd: Classique.MP3: No such file or directory ". In My folder the file name is Classique.MP3. So i paste " xxd -b Classique.MP3 | cut -d ' ' -f 2-8 | sed 's/ //g' " in terminal. Did i do something wrong –  Maxime Archambault Sep 13 '13 at 20:02
    
@MaximeArchambault yes, you need to navigate to the correct folder. For example, if you have Classique.MP3 in a folder called Musique that is in your home directory, you will need to use cd to go into that directory. Open the terminal, and type cd /Users/Maxime/Musique and then run the command. See here. –  terdon Sep 13 '13 at 20:36
    
@MaximeArchambault this really should work, feel free to ping me (post a comment here) and I can try and help you in he chatroom (même en français si tu veux). –  terdon Sep 14 '13 at 1:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.