C# TaglibSharp使用分号截断MP4注释/描述
我正在尝试使用Taglib Sharp更新MP4视频文件的注释和描述标记。当文本包含分号(;)时,文本将在分号处截断。分号(包括分号)后的内容不会添加到标记中。如果我用相同的文本更新MP3音频文件,它就会工作。MP4视频评论和描述标签中不允许使用分号吗C# TaglibSharp使用分号截断MP4注释/描述,c#,.net,taglib-sharp,C#,.net,Taglib Sharp,我正在尝试使用Taglib Sharp更新MP4视频文件的注释和描述标记。当文本包含分号(;)时,文本将在分号处截断。分号(包括分号)后的内容不会添加到标记中。如果我用相同的文本更新MP3音频文件,它就会工作。MP4视频评论和描述标签中不允许使用分号吗 using System; namespace Test { class Program { //const string file = @"Audio.mp3"; const
using System;
namespace Test
{
class Program
{
//const string file = @"Audio.mp3";
const string file = @"Video.mp4";
const string tagValue = "Text0; Text1";
///////////////////////////////////////////////////////////////////////
static void Main()
{
// Show current value
Console.WriteLine(string.Format("Current tag value: \"{0}\"", getTagValue(file)));
// Update with value that contains a semicolon
setTagValue(file, tagValue);
// Show tag after trying to add semicolon
Console.WriteLine(string.Format("Tag value after update: \"{0}\"", getTagValue(file)));
// Wait for user to press ENTER
Console.WriteLine();
Console.WriteLine("Press <ENTER> to exit");
Console.ReadLine();
}
///////////////////////////////////////////////////////////////////////
public static string getTagValue(string file)
{
// Local variables
string comment = "";
// Open the file
TagLib.File tagFile = TagLib.File.Create(file);
// Get comment
comment = tagFile.Tag.Comment;
//comment = tfile.Tag.Description;
// Return comment to caller
return comment;
}
///////////////////////////////////////////////////////////////////////
public static void setTagValue(string file, string comment)
{
// Open the file
TagLib.File tagFile = TagLib.File.Create(file);
// Write the comment
tagFile.Tag.Comment = comment;
//tfile.Tag.Description = comment;
// Save the comment
tagFile.Save();
}
}
}
使用系统;
名称空间测试
{
班级计划
{
//常量字符串文件=@“Audio.mp3”;
常量字符串文件=@“Video.mp4”;
常量字符串tagValue=“Text0;Text1”;
///////////////////////////////////////////////////////////////////////
静态void Main()
{
//显示当前值
WriteLine(string.Format(“当前标记值:\“{0}\”,getTagValue(文件)));
//使用包含分号的值进行更新
setTagValue(文件,tagValue);
//尝试添加分号后显示标记
WriteLine(string.Format(“更新后的标记值:\“{0}\”,getTagValue(文件)));
//等待用户按ENTER键
Console.WriteLine();
控制台写入线(“按下退出”);
Console.ReadLine();
}
///////////////////////////////////////////////////////////////////////
公共静态字符串getTagValue(字符串文件)
{
//局部变量
字符串注释=”;
//打开文件
TagLib.File tagFile=TagLib.File.Create(文件);
//获得评论
comment=tagFile.Tag.comment;
//comment=tfile.Tag.Description;
//将注释返回给调用者
回复评论;
}
///////////////////////////////////////////////////////////////////////
公共静态void setTagValue(字符串文件、字符串注释)
{
//打开文件
TagLib.File tagFile=TagLib.File.Create(文件);
//写评论
tagFile.Tag.Comment=注释;
//tfile.Tag.Description=注释;
//保存评论
tagFile.Save();
}
}
}
看起来这可能是一个已知的问题: