adding pictures to mp3

Started by naholt, November 16, 2015, 10:47:54 AM

Previous topic - Next topic

naholt

i have a script that I have modified to do what I want.  I can do everything expect embed pictures. I would like to know how I go about doing this.  i have the image that I want in the same folder as the song.  here is the script.

  SoundFile = "C:\Users\ID34615s\Desktop\New folder\Time Passages.mp3"
    Cnt = 0
  :TOP
  Cnt = Cnt + 1
  oWMP = CreateObject("WMPlayer.OCX")
  colMediaCollection = oWMP.MediaCollection
  objSong = colMediaCollection.Add(SoundFile)
;##############################################################

;  Artist = objSong.GetItemInfo("Artist")
;message("", artist)
;  Title = StrCat(Num2Char(34), "Title", Num2Char(34), ", ",  objSong.GetItemInfo("Title"))
;  Album = StrCat(Num2Char(34), "Album", Num2Char(34), ", ", objSong.GetItemInfo("Album"))
;  Genre = StrCat(Num2Char(34), "Genre", Num2Char(34), ", ", objSong.GetItemInfo("WM/Genre"))
;  TrackNumber = StrCat(Num2Char(34), "WM/TrackNumber", Num2Char(34), ", ",  objSong.GetItemInfo("WM/TrackNumber"))
;  Year = StrCat(Num2Char(34), "WM/Year", Num2Char(34), ", ", objSong.GetItemInfo("WM/Year") )

objSong.SetItemInfo("Artist", "The Monkeys")
objSong.SetItemInfo("Title", "Seems like the first time")
objSong.SetItemInfo("Album", "Lets GO")
objSong.SetItemInfo("Genre", "Jazz")
objSong.SetItemInfo("WM/TrackNumber", 5)
objSong.SetItemInfo("WM/Year", 1855)

objSong = 0
colMediaCollection = 0
oWMP = 0 

If Cnt < 2 Then GOTO TOP

thanks
Nicholas

td

Hard to say.  Presumably you have tried setting 'albumart' with 'SetItemInfo' to no avail.  A quick check of the object model with the WIL Type Viewer wasn't promising.  There seems to be properties and methods for controling how album art is displayed but didn't see anything that looked like a method or property that added art to the mp3 file.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

naholt

no I have not, it was not on the list of attributes. I will try it and let you know.

thank you
Nicholas

naholt

I tried it and it failed.  I don't think it can be done.  rats!!! oh well

thank you very much
Nicholas

ChuckC

IIRC, no, you can't embed the artwork in the media file [mp3].  That is an association made within the Media Player application and its corresponding media database, where it maintains its own meta data about an album, the songs that are on the album, and what the cover art is for the album.  If you look into iTunes, and its database [it's a huge XML file], you'll see the same sort of thing being done.

td

Good point.  I thought embedding directly in the file was not possible too but a couple of Websites seemed to suggest otherwise.  However, none offered an automated technique for doing so and, as we all known, you should not believe everything you read on the Internet...
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

....IFICantBYTE

Umm... embedding a picture is definitely supported (usually a jpeg/jfif but can support png) OR a link to a picture file.
The frame (APIC) to support it in the metadata of an MP3 (ID3vx) has been around a long time, but obviously it is up to the application using/making the audio files as to how it is used.
You should be able to find a free open source DLL, COM .Net or ActiveX library that you can use via WinBatch to read and write the APIC frame data.

See the following links for more info...
http://id3.org/ID3v2Easy
http://www.richardfarrar.com/embedding-album-art-in-mp3-files/
http://www.codeproject.com/Articles/17890/Do-Anything-With-ID


Regards,
....IFICantBYTE

Nothing sucks more than that moment during an argument when you realize you're wrong. :)

td

You could even perform the embedding with straight WIL binary buffer functions,  if you have the time and skill.   The OP was working with Windows Media Player's COM Automation objects and those interfaces seems to be lacking any members that will perform the task.  If the OP does choose to branch out beyond WMP, I am sure he will appreciate the information you provided.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

ChuckC

If the Windows Explorer allows you to do it when looking at the "Details" property page, then the Property Store extender that I wrote would also be able to do it, as it uses the same underlying mechanism [the Windows Property Store] that the Explorer shell uses.

td

Can't say that I have ever seen an Album Art property in the shell's property page for mp3 files but that doesn't necessarily mean there isn't one either.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade