Code Monkey home page Code Monkey logo

taglib-sharp's Introduction

TagLib#

Join the chat at https://gitter.im/mono/taglib-sharp

(aka Taglib-sharp) is a .NET platform-independent library (tested on Windows/Linux) for reading and writing metadata in media files, including video, audio, and photo formats. This is a convenient one-stop-shop to present or tag all your media collection, regardless of which format/container these might use. You can read/write the standard or more common tags/properties of a media, or you can also create and retrieve your own custom tags.

It supports the following formats (by file-extensions):

  • Video: mkv, ogv, avi, wmv, asf, mp4 (m4p, m4v), mpeg (mpg, mpe, mpv, mpg, m2v)
  • Audio: aa, aax, aac, aiff, ape, dsf, flac, m4a, m4b, m4p, mp3, mpc, mpp, ogg, oga, wav, wma, wv, webm
  • Images: bmp, gif, jpeg, pbm, pgm, ppm, pnm, pcx, png, tiff, dng, svg

It is API stable, with only API additions (not changes or removals) occuring in the 2.0 series.

Examples

Read/write metadata from a video

var tfile = TagLib.File.Create(@"C:\My video.avi");
string title = tfile.Tag.Title;
TimeSpan duration = tfile.Properties.Duration;
Console.WriteLine("Title: {0}, duration: {1}", title, duration);

// change title in the file
tfile.Tag.Title = "my new title";
tfile.Save();

Read/write metadata from a Audio file

var tfile = TagLib.File.Create(@"C:\My audio.mp3");
string title = tfile.Tag.Title;
TimeSpan duration = tfile.Properties.Duration;
Console.WriteLine("Title: {0}, duration: {1}", title, duration);

// change title in the file
tfile.Tag.Title = "my new title";
tfile.Save();

Read/write metadata from an Image

var tfile = TagLib.File.Create(@"C:\My picture.jpg");
string title = tfile.Tag.Title;
var tag =  tfile.Tag as TagLib.Image.CombinedImageTag;
DateTime? snapshot = tag.DateTime;
Console.WriteLine("Title: {0}, snapshot taken on {1}", title, snapshot);

// change title in the file
tfile.Tag.Title = "my new title";
tfile.Save();

Read/write custom tags from a specific format

var tfile = TagLib.File.Create(@"C:\My song.flac");
var custom = (TagLib.Ogg.XiphComment) tfile.GetTag(TagLib.TagTypes.Xiph);

// Read
string [] myfields = custom.GetField("MY_TAG");
Console.WriteLine("First MY_TAG entry: {0}", myfields[0]);

// Write
custom.SetField("MY_TAG", new string[] { "value1", "value2" });
custom.RemoveField("OTHER_FIELD");
rgFile.Save();

Website

TagLib# is available on GitHub: https://github.com/mono/taglib-sharp

  • Bugs: Create an issue
  • Chat: Join us at Gitter
  • Git: Get the source at git://github.com/mono/taglib-sharp.git

Installation From NuGet

TagLib# is available on NuGet: https://www.nuget.org/packages/TagLibSharp

Install from package manager:

PM> Install-Package TagLibSharp -Version 2.3.0

Building and Running

Command Line

To Build From Git:

git clone https://github.com/mono/taglib-sharp.git
cd taglib-sharp
dotnet build

To Test:

dotnet test

Build in IDE (Visual Studio, Visual Studio for Mac, Rider, etc):

You can open it in Visual Studio by using TaglibSharp.sln

Running regression by using Nunit 3 Test Adapter:

  1. Ensure NuGet packages have been restored
    1. See: https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore
  2. In Visual Studio, go to menu: Tools > Extensions and Updates > Online (In Visual Studio 2019, use Extensions > Manage Extensions)
  3. Search: Nunit 3 Test Adapter
  4. Download and install it
  5. Open from menu: Test > Windows > Test Explorer (In Visual Studio 2019, use Test > Test Explorer)
  6. You can run your tests from this panel (not using the "Start" button)
  7. You can debug your tests from this panel:
    1. Double click on a test. Set some breakpoints in the test in the editor panel.
    2. right-click on the same test, select "Debug Selected tests".

To test some scenarios and take advantage of the debugger:

  1. Make the "debug" project the Startup project (Right-click on the project, select: "Set as StartUp Project")
  2. Just modify the "Program.cs"
  3. Set some breakpoints and hit the "Start" button

They also use TagLib#

Non exhaustive list of projects that use TagLib#:

And you, what do you use TagLib# for? Reply here

Contributions

TagLib# is free/open source software, released under the LGPL. We welcome contributions! Please try to match our coding style, and include unit tests with any patches. Patches can be submitted by issuing a Pull Request (Git).

taglib-sharp's People

Contributors

abock avatar alanmcgovern avatar alexkay avatar alixinne avatar benrr101 avatar bnickel avatar bricas avatar codingdave avatar decriptor avatar eamonnerbonne avatar eatonz avatar ermshiperete avatar futuretim avatar gburt avatar hwahrmann avatar jmoutte avatar karamanolev avatar knocte avatar mrcsharp22 avatar palango avatar platoniusiii avatar romasz avatar rubenv avatar starwer avatar stephanedelcroix avatar superusercode avatar ta264 avatar therzok avatar tigger avatar zductiv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

taglib-sharp's Issues

Enumerating custom tags

I'm having some trouble getting to the raw list of tags for a given file (for example, a FLAC file). I can find all of the named properties, but not the custom tags. Before I clone and start exposing private members to work around my issue, I wanted to reach out to see if anyone had examples of how to do this this the library as is. Specifically, I'd like to do something like this:

var files = Directory.EnumerateFiles(Samples,"*.*",SearchOption.AllDirectories);
foreach (var fname in files)
{
    var rfile = TagLib.File.Create(fpath);
    foreach (var tagInfo in vfile.?????)
    { 
    //Enumerate tag key/value pairs
    }
}

Update: Nevermind. I found something close enough by casting to a XiphComment.

However, I think having a generic Tags collection on the File class (implement by the concrete subclasses) that can be accessed as a key/value pair set would be helpful. The challenge now is the code must understand exactly what kind of file it's dealing with to read/write tags by name.

Any thoughts on this?

RFC: New Tag property

[edit: I've fixed a few definition and added better examples]
TagLibSharp deeply inherits from TagLib, which was initially targeting MP3 ID3 tags only. This legacy is visible in the choice of properties names/selection available in the base Tag class of TagLibSharp. Actually, with the addition of more Tag-formats and especially the support of Videos, I have the impression we should precise and extend the set of available Tag properties to handle the Videos better. Of course, these addition should also benefit to the audio counterpart.

Examples: [Back to the Future 2 / Game of Thrones Season 1, episode 9]

  • Redefinitions: The following properties have names from the audio world. How should it map to the videos ?:

    • Album: Collection [Back to the Future / Game of Thrones]
    • Disc: Season or sequel number [2 / 1]
    • DiscCount: number of Seasons or sequels [3 / 7]
    • Track: Episode number in the season (0 for sequel) [0 / 10]
    • TrackCount: Number of episodes in the season (0 for sequel) [0 / 10]
  • Additions: these properties are missing to properly support videos:

    • Subtitle: short description, tagline of the Video/music [It's About Time | Winter is coming].
    • Description: description or summary plot, but not a spoiler (doesn't say the outcome) [After visiting 2015, Marty McFly must repeat his visit to 1955 to prevent disastrous changes to 1985...without interfering with his first trip / The Stark army arrives at the Twins castle; and Catelyn convinces Lord Frey to let them pass and assist them by agreeing for marriage of Robb and Arya to Frey's children in the future...]
    • PerformersRole: list of Charaters for Video, Instruments played for music. This should match the Performers list (for each name correspond one role). Several roles for the same artist/actor can be put with semicolons [Marty McFly; Marty McFly Jr. ; Marlene McFly / Lord Frey].
    • Date Taged: inserted automatically by TagLib#
    • Language: If Tag format support multiple language, define the prefer language to be retrieved.

Any thought on that ?

What should be the minimum .NET Framework version

The thought is to move this to .NET Standard 2.0 which I think would be great. The downside (potentially?) is that I believe this would essentially push our minimum .NET Framework version. In this case I think it'd be 4.6.1 which is C# 6. (https://blogs.msdn.microsoft.com/dotnet/2017/08/14/announcing-net-standard-2-0/).

While I think it'd be great to use a lot of the newer c# 6 features and potentially remove our code in favor of framework code I worry about anyone that is using an older version of the .net framework. So, I'm posting this to get feedback :)

Is TagLib-Sharp dead ?

Looking at #40, it seems like the owner (Decriptor?) has no time anymore to spend on TagLib-sharp.

I'm really ready to contribute. This project is great, and my own project would really benefit from this Library. But its support to videos format is too limited for my use. If I could extend it, it would benefit to the community, not only my own project.
But before I start, I want to make sure I'm not redirecting my free time into > /dev/null

Is there anyone still owning/supporting this project ?

recursive loop and heap crash in Duration method

inside file taglib-sharp-master\src\TagLib\Properties.cs

Method: (row 151)

source:
public TimeSpan Duration {
get {
TimeSpan duration = this.duration;

			if (duration != TimeSpan.Zero)
				return duration;
			
			foreach (ICodec codec in codecs)
				if (codec != null &&
					codec.Duration > duration)
					duration = codec.Duration;
			
			return duration;
		}
	}

changed as below to fix a case where duration is equal zero

public TimeSpan Duration {
get {
TimeSpan duration = this.duration;

			if (duration != TimeSpan.Zero)
				return duration;

			**if (duration == TimeSpan.Zero)
				return duration;****
			
			foreach (ICodec codec in codecs)
				if (codec != null &&
					codec.Duration > duration)
					duration = codec.Duration;
			
			return duration;
		}
	}

Cannot build in Arch Linux

Compiler dies at:

TagLib# (taglib-sharp-2.1.0.0) is ready to be compiled.
Now type `make' to compile
Making all in src
make[1]: Entering directory '/home/nikos/Public/taglib-sharp-git/src/taglib-sharp/src'
make[1]: *** No rule to make target 'AssemblyInfo.cs', needed by 'taglib-sharp.dll'.  Stop.
make[1]: Leaving directory '/home/nikos/Public/taglib-sharp-git/src/taglib-sharp/src'
make: *** [Makefile:430: all-recursive] Error 1

Request: Rename classes to allow import of multiple namespaces without ambiguous symbols

(I searched previous Issues in GitHub to see if anyone raised this point, I couldn't see anything)

(I'm aware the docs say the v2.0 API is stable, so this is a proposal for version 3)

I used TagLib-Sharp to write my utility program TeslaTags - thank you for this library!, but while using the library I experienced a number of ergonomic issues with TagLib, such as how class names are reused in child namespaces when they're used to represent subclasses, which shouldn't be done because it means we need to use C# in a non-idiomatic way - such as aliasing types (using MpegFile = TagLib.Mpeg.File) or using Go-style package/namespace prefixes (e.g. using mpeg = TagLib.Mpeg; .. mpeg.AudioFile mp3 = mpeg.AudioFile.Create(...).

Another issue is a conflict with System.IO that frequently occurrs because TagLib is invariably used to work with files and some of the type-names conflict (namely all of the File classes in TagLib, I can't use it "naked" in the same context as System.IO.File) so I end up needing to alias or prefix everything - the result is that my code isn't as readable as it should be.

I'd like to propose the following changes:

  • Rename TagLib.File to TaggedFile, to avoid conflicting with System.IO.File.
  • In each codec/format-specific namespace (e.g. TagLib.Aac, TagLib.Mpeg prefix their File subclass with the codec/format name. So TagLib.Tiff.File becomes TagLib.Tiff.TiffFile.
  • The inheritance heirarchy should be exposed through the class' name where it makes sense. Right now it's looking bad using the TIFF code as an example, as we have TagLib.Tiff.File < TagLib.Tiff.BaseTiffFile < TagLib.Image.File < TagLib.File - that's 3 types all named File!
    • I'd rename them TiffImageFile, BaseTiffImageFile, ImageFile and TaggedFile respectively. Using these names makes their relationship much easier to understand.
  • If a namespace only has a few types in it combine them in a type-specific namespace.
    • For example, TagLib.Tiff's types could be put into the TagLib.Image namespace.
  • Less important: but I wonder if file format namespaces should be grouped under a new namespace TagLib.Formats.* as a parent because it's unclear by sight if a namespace refers to a specific format or something else, for example I initially thought that TagLib.Audible.File was a superclass for all "audible" (audio) formats and not Audible.com's own format.
  • Similar to File, the specialised subclasses of TagLib.Tag (e.g. TagLib.Id3v2.Tag) should also be prefixed named, e.g. Id3v2Tag instead).

I'm happy to do this myself if you're willing to accept a PR for it.

I'm sure there's other convention/idiom issues that FxCop/Code-Analysis would pick up that that I'd throw into my changes too.

Duration vs data block length mismatch

TagLib does not do a good job of detecting audio where the file or audio chunk is truncated. There are often times where the header contains a value such as 90 seconds but when you play the audio there is only 10 seconds.

Initially I thought that there was no way to really detect this kind of mismatch using TagLib however I remembered I had a piece of code saved in LINQPad from CodeProject containing another way to validate RIFF headers. That code checks to make sure that the stream/byte length should be greater than or equal to the invariant end position taken from the header adding 8 to account for the header offset.

I implemented this in my own code by adding the following after the File.Create(...) method was called:

long minimumFileSize = file.InvariantEndPosition + 8;

if (stream.Length < minimumFileSize)
{
    throw new Exception($"Truncated file detected.  Expected a file size of at least \"{minimumFileSize/1024} KB\" but received \"{stream.Length} KB\".");
}

I am not familiar enough with the source code of this repo to know where the best place would be to add this kind of check so please feel free to add this check where it should go.

MP3 File with broken headers create a Stack Overflow

File:
https://ufile.io/kmh8g

Problem:

AudioHeader.cs

else if (AudioFrameLength > 0 && AudioBitrate > 0 ) {

When the headers is broken, it tries to calculate AudioBitrate, but AudioBitrate itself is calculated via Duration (line 349), so on this file we created an loop of calls to AudioBitrate > Duration > AudioBitrate until Stack Overflow error and the whole app crashed..

Asf DescriptionRecord incorrectly parses and renders Bool values as 4 bytes

The ASF Specification (Revision 01.20.05 June 2010) states that BOOL values are 2 bytes long (WORD). The library is reading and writing them as DWORD.

Value type Description
0x0000 Unicode string. The data consists of a sequence of Unicode characters.
0x0001 BYTE array. The type of the data is implementation-specific.
0x0002 BOOL. The data is 2 bytes long and should be interpreted as a 16-bit unsigned
integer. Only 0x0000 or 0x0001 are permitted values.

0x0003 DWORD. The data is 4 bytes long and should be interpreted as a 32-bit unsigned
integer.
0x0004 QWORD. The data is 8 bytes long and should be interpreted as a 64-bit unsigned

TagLib.File.Create() hangs because of the uint overflow

Please check the file "taglib-sharp/src/TagLib/Riff/File.cs" (line 624, File.Read() function).

It has a loop of reading the file. The loop depends on 3 variables:

 long position = 12;
 long length = Length;
 uint size = 0;

The loop condition is the following:
while ((position += 8 + size) + 8 < length);

For a particular WAV file where on the last part size is 4294967288, and 8 + size overflows and gives 0 in the result, so the loop is going to infinite.

The solution is to convert 8 to long before summing by adding the L:
while ((position += 8L + size) + 8 < length);

That's it.

MP4 Tag wrong format

When adding a Tag (DashBox) the AppleAdditionalInfoBox has not the correct format, it looks like there are some 0 padding missing betwean BoxType & data

Ex (Wrong) (missing four 00 padding): meancom.apple.iTunes
Ex (Correct) (has four 00 padding): mean com.apple.iTunes

Easy add tag and open with VLC and you will see part of tagname.

Is this a known issue?

WAV File Chunk Handling ?PMX

I've been spending quite a bit of time lately working on the WAV handling code and it's fair to say that I've found a lot of issues. There are many, many things throwing it off reading the RIFF files accurately.

Currently I'm looking at issues with the _PMX chunk which is a variant of the XMPTag from Adobe for audio files. As soon as TagLib~ encounters one of these the stream reading is out of sync with the other chunks.

I'm working from 100% correctly formatted test files I've sourced from a ARSC TECHNICAL COMMITTEE study on the state of meta data reading/writing. The files were encoded using BWF MetaEdit so I'm 100% confident these files adhere to all the published specs. As they were created in order to quantify the state of meta data editing across a number of professional grade audio applications.

Reading the study is a bit eye watering. It's incredible how many multi-million selling audio application are getting some things so very wrong when it comes to meta data. You can read the published study here:

http://www.arsc-audio.org/pdf/ARSC_TC_MD_Study.pdf

And the test file from the study I'm using is here:

http://www.avpreserve.com/wp-content/uploads/2011/10/ARSC_BWF_Metadata_Test1.zip

Anyway. I'm wrorking my way through these issues to ensure taglib# isn't causing issues. It's fair to say that from the complete lack of .wav test files in the tests directory that wav/RIFF files have seen little love.

If anyone has some time to pump this through a test to see if they can shed some light on the situation it would be much appreciated.

The issue is when the Read method gets to _PMX the next fourcc is a few bytes out and so every chunk past this point is missed. The size of the chunk seems to be reported correctly. The next chunk in the file is an aXML chunk but the fourcc that gets read is "\0axm", from there all the processing is broken.

Strangely if I execute

postion = postion + 1

After reading the _PMX and iXML chunks everything is back in sync and it happily reads the remaining chunks. Is this a known foible of XML embeded in WAV files?

Reading the _PMX as a normal XMP tag works flawlessly in this Test Wav file so I don't think thats an issue.

Seeing as there is this issue at the moment executing a save destroys the resulting file and BWF MetaEdit reports truncations padding errors.

If anyone does have the time to look at this the code, test cases and test files are in my fork here:

https://github.com/jamsoft/taglib-sharp

How to access the tag "Tags" on mp4 files?

I'm trying to modify the tag named "Tags" on mp4 files but no success, I was able to access and modify the tag Title and Comments but no Tags, Ratings nor Subtitles..
Thanks in advance.

edit: I'm dealing with .mp4 and .jpg files.

Adding new LIST-INFO chunk corrupts file

This is more of a question than an issue.

I'm currently looking at the InfoTag for WAV files. Opening a file with an existing LIST-INFO chunk, editing the values and saving the file works fine. No issues.

I can open the saved file in BWF MetaEdit / RIFFPad and see the changes. I can also re-open the edited file and see the values without issue.

Doing the same with a file that didn't originally have a LIST-INFO chunk seems to monumentally fail.

BWF MetaEdit regards the saved file as corrupt and RIFFPad cannot even see the LIST-INFO chunk. Whereas in a binary editor I can see the data but it's appended to the end of the file and something is clearly wrong with the binary data.

I'm still trying to figure out what is wrong with the saved file and not having much luck.

Anyone got any info on this situation?

Possible regressions

Hi,

I was using taglib-sharp with f-spot some years ago and usually all my jpgs were imported flawlessly. Now I am running the latest f-spot github revision (it runs taglib-sharp as a git submodule) and the import of some images is failing. The first one I present here for analyzing the error was definitively understood by earlier versions of taglib-sharp (included with f-spot).

e9db5d80-029f-11e6-8b9e-2f431bf54715

In f-spot/f-spot#69 @cizma poited out that the meta information is invalid:

exiftool -a e9db5d80-029f-11e6-8b9e-2f431bf54715.JPG | grep -i warning
Warning : [minor] Bad format (65499) for PreviewIFD entry 5
Warning : [minor] Bad format (514) for PreviewIFD entry 6
Warning : [minor] Bad format (1028) for PreviewIFD entry 7
Warning : [minor] Bad format (2314) for PreviewIFD entry 8
Warning : [minor] Bad format (772) for PreviewIFD entry 9
Warning : [minor] Bad format (289) for PreviewIFD entry 10
Warning : [minor] Bad format (41472) for PreviewIFD entry 11
Warning : [minor] Bad format (1543) for PreviewIFD entry 13
Warning : [minor] Bad format (516) for PreviewIFD entry 14
Warning : [minor] Bad format (515) for PreviewIFD entry 15
Warning : [minor] Bad format (20833) for PreviewIFD entry 16
Warning : [Minor] Too many warnings -- PreviewIFD parsing aborted

as per request I'd like to also inform @decriptor about this case.

Thank you in advance,
Dave

Fehlermeldung beim nutzen in App

Hallo,
ich will eine UWP App programmieren in der ich die Metadaten von Musikdateien auslesen. Ich habe taglip eingebunden und in einem normalen Programm funktioniert der Code auch aber in der App nicht.
Hier der Code, der Fehler tritt "Dim Musikdatei As TagLib.File = TagLib.File.Create(Datei.Path)" hier auf.
Dim folder As StorageFolder
Private Async Sub menuItem_Open_Explorer()
Dim ordnerAuswählen = New Pickers.FolderPicker()
ordnerAuswählen.SuggestedStartLocation = Pickers.PickerLocationId.Desktop
ordnerAuswählen.FileTypeFilter.Add("*")
folder = Await ordnerAuswählen.PickSingleFolderAsync()
txtOrdner.Text = folder.Path
End Sub

Private Async Sub Button_Click(sender As Object, e As RoutedEventArgs)
Dim titel, Interpret, Jahr As String
Dim Dateienliste As IReadOnlyList(Of StorageFile)
Dateienliste = Await folder.CreateFileQuery(1).GetFilesAsync()

For Each Datei As StorageFile In Dateienliste
   ##  **Dim Musikdatei As TagLib.File = TagLib.File.Create(Datei.Path)**
    titel = Musikdatei.Tag.Track

    lblDateien.Items.Add(Datei.Name)
Next

End Sub
End Class
Es kommt folgende Fehlermeldung:
Eine Ausnahme vom Typ "System.UnauthorizedAccessException" ist in taglib-sharp.dll aufgetreten, doch wurde diese im Benutzercode nicht verarbeitet.
Gibt es hierfür eine Lösung? Oder kann man die Bibliothek nicht in Apps nutzen?

Supporting BEXT / iXML Data

I've recently found this library after fighting with my own custom Riff parsers and would be really interested in getting stuck into helping extend the library. The major features missing for me at the moment are reading these BEXT (Broadcast Wave Data - https://en.wikipedia.org/wiki/Broadcast_Wave_Format) and the standard iXML data (http://www.gallery.co.uk/ixml/).

As I'm still feeling my way around this library and the source code where would be a good place to start to add this? I understand this is quite a big ask and not really an "issue" as such but this is the best place to request/document this. Thanks.

Adding tag of type IPTCIIM not supported!

Hello,

I am currently working on a C# application where I want to enable editing of some specific image metadata. Basically, I am using the following code which serves as an example for my problem:

file = TagLib.File.Create(filePath);
var image = file as TagLib.Image.File;
image.ImageTag.Comment = "Custom comment";
image.EnsureAvailableTags();
image.Save();

Whenever the comment field (or keywords field) is not part of the image metadata, a System.NotImplementedException is raised with "Adding tag of type IPTCIIM not supported!" for image.EnsureAvailableTags(). I checked your code and found that TagLib-Sharp hasn't anything implemented to deal with IPTCIIM as far as I know. I also found a pull request regarding IPTCIIM which is more or less not commented #21.

Now the question remains: did I misused the library/will the feature be supported or how to best enable/contribute this feature? If not, can you recommend any other software in C# which can handle my problem safely for writing metadata to an image?

Versuche taglib 2.1 per nuget einzufürgen ubd bekomme folgende Fehlermeldung

Hallo,

ich bekomme folgende Fehelrmeldung wenn ich Versuche per Nuget die taglib einzubinden
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Install-Package : taglib 2.1.0 is not compatible with UAP,Version=v10.0.
In Zeile:1 Zeichen:1

  • Install-Package taglib
  •   + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
      + FullyQualifiedError
    

'''''''''''''''''''''''''''''''''''''''''''''''''''''''
bekomme noch viele weitere Fehler aber denke die Hängen alle zusammen. Kann es sein, dass man die Bibliothek nicht in UWPs verwenden kann?

Multiple genre's is not being handled correctly

I've tested this with several 3rd party tools: mp3tag, MP4 Tag Library, etc...

It appears that when the library is saving multi genre's it save them as a semicolon delimited string.
This string is being read as a single string in other applications, rather than a list of Genre's.

Additionally when multiple genre tags are added to a file by other applications, the library doesn't read them and return an empty list.

Make does not sign taglib-sharp.dll

Resulting, after a clean and error-less make, to not being able to install the dll in the global assembly

Making install in src
make[1]: Entering directory '/home/nikos/taglib-sharp-git/src/taglib-sharp/src'
make[2]: Entering directory '/home/nikos/taglib-sharp-git/src/taglib-sharp/src'
make[2]: Nothing to be done for 'install-exec-am'.
/usr/bin/gacutil /i taglib-sharp.dll /f /package taglib-sharp /gacdir /usr/lib /root /home/nikos/taglib-sharp-git/pkg/taglib-sharp-git/usr/lib
Failure adding assembly taglib-sharp.dll to the cache: Attempt to install an assembly without a strong name
make[2]: *** [Makefile:450: install-data-local] Error 1
make[2]: Leaving directory '/home/nikos/taglib-sharp-git/src/taglib-sharp/src'
make[1]: *** [Makefile:329: install-am] Error 2
make[1]: Leaving directory '/home/nikos/taglib-sharp-git/src/taglib-sharp/src'
make: *** [Makefile:431: install-recursive] Error 1

Arch linux, Mono 5.0.100

e: tried building older commits that i know installed/ compiled correctly and i have the same problem. Mono issue?

mvhd box not found

Could you please advise what causes the above error and if it is fixable from my end?

I can see from the code that the MovieHEaderBox parser is returning null - but what causes this to happen

// Get the movie header box. IsoMovieHeaderBox mvhd_box = parser.MovieHeaderBox; if(mvhd_box == null) { Mode = AccessMode.Closed; throw new CorruptFileException ( "mvhd box not found."); }

Album tag not detected in .wav file

When using TagLib to get tags from a .wav file, the Album tag is not detected.

var testFile = TagLib.File.Create(@"F:\temp\01.hihat.wav");
if (String.IsNullOrEmpty(testFile.Tag.Album))
{
    Debug.WriteLine("No album tag");
}

When I run the above code, "No album tag" is displayed in the output window. However, the file does have an album tag as you can see in the Windows Explorer properties and other programs that show meta data. I've tried this on a directory of .wav files (about 32 files, all with an album assigned) and received the same result for each file. Other properties (title, comment, artist, etc.) are fine.

capture13

NuGet install fails regardless of .NET version

I'm not able to install the package via NuGet for any version of .NET. I've tried 4 through 4.7 on both Visual Studio 2015 and 2017, and always get this message:

Could not install package 'taglib 2.1.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6.2', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

Poster field

Hi Team,

I'm working on a project, in C#, that will show the poster of a movie-file in Windows explorer icon (thumbnail) instead of a random frame of the movie. For that, the Poster need to be stored in the metadata of the video file. Needless to say, TagLib sharp is the enabler for this project.
I have already a proof of concept running with TagLib#, storing a poster as an URI in the Performer field. It works beautifully, but of course, Performer is definitly not the right place for this kind of metadata.
So I have several questions:

  1. what would be a good field, if exists, to store the poster (image) of the movie, for avi, mkv, wmv....
  2. If none exists, would it be possible to create one, making it de facto the standard for retrieving icon ?
  3. Is TagLib# project still active/maintained ?

Anyway, great job ! You can not imagine how I was happy to find this Library, by far the most handy and fit for my use ! So thanks a lot for this !

Is information 'Encoding settings' available?

There's a tool MediaInfo that allows to see every meta information stored in a media file.
For MP3 files encoded with LAME it shows LAME's version and the command string.
Is this information avaliable through taglib?
20170121_mediainfo

Shouldn't TRCK etc. be a string rather than a UInt?

Here is very the beginning of one of my mp3 files. I set the tags using the "mp3tag" application:

ID3.....N.TALB.......01-InfinithityTPE1.......Chris DevolTCON.......RockTIT2.......Hidey HoleTRCK.......01TXXX.......MP3GAIN_MINMAX.137,188TXXX.......MP3GAIN_ALBUM_MINMAX.127,191TXXX.......MP3GAIN_UNDO.+002,+002,NTXXX...#...replaygain_track_gain.-2.710000 dBTXXX.......replaygain_track_peak.0.729617TXXX...#...replaygain_album_gain.-2.980000 dBTXXX.......replaygain_album_peak.1.345866APIC..þ'...image/jpeg..Cover Art (Front).jpg.ÿØÿá.øExif..II*...

It appears that the TRCK tag is a string field, so that there can be leading zeros in the track number. Is there a way in taglib# to set this field as a string instead of as a UInt?
In taglib# all the instances of the "Track" property are defined as a UInt.

[Ogg] Support for METADATA_BLOCK_PICTURE

According to the xiph.org wiki, the currently recommended way to store pictures as part of an Ogg Vorbis file is through the METADATA_BLOCK_PICTURE field. Values of this field are base64 encoded values following the FLAC specification for embedded pictures.

The wiki also mentions the existence of the deprecated and unofficial COVERART field, which is supported by the current code in taglib-sharp. I can see several approaches to support the newer field, for taglib-sharp to be compatible with other projects.

All following approaches refer to changing the Pictures property

  1. Drop support for COVERART: replace COVERART with METADATA_BLOCK_PICTURE, and TagLib.Picture with TagLib.Flac.Picture. Most direct way, although breaks compatibility with older versions.
  2. Support for both COVERART and METADATA_BLOCK_PICTURE: in the getter, read cover arts from both COVERART and METADATA_BLOCK_PICTURE and return corresponding picture objects. In the setter, two approaches are possible:
    1. Store pictures depending on the object type: TagLib.Picture objects are stored in the COVERART field, and TagLib.FLAC.Picture objects are stored in the METADATA_BLOCK_PICTURE. Obviously the ordering of a file with mixed COVERART and METADATA_BLOCK_PICTURE pictures would be undefined.
    2. Convert old TagLib.Picture objects from the COVERART field to TagLib.FLAC.Picture , and store everything in METADATA_BLOCK_PICTURE. This would however enforce migrating to the new format.

I think 2.i. is the most versatile way, however I'm open to suggestions before sending a PR.

Lyrics3v2 Tag Support

Why this library does not support the Lyrics3v2 Tag?

I have checked all the libraries available for the .NET platform and none of them supports reading or writing the Lyrics3v2 tag.

File Duration is wrong for some files

using (var taglib = File.Create(path))
{
return taglib.Properties.Duration;
}
i tried to use the snippet to calculate mp3 file duration, but it gives me wrong file duration.

Make a new release

Hey guys,
since 2012 there hasn't been any new release and I wonder why. Don't you feel that there have been enough changes since then?

I'm asking, because the changes since 2.1 have not been imported in the Ubuntu package. And if I had to guess, I'd say it's because there is no newer release here in the upstream.
(I asked at launchpad: https://answers.launchpad.net/ubuntu/+source/taglib-sharp/+question/402667 )

I'd really like to have opus tag support without compiling things myself.
Martin

Remove user text frame

Hello,

At first, add 2 user text fames,

TagLib.File tagFile = TagLib.File.Create("1.mp3");
TagLib.Id3v2.Tag Tag = (TagLib.Id3v2.Tag)tagFile.GetTag(TagTypes.Id3v2);

// Add user text frame
TagLib.Id3v2.UserTextInformationFrame frame1 = new TagLib.Id3v2.UserTextInformationFrame("frame1");
frame1.Text = new string[] { "frame1 _value1" };
Tag.AddFrame(frame1);

TagLib.Id3v2.UserTextInformationFrame frame2 = new TagLib.Id3v2.UserTextInformationFrame("frame2");
frame2.Text = new string[] { "frame2 _value1" };
Tag.AddFrame(frame2);

tagFile .Save();

Then I want to remove only frame1, but seems it doesn't work with the following code,

TagLib.File tagFile = TagLib.File.Create("1.mp3");
TagLib.Id3v2.Tag Tag = (TagLib.Id3v2.Tag)tagFile.GetTag(TagTypes.Id3v2);

// Remove user text frame
TagLib.Id3v2.UserTextInformationFrame frame1 = new TagLib.Id3v2.UserTextInformationFrame("frame1");
//frame1 .Text = new string[] { "frame1 _value1" };
Tag.RemoveFrame(frame1);

tagFile .Save();

REPLAYGAIN

Hi!
AppleTag.cs
can make better use of the replaygain_track_peak ?(currently REPLAYGAIN_TRACK_PEAK)

Porting to .NET Core.

I was wondering if there's any plans on porting to the .NET Core spec.

We would probably want to create a new project possibly under Mono or another account. What is everyone's thoughts on this?

I've already started looking at it and it looks like porting it wouldn't be a problem.

ApiPortAnalysis.xlsx

Chunk with odd-sized length before the data chunk causes the data chunk to never be read

All forks of TagLib# do not handle reading a chunk when the position value is odd. This happens especially if bext (Broadcast Wave Format) chunks are present.

Having a chunk with an odd size before the data chunk forces TagLib# to never read the data chunk. Therefore the duration is never calculated as well as some other members are not populated. In the case of the audio file that I am trying to read, it has the following chunks:

  • bext
  • fmt
  • ID3
  • iXML
  • axml
  • data

My axml chunk's size is an odd value of 495 bytes. In the TagLib.Riff.Read method, When the while loop goes to read the next chunk (which happens to be the data chunk), it reads the fourcc chunk header name as \0DAT. TagLib# only (and correctly) accepts data but it is never found in the switch as there needs to be a one byte offset.

This can easily be fixed with a single line in the TagLib.Riff class. In the Read method where the do/while loop is, the code below should be added.

// Check if the current position is an odd number and increment it so it is even
// This is done when the previous chunk size was an odd number.
// If this is not done, the chunk being read after the odd chunk will not be read.
if (position > 12 && (position & 1) != 0) { position++; }

I am assuming this can also happen in other formats. The above code should likely be added at least to all other RIFF based formats such as AIFF and AVI in the same location.

Note: @jamsoft in his fork, which he mentions in issue #74, addresses the Broadcast Wave Format but does not take into consideration odd sized chunks (nor does he handle null XML elements but that is a different matter). Otherwise his fork is great as far as I can tell and also cleans up a lot of code style issues with this master repo.

Pictures in MKV

Apparently, setting/getting a Tag.Pictures field on a MKV file is not possible.

Would it be possible to add support to Pictures in MKV (in Matroska world: Attachments) ?
If not, shall I do it myself (will it then be integrated to this project) ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.