WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: naholt on November 16, 2015, 10:47:54 AM

Title: adding pictures to mp3
Post by: naholt on November 16, 2015, 10:47:54 AM
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
Title: Re: adding pictures to mp3
Post by: td on November 16, 2015, 01:22:04 PM
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.
Title: Re: adding pictures to mp3
Post by: naholt on November 17, 2015, 05:26:01 AM
no I have not, it was not on the list of attributes. I will try it and let you know.

thank you
Nicholas
Title: Re: adding pictures to mp3
Post by: naholt on November 17, 2015, 12:06:22 PM
I tried it and it failed.  I don't think it can be done.  rats!!! oh well

thank you very much
Nicholas
Title: Re: adding pictures to mp3
Post by: ChuckC on November 19, 2015, 05:57:39 AM
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.
Title: Re: adding pictures to mp3
Post by: td on November 19, 2015, 07:19:41 AM
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...
Title: Re: adding pictures to mp3
Post by: ....IFICantBYTE on November 19, 2015, 02:43:34 PM
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


Title: Re: adding pictures to mp3
Post by: td on November 20, 2015, 08:16:21 AM
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.
Title: Re: adding pictures to mp3
Post by: ChuckC on November 22, 2015, 03:20:34 PM
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.
Title: Re: adding pictures to mp3
Post by: td on November 23, 2015, 06:48:08 AM
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.