Skip to content

Commit

Permalink
支持Hi-Res无损音频 nilaoda#384
Browse files Browse the repository at this point in the history
  • Loading branch information
nilaoda committed Jul 14, 2022
1 parent dbe1721 commit ecb3190
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 18 additions & 2 deletions BBDown.Core/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,23 @@ private static async Task<string> GetPlayJsonAsync(string aid, string cid, strin
}
}
catch (Exception) { ; }


//处理Hi-Res无损
try
{
if (audio != null)
{
if (!tvApi && respJson.RootElement.GetProperty(nodeName).GetProperty("dash").TryGetProperty("flac", out JsonElement hiRes))
{
if (hiRes.TryGetProperty("audio", out JsonElement db))
{
audio.Add(db);
}
}
}
}
catch (Exception) {; }

if (video != null)
{
foreach (var node in video)
Expand Down Expand Up @@ -222,7 +238,7 @@ private static async Task<string> GetPlayJsonAsync(string aid, string cid, strin
dur = pDur,
bandwith = Convert.ToInt64(node.GetProperty("bandwidth").ToString()) / 1000,
baseUrl = urlList.FirstOrDefault(i => !BaseUrlRegex().IsMatch(i), urlList.First()),
codecs = node.GetProperty("codecs").ToString().Replace("mp4a.40.2", "M4A").Replace("ec-3", "E-AC-3")
codecs = node.GetProperty("codecs").ToString().Replace("mp4a.40.2", "M4A").Replace("ec-3", "E-AC-3").Replace("fLaC", "FLAC")
};
audioTracks.Add(a);
}
Expand Down
2 changes: 1 addition & 1 deletion BBDown/BBDownMuxer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public static int MuxAV(bool useMp4box, string videoPath, string audioPath, stri
(episodeId == "" ? "" : $"-metadata album=\"{title}\" ") +
$"-c copy " + (audioOnly && audioPath == "" ? " -vn " : "") +
(subs != null ? " -c:s mov_text " : "") +
"-movflags faststart -strict unofficial -f mp4 " +
"-movflags faststart -strict unofficial -strict -2 -f mp4 " +
$"\"{outPath}\"";
LogDebug("ffmpeg命令:{0}", arguments);
return RunExe(FFMPEG, arguments, FFMPEG != "ffmpeg");
Expand Down

0 comments on commit ecb3190

Please sign in to comment.