Open 112RG opened 1 year ago
If you don't need playback, then I'd recommend using the lofty
crate instead of Symphonia since it's more comprehensive and simpler. Symphonia's metadata system is more complex because it has to deal with mid-stream changes to metadata.
Once you have a FormatReader
, call the FormatReader::metadata
function to get access to the metadata log. This is basically of a queue of MetadataRevisions
with functions to iterate over and consume the revisions. Each MetadataRevision
provides access to Tag
s, and Visual
s (pictures). Looping through those slices will get you what you are looking for. My recommendation is to use the standard tag and visual key fields to match tags to your data structure.
One thing to note is that metadata can also be found while probing the file. This famously happens with ID3v2 tags since those are just binary blobs at the start of the file. The ProbeResult
returned after the probe operation also returns a metadata log that should be consumed in the same way.
It's up to the application to decide how to interpret these revisions (i.e., whether one replaces another completely, or simply updates an older revision).
I will be using playback my project https://github.com/Ortygia/Deaftone is a music server. But I am still looking for a fast tag scanner solution metaflac is currently the fastest and from this discussion here https://github.com/Deaftone/Deaftone/issues/8#issuecomment-1376746887 metaflac is beating out lofty-rs on my testing. So I wanted to test out Symphonia as I am looking to squeeze the most performance possible out of it
If you don't need playback, then I'd recommend using the
lofty
crate instead of Symphonia since it's more comprehensive and simpler. Symphonia's metadata system is more complex because it has to deal with mid-stream changes to metadata.Once you have a
FormatReader
, call theFormatReader::metadata
function to get access to the metadata log. This is basically of a queue ofMetadataRevisions
with functions to iterate over and consume the revisions. EachMetadataRevision
provides access toTag
s, andVisual
s (pictures). Looping through those slices will get you what you are looking for. My recommendation is to use the standard tag and visual key fields to match tags to your data structure.One thing to note is that metadata can also be found while probing the file. This famously happens with ID3v2 tags since those are just binary blobs at the start of the file. The
ProbeResult
returned after the probe operation also returns a metadata log that should be consumed in the same way.It's up to the application to decide how to interpret these revisions (i.e., whether one replaces another completely, or simply updates an older revision).
What about video metadata, is there a comprehensive and simpler crate? I just want to get video metadata
I am currently using metaflac in my project Deaftone. I am wanting to try out Symphonia to map tags from files into a struct I have but I am unsure how todo that with the examples and docs given.
In metaflac I simply
But I am unsure how todo that with the library currently. Here is my struct defined below