Question

I am trying to use Taglib# to add id3v2 tags to a file. I have it working on some files - however, on certain files it will fail. (Possibly due to file corruption).

if (ext == ".aiff" || ext==".aif"){
     //force reading of aiff files
    file = TagLib.File.Create(filename, "audio/aiff",TagLib.ReadStyle.None);
}

The Create() call throws this exception: Provided data does not start with the file identifier

Based on the documentation, I'm not sure how I can fix this (or add a file identifier).

Was it helpful?

Solution

Not sure there was a way to do this. The solution was to run the files through FFMPEG and create new AIFF so that they would produce PROPER AIFF files. Then TagLib# works properly.

OTHER TIPS

Based on my own experiments, TagLib Sharp also throws exception on the Create() method "if" corresponding file has no ID3 tag at all. I just tested with some files, removed tags using TagLib Sharp, then tried the Create() method on the same file; same exception happened.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top