Activity › Forums › Adobe After Effects Expressions › get MP3 metadata using XMP
-
get MP3 metadata using XMP
Posted by Adam Houghton on November 7, 2014 at 1:02 amHowdy,
I’d like to write a script to extract the artist, album, and song title from an mp3’s metadata as variables to be used as sourceText for some text layers. Any ideas?
Thanks!
Joseph Gomes replied 5 years, 5 months ago 3 Members · 3 Replies -
3 Replies
-
Dan Ebberts
November 7, 2014 at 4:09 amThis should get you started. It assumes that the mp3 has been imported into the project and is item 1 in the stack. I’m not sure about the namespaces (especially the first one), but it should give you the idea:
if( ! ExternalObject.AdobeXMPScript ) ExternalObject.AdobeXMPScript = new ExternalObject(“lib:AdobeXMPScript”);
var myFootageFile = app.project.item(1).file;
myFootageFile.open(“r”);
var fileData = new XMPFile(myFootageFile.fsName, XMPConst.FILE_UNKNOWN, XMPConst.OPEN_ONLY_XMP);
var xmp = fileData.getXMP();
var title = xmp.getProperty(XMPConst.NS_PDF, “Title”, XMPConst.STRING);
alert (title);
var artist = xmp.getProperty(XMPConst.NS_DM, “artist”, XMPConst.STRING);
alert (artist);
var album = xmp.getProperty(XMPConst.NS_DM, “album”, XMPConst.STRING);
alert (album);fileData.closeFile(0);
myFootageFile.close();Dan
-
Adam Houghton
November 7, 2014 at 5:05 pmThanks Dan! Your site and posts have been my go to resource for learning AE scripting. So cool to have you answer my question!
-
Joseph Gomes
May 5, 2021 at 3:05 ami know this thread is years old but its the closest ive come to this issue. i see that this seems to be the solution but i must be too new to AE because i dont know what to make of this. would you be willing to give a more step-by-step process on how to implement this?
for clarity, im looking to do something similar with audio file metadata. id like a text layer to change based on the title and artist metadata of a WAV file, as well as the album art if possible. that way, i dont have to manually change the text in the text layers, nor do i have to change the album art file. if its relevant, i use the “Replace Footage” function for the audio file, rather than importing a new file every time.
Reply to this Discussion! Login or Sign Up