mirror of
https://github.com/bolucat/Archive.git
synced 2025-09-26 20:21:35 +08:00
Update On Sun Nov 24 19:33:47 CET 2024
This commit is contained in:
@@ -44,7 +44,7 @@ static partial class BBDownMuxer
|
||||
return string.IsNullOrEmpty(str) ? str : str.Replace("\"", "'").Replace("\\", "\\\\");
|
||||
}
|
||||
|
||||
private static int MuxByMp4box(string videoPath, string audioPath, string outPath, string desc, string title, string author, string episodeId, string pic, string lang, List<Subtitle>? subs, bool audioOnly, bool videoOnly, List<ViewPoint>? points)
|
||||
private static int MuxByMp4box(string url, string videoPath, string audioPath, string outPath, string desc, string title, string author, string episodeId, string pic, string lang, List<Subtitle>? subs, bool audioOnly, bool videoOnly, List<ViewPoint>? points)
|
||||
{
|
||||
StringBuilder inputArg = new();
|
||||
StringBuilder metaArg = new();
|
||||
@@ -73,7 +73,8 @@ static partial class BBDownMuxer
|
||||
metaArg.Append($":album=\"{title}\":title=\"{episodeId}\"");
|
||||
else
|
||||
metaArg.Append($":title=\"{title}\"");
|
||||
metaArg.Append($":comment=\"{desc}\"");
|
||||
metaArg.Append($":sdesc=\"{desc}\"");
|
||||
metaArg.Append($":comment=\"{url}\"");
|
||||
metaArg.Append($":artist=\"{author}\"");
|
||||
|
||||
if (subs != null)
|
||||
@@ -90,12 +91,12 @@ static partial class BBDownMuxer
|
||||
}
|
||||
|
||||
//----分析完毕
|
||||
var arguments = (Config.DEBUG_LOG ? " -verbose " : "") + inputArg.ToString() + (metaArg.ToString() == "" ? "" : " -itags tool=" + metaArg.ToString()) + $" -new -- \"{outPath}\"";
|
||||
var arguments = (Config.DEBUG_LOG ? " -v " : "") + inputArg + (metaArg.ToString() == "" ? "" : " -itags tool=" + metaArg) + $" -new -- \"{outPath}\"";
|
||||
LogDebug("mp4box命令: {0}", arguments);
|
||||
return RunExe(MP4BOX, arguments, MP4BOX != "mp4box");
|
||||
}
|
||||
|
||||
public static int MuxAV(bool useMp4box, string videoPath, string audioPath, List<AudioMaterial> audioMaterial, string outPath, string desc = "", string title = "", string author = "", string episodeId = "", string pic = "", string lang = "", List<Subtitle>? subs = null, bool audioOnly = false, bool videoOnly = false, List<ViewPoint>? points = null, long pubTime = 0, bool simplyMux = false)
|
||||
public static int MuxAV(bool useMp4box, string bvid, string videoPath, string audioPath, List<AudioMaterial> audioMaterial, string outPath, string desc = "", string title = "", string author = "", string episodeId = "", string pic = "", string lang = "", List<Subtitle>? subs = null, bool audioOnly = false, bool videoOnly = false, List<ViewPoint>? points = null, long pubTime = 0, bool simplyMux = false)
|
||||
{
|
||||
if (audioOnly && audioPath != "")
|
||||
videoPath = "";
|
||||
@@ -104,10 +105,11 @@ static partial class BBDownMuxer
|
||||
desc = EscapeString(desc);
|
||||
title = EscapeString(title);
|
||||
episodeId = EscapeString(episodeId);
|
||||
var url = $"https://www.bilibili.com/video/{bvid}/";
|
||||
|
||||
if (useMp4box)
|
||||
{
|
||||
return MuxByMp4box(videoPath, audioPath, outPath, desc, title, author, episodeId, pic, lang, subs, audioOnly, videoOnly, points);
|
||||
return MuxByMp4box(url, videoPath, audioPath, outPath, desc, title, author, episodeId, pic, lang, subs, audioOnly, videoOnly, points);
|
||||
}
|
||||
|
||||
if (outPath.Contains('/') && ! Directory.Exists(Path.GetDirectoryName(outPath)))
|
||||
@@ -179,6 +181,7 @@ static partial class BBDownMuxer
|
||||
argsBuilder.Append(metaArg);
|
||||
if (!simplyMux) {
|
||||
argsBuilder.Append($"-metadata title=\"{(episodeId == "" ? title : episodeId)}\" ");
|
||||
argsBuilder.Append($"-metadata comment=\"{url}\" ");
|
||||
if (lang != "") argsBuilder.Append($"-metadata:s:a:0 language={lang} ");
|
||||
if (!string.IsNullOrWhiteSpace(desc)) argsBuilder.Append($"-metadata description=\"{desc}\" ");
|
||||
if (!string.IsNullOrEmpty(author)) argsBuilder.Append($"-metadata artist=\"{author}\" ");
|
||||
|
@@ -244,7 +244,7 @@ partial class Program
|
||||
|
||||
Log("获取aid...");
|
||||
aidOri = await GetAvIdAsync(input);
|
||||
Log("获取aid结束: " + aidOri);
|
||||
Log($"获取aid结束: {aidOri}");
|
||||
|
||||
if (string.IsNullOrEmpty(aidOri))
|
||||
{
|
||||
@@ -287,6 +287,11 @@ partial class Program
|
||||
{
|
||||
Log("发布时间: " + FormatTimeStamp(pubTime, "yyyy-MM-dd HH:mm:ss zzz"));
|
||||
}
|
||||
var bvid = vInfo.PagesInfo.FirstOrDefault()?.bvid;
|
||||
if (!string.IsNullOrEmpty(bvid))
|
||||
{
|
||||
Log($"视频URL: https://www.bilibili.com/video/{bvid}/");
|
||||
}
|
||||
var mid = vInfo.PagesInfo.FirstOrDefault(p => !string.IsNullOrEmpty(p.ownerMid))?.ownerMid;
|
||||
if (!string.IsNullOrEmpty(mid))
|
||||
{
|
||||
@@ -664,7 +669,7 @@ partial class Program
|
||||
Log($"开始合并音视频{(subtitleInfo.Any() ? "和字幕" : "")}...");
|
||||
if (myOption.AudioOnly)
|
||||
savePath = savePath[..^4] + ".m4a";
|
||||
int code = BBDownMuxer.MuxAV(myOption.UseMP4box, videoPath, audioPath, audioMaterial, savePath,
|
||||
int code = BBDownMuxer.MuxAV(myOption.UseMP4box, p.bvid, videoPath, audioPath, audioMaterial, savePath,
|
||||
desc,
|
||||
title,
|
||||
p.ownerName ?? "",
|
||||
@@ -753,7 +758,7 @@ partial class Program
|
||||
Log($"开始混流视频{(subtitleInfo.Any() ? "和字幕" : "")}...");
|
||||
if (myOption.AudioOnly)
|
||||
savePath = savePath[..^4] + ".m4a";
|
||||
int code = BBDownMuxer.MuxAV(false, videoPath, "", audioMaterial, savePath,
|
||||
int code = BBDownMuxer.MuxAV(false, p.bvid, videoPath, "", audioMaterial, savePath,
|
||||
desc,
|
||||
title,
|
||||
p.ownerName ?? "",
|
||||
|
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user