Skip to content

Commit

Permalink
写入udta而非handler_name
Browse files Browse the repository at this point in the history
  • Loading branch information
nilaoda committed Aug 23, 2022
1 parent 4b3ea0b commit e068d01
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions BBDown/BBDownMuxer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,18 @@ public static int MuxByMp4box(string videoPath, string audioPath, string outPath
{
StringBuilder inputArg = new();
StringBuilder metaArg = new();
int nowId = 0;
inputArg.Append(" -inter 500 -noprog ");
if (!string.IsNullOrEmpty(videoPath))
{
inputArg.Append($" -add \"{videoPath}#trackID={(audioOnly && audioPath == "" ? "2" : "1")}:name=\" ");
nowId++;
}
if (!string.IsNullOrEmpty(audioPath))
{
inputArg.Append($" -add \"{audioPath}:lang={(lang == "" ? "und" : lang)}\" ");
nowId++;
}
if (points != null && points.Count > 0)
{
var meta = GetMp4boxMetaString(points);
Expand All @@ -61,9 +68,9 @@ public static int MuxByMp4box(string videoPath, string audioPath, string outPath
if (!string.IsNullOrEmpty(pic))
metaArg.Append($":cover=\"{pic}\"");
if (!string.IsNullOrEmpty(episodeId))
metaArg.Append($":album=\"{title}\":name=\"{episodeId}\"");
metaArg.Append($":album=\"{title}\":title=\"{episodeId}\"");
else
metaArg.Append($":name=\"{title}\"");
metaArg.Append($":title=\"{title}\"");
metaArg.Append($":comment=\"{desc}\"");

if (subs != null)
Expand All @@ -72,13 +79,15 @@ public static int MuxByMp4box(string videoPath, string audioPath, string outPath
{
if (File.Exists(subs[i].path) && File.ReadAllText(subs[i].path!) != "")
{
inputArg.Append($" -add \"{subs[i].path}#trackID=1:name={GetSubtitleCode(subs[i].lan).Item2}:lang={GetSubtitleCode(subs[i].lan).Item1}\" ");
nowId++;
inputArg.Append($" -add \"{subs[i].path}#trackID=1:name=:lang={GetSubtitleCode(subs[i].lan).Item1}\" ");
inputArg.Append($" -udta {nowId}:type=name:str=\"{GetSubtitleCode(subs[i].lan).Item2}\" ");
}
}
}

//----分析完毕
var arguments = inputArg.ToString() + (metaArg.ToString() == "" ? "" : " -itags tools=\"\"" + metaArg.ToString()) + $" \"{outPath}\"";
var arguments = inputArg.ToString() + (metaArg.ToString() == "" ? "" : " -itags tool=" + metaArg.ToString()) + $" -new \"{outPath}\"";
LogDebug("mp4box命令:{0}", arguments);
return RunExe(MP4BOX, arguments, MP4BOX != "mp4box");
}
Expand Down Expand Up @@ -116,7 +125,7 @@ public static int MuxAV(bool useMp4box, string videoPath, string audioPath, stri
if(File.Exists(subs[i].path) && File.ReadAllText(subs[i].path!) != "")
{
inputArg.Append($" -i \"{subs[i].path}\" ");
metaArg.Append($" -metadata:s:s:{i} handler_name=\"{GetSubtitleCode(subs[i].lan).Item2}\" -metadata:s:s:{i} language={GetSubtitleCode(subs[i].lan).Item1} ");
metaArg.Append($" -metadata:s:s:{i} title=\"{GetSubtitleCode(subs[i].lan).Item2}\" -metadata:s:s:{i} language={GetSubtitleCode(subs[i].lan).Item1} ");
}
}
}
Expand Down

0 comments on commit e068d01

Please sign in to comment.