Automating Adding iTunes Album Art to MP3 ID3 tags from the Command Line in C#
It's been bugging me that the album art for my podcast doesn't appear in Windows Media Player, iTunes, or in iPods.
I assumed, incorrectly, that this was an iTunes meta-tagging problem, but then I realized that this was an MP3 problem, not an AAC or WMA problem, although both formats support adding art to the file.
The ID3 format is pretty extensive. You can put a great deal of meta-information into an MP3. The Attached picture or APIC "Frame" in ID lets you embed in PNGs or JPGs, along with their respective mime/types.
I googled around over lunch and couldn't find a simple, free, command-line program that would let me easily add pictures to not only the existing MP3s for our show on the server-side, but also could be integrated into our existing audio file production workflow.
I ended up finding this great little library from 2004 called the tagnetlib project source was offered for free from the Nancy Street Blog. I converted it to .NET 2.0.
Now, note that the tagnetlib project is currently deprecated in lieu of the NTag product that Greg Keogh started in 2005 and released in May of 2006. The NTag project is much more interesting and appears to be well thought-out. He intends to support WMA and OGG and turn the project info a "Meta Tag Tagging" project that would support all popular audio formats.
I used the Tagnetlib because it was quick, incredibly easy, and I only had my lunch hour to do this. However, he's pretty clear that Tagnetlib is, again, totally deprecated and unsupported. Perhaps one day I'll get to spend more time with the NTag library. For now, my little hack is used like this:
embedid3.exe file.mp3 file.jpg [optionally "mime/type", default is "image/jpeg"]
Disclaimer: This app does one thing. It adds images to MP3 files that don't have them. It has no error handling or checking and it doesn't care about you or your MP3 collection. Don't even think about running it over your collection or using it for any purpose. It's useful for one thing. It's useful to me. Your Mileage WILL Vary. You have been warned.
Do make sure you checkout NTag and what Greg's working on over there. It's really pretty fun code to read.
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
http://www.mediamonkey.com/
Like you, I was annoyed that some of my MP3s were missing their album artwork, and also like you, I'm a PowerShell fan. I started writing my own ID3 library a while a go but gave up when I found the Ultra ID3 library. This combined with a custom-written UltraID3.Format.ps1xml, and some handy aliases made the whole process of manipulating ID3 info (not just artwork) much easier.
http://home.fuse.net/honnert/hundred/UltraID3Lib/
TTFN,
Damian.
Comments are closed.