读/写音频/video文件的元数据
我需要一些帮助来读/写音频/ vido文件的元数据信息。 我搜索了很多,但没有找到任何有用的东西。 Taglib sharp是一个开源库,提供读/写元数据的帮助。 使用标签lib我可以编辑一些值但不是全部。
TagLib.File videoFile = TagLib.File.Create("test.mp4"); videoFile.Tag.Title = "Test"; videoFile.Tag.Comment = "Nothing";
但我无法编辑以下属性,如作者url,生产者等。我如何编辑这些属性?
我以前从来没有为video文件做过这个,但我有mp3文件。 你可以像这样访问这些框架:
TagLib.File file = TagLib.File.Create(mp3FileName); file.Tag.Title = "some title"; // you've got this TagLib.Id3v2.Tag tag = (TagLib.Id3v2.Tag)file.GetTag(TagTypes.Id3v2); tag.SetTextFrame("WOAR", "some url"); // WOAR = Official artist/performer webpage file.Save();
您可以在维基百科上找到文本框架标识符的列表: ID3v2框架规范(版本2.3)
我不知道video文件是否提供与ID3相同的帧范围,但请注意维基百科也说( 在非mp3和替代品中实现 )
MP4还允许嵌入ID3标签,这得到了广泛的支持。
所以我猜这也适用于你正在尝试的mp4文件。
您需要使用AppleTag。 这会奏效。 对于mp4文件,您必须将值写入dashbox。 像这样:
TagLib.File videoFile = TagLib.File.Create("test.mp4"); TagLib.Mpeg4.AppleTag customTag = (TagLib.Mpeg4.AppleTag)f.GetTag(TagLib.TagTypes.Apple); customTag.SetDashBox("Producer","Producer1", "value"); f.Save(); f.Dispose();
你可以得到这样的价值:
var tokenValue = customTag.GetDashBox("Producer", "Producer1");
- 在短和字节之间转换的好方法?
- .NET跨组件性能命中
- 使用StreamSocket TCP的WinRT:DataReader.LoadAsyncexception
- XAML条件编译
- 通过Massive ORM(ExecuteNonQuery),UdtTypeName错误更新带有空间数据类型的SQL Server 2008记录
- Visual Studio 2015 Debug在multithreading应用程序中不起作用
- C#generics – 为什么从具体类型回到T需要显式转换?
- 在ASP MVC 3中创建可下载的文本文件时无法访问关闭的流
- “OnEndPage”事件处理程序中的“’System.StackOverflowException”