Open Ed1ks opened 2 months ago
Hi Ed1ks, sorry it's taken me so long to get back to you.
It sounds like you're trying to get TLAN, TDOR, TDRC, and WOAR frames from m4a, mp4, etc, files? MPEG4 files use a very different format for tagging data compared to ID3v2. The wiki includes a table showing what file formats support what types of tagging formats (https://github.com/benrr101/node-taglib-sharp/wiki/02-Tagging-Support). In the case of MPEG4, it uses Apple/Quicktime tagging format (https://github.com/benrr101/node-taglib-sharp/blob/master/docs/classes/Mpeg4AppleTag.md). So, basically you won't be able to get an ID3v2 tag (or those frames) from an MPEG4 file.
You can still write the data you want to the Apple/Quicktime tag, though. However, the structure of these tags are more complex and there isn't a great consensus on how to store different fields. Even within the AppleTag class there's two different mechanisms for storing: iTunes and Quicktime. Foobar2000 uses this set of mappings for fields: https://wiki.hydrogenaud.io/?title=Tag_Mapping
Let's look at a couple examples. Foobar uses the WOAR
ID3v2 frame and ©prl
MPEG4 box for "track artist webpage URL". We can get this one as follows:
// ID3v2
var id3v2Value = id3v2Tag.getTextAsString(FrameIdentifiers.WOAR)
// MPEG4
var boxType = ByteVector.fromString("©prl", StringType.Latin1);
var mpeg4Value = appleTag.getFirstQuickTimeData(boxType);
Foobar maps language to the TLAN
ID3v2 frame and ----:com.apple.iTunes:LANGUAGE
MPEG4 box. This one is a bit different, since it defines a tree of boxes to traverse. Since this follows a standard pattern for itunes, node-taglib-sharp makes it just as easy:
// ID3v2
var id3v2value = id3v2Tag.getTagAsString(FrameIdentifiers.TLAN);
// MPEG4
var mpeg4Value = appleTag.getFirstItunesString("com.apple.iTunes", "LANGUAGE");
Hopefully that gets you moving in the right direction.
One last thing to note, files may not always have ID3v2 tags. At a minimum, make sure to check for falsy values from getTag
. Better yet, switch based on whether the file contains a type of tag by checking File.tagTypes
Hello, I am missing some tags and I startet with id3v2 to find a way to retrieve those. It looks like this and works:
but I dont know how to write those and how to get those tags from m4a, mp4 and other formats. I cant find any related information in docs.
I would appreciate any help.