From 874e6409e4bdbb1d70828a86d05407afd33e7994 Mon Sep 17 00:00:00 2001 From: Nekopanda Date: Mon, 13 May 2019 22:02:11 +0900 Subject: [PATCH] =?UTF-8?q?=E9=9F=B3=E5=A3=B0=E3=83=95=E3=82=A9=E3=83=BC?= =?UTF-8?q?=E3=83=9E=E3=83=83=E3=83=88=E7=84=A1=E8=A6=96=E3=82=AA=E3=83=97?= =?UTF-8?q?=E3=82=B7=E3=83=A7=E3=83=B3=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Amatsukaze/AmatsukazeCLI.hpp | 4 ++++ Amatsukaze/AmatsukazeTestImpl.hpp | 4 ++-- Amatsukaze/Muxer.hpp | 7 ++++++- Amatsukaze/StreamReform.hpp | 7 +++++-- Amatsukaze/TranscodeManager.hpp | 2 +- Amatsukaze/TranscodeSetting.hpp | 5 +++++ AmatsukazeGUI/Models/DisplayData.cs | 12 ++++++++++++ AmatsukazeServer/Server/EncodeServer.cs | 4 ++++ AmatsukazeServer/Server/EncodeServerData.cs | 2 ++ 9 files changed, 41 insertions(+), 6 deletions(-) diff --git a/Amatsukaze/AmatsukazeCLI.hpp b/Amatsukaze/AmatsukazeCLI.hpp index 4646802..839c226 100644 --- a/Amatsukaze/AmatsukazeCLI.hpp +++ b/Amatsukaze/AmatsukazeCLI.hpp @@ -67,6 +67,7 @@ static void printHelp(const tchar* bin) { " --ignore-no-drcsmap マッピングにないDRCS外字があっても処理を続行する\n" " --ignore-no-logo ロゴが見つからなくても処理を続行する\n" " --ignore-nicojk-error ニコニコ実況取得でエラーが発生しても処理を続行する\n" + " --ignore-audio-format 音声フォーマットの切り替わりでファイルを分けない\n" " --no-delogo ロゴ消しをしない(デフォルトはロゴがある場合は消します)\n" " --loose-logo-detection ロゴ検出判定しきい値を低くします\n" " --max-fade-length <数値> ロゴの最大フェードフレーム数[16]\n" @@ -348,6 +349,9 @@ static std::unique_ptr parseArgs(AMTContext& ctx, int argc, const else if (key == _T("--ignore-nicojk-error")) { conf.ignoreNicoJKError = true; } + else if (key == _T("--ignore-audio-format")) { + conf.ignoreAudioFormat = true; + } else if (key == _T("--loose-logo-detection")) { conf.looseLogoDetection = true; } diff --git a/Amatsukaze/AmatsukazeTestImpl.hpp b/Amatsukaze/AmatsukazeTestImpl.hpp index de54240..623756d 100644 --- a/Amatsukaze/AmatsukazeTestImpl.hpp +++ b/Amatsukaze/AmatsukazeTestImpl.hpp @@ -284,7 +284,7 @@ static int ProcessTest(AMTContext& ctx, const ConfigWrapper& setting) static int FileStreamInfo(AMTContext& ctx, const ConfigWrapper& setting) { StreamReformInfo reformInfo = StreamReformInfo::deserialize(ctx, setting.getStreamInfoPath()); - reformInfo.prepare(false); + reformInfo.prepare(false, false); auto audioDiffInfo = reformInfo.genAudio({ CMTYPE_BOTH }); audioDiffInfo.printAudioPtsDiff(ctx); reformInfo.printOutputMapping([&](EncodeFileKey key) { @@ -535,7 +535,7 @@ static int CaptionASS(AMTContext& ctx, const ConfigWrapper& setting) try { StreamReformInfo reformInfo = StreamReformInfo::deserialize(ctx, setting.getStreamInfoPath()); - reformInfo.prepare(false); + reformInfo.prepare(false, false); auto audioDiffInfo = reformInfo.genAudio({ CMTYPE_BOTH }); audioDiffInfo.printAudioPtsDiff(ctx); diff --git a/Amatsukaze/Muxer.hpp b/Amatsukaze/Muxer.hpp index e824919..6da016c 100644 --- a/Amatsukaze/Muxer.hpp +++ b/Amatsukaze/Muxer.hpp @@ -82,7 +82,9 @@ class AMTMuxder : public AMTObject { for (int asrc = 0, adst = 0; asrc < (int)fileIn.audioFrames.size(); ++asrc) { const std::vector& frameList = fileIn.audioFrames[asrc]; if (frameList.size() > 0) { - if (fmt.audioFormat[asrc].channels == AUDIO_2LANG) { + bool ignoreAudioFormat = setting_.isIgnoreAudioFormat(); + bool isDualMono = (fmt.audioFormat[asrc].channels == AUDIO_2LANG); + if (!ignoreAudioFormat && isDualMono) { // デュアルモノは2つのAACに分離 ctx.infoF("音声%d-%dはデュアルモノなので2つのAACファイルに分離します", fileIn.outKey.format, asrc); SpDualMonoSplitter splitter(ctx); @@ -97,6 +99,9 @@ class AMTMuxder : public AMTObject { audioFiles.push_back(filepath1); } else { + if (isDualMono) { + ctx.infoF("音声%d-%dはデュアルモノですが、音声フォーマット無視指定があるので分離しません", fileIn.outKey.format, asrc); + } tstring filepath = setting_.getIntAudioFilePath(key, adst++); File file(filepath, _T("wb")); for (int frameIndex : frameList) { diff --git a/Amatsukaze/StreamReform.hpp b/Amatsukaze/StreamReform.hpp index d05510d..cc41760 100644 --- a/Amatsukaze/StreamReform.hpp +++ b/Amatsukaze/StreamReform.hpp @@ -234,7 +234,8 @@ class StreamReformInfo : public AMTObject { // 1. コンストラクト直後に呼ぶ // splitSub: メイン以外のフォーマットを結合しない - void prepare(bool splitSub) { + void prepare(bool splitSub, bool ignoreAudioFormat) { + ignoreAudioFormat_ = ignoreAudioFormat; reformMain(splitSub); genWaveAudioStream(); } @@ -488,6 +489,7 @@ class StreamReformInfo : public AMTObject { std::vector timeList_; std::array, NICOJK_MAX> nicoJKList_; + bool ignoreAudioFormat_; // 計算データ bool isVFR_; @@ -1082,6 +1084,7 @@ class StreamReformInfo : public AMTObject { bool isEquealFormat(const OutVideoFormat& a, const OutVideoFormat& b) { if (a.videoFormat != b.videoFormat) return false; if (a.audioFormat.size() != b.audioFormat.size()) return false; + if (ignoreAudioFormat_) return true; for (int i = 0; i < (int)a.audioFormat.size(); ++i) { if (a.audioFormat[i] != b.audioFormat[i]) { return false; @@ -1341,7 +1344,7 @@ class StreamReformInfo : public AMTObject { ++nskipped; continue; } - if (format != nullptr && frame.format != *format) { + if (!ignoreAudioFormat_ && format != nullptr && frame.format != *format) { // フォーマットが違うのでスキップ continue; } diff --git a/Amatsukaze/TranscodeManager.hpp b/Amatsukaze/TranscodeManager.hpp index d5fa12a..90d8e77 100644 --- a/Amatsukaze/TranscodeManager.hpp +++ b/Amatsukaze/TranscodeManager.hpp @@ -514,7 +514,7 @@ static void transcodeMain(AMTContext& ctx, const ConfigWrapper& setting) } } - reformInfo.prepare(setting.isSplitSub()); + reformInfo.prepare(setting.isSplitSub(), setting.isIgnoreAudioFormat()); time_t startTime = reformInfo.getFirstFrameTime(); diff --git a/Amatsukaze/TranscodeSetting.hpp b/Amatsukaze/TranscodeSetting.hpp index fd0791e..039c881 100644 --- a/Amatsukaze/TranscodeSetting.hpp +++ b/Amatsukaze/TranscodeSetting.hpp @@ -507,6 +507,7 @@ struct Config { tstring nicoConvChSidPath; ENUM_FORMAT format; bool splitSub; + bool ignoreAudioFormat; bool twoPass; bool autoBitrate; bool chapter; @@ -654,6 +655,10 @@ class ConfigWrapper : public AMTObject return conf.splitSub; } + bool isIgnoreAudioFormat() const { + return conf.ignoreAudioFormat; + } + bool isTwoPass() const { return conf.twoPass; } diff --git a/AmatsukazeGUI/Models/DisplayData.cs b/AmatsukazeGUI/Models/DisplayData.cs index 56839a1..6af7f76 100644 --- a/AmatsukazeGUI/Models/DisplayData.cs +++ b/AmatsukazeGUI/Models/DisplayData.cs @@ -1514,6 +1514,18 @@ public string ChapterExeOptions } #endregion + #region IgnoreAudioFormat螟画峩騾夂衍繝励Ο繝代ユ繧」 + public bool IgnoreAudioFormat { + get { return Data.IgnoreAudioFormat; } + set { + if (Data.IgnoreAudioFormat == value) + return; + Data.IgnoreAudioFormat = value; + RaisePropertyChanged(); + } + } + #endregion + #region NoDelogo螟画峩騾夂衍繝励Ο繝代ユ繧」 public bool NoDelogo { get { return Data.NoDelogo; } diff --git a/AmatsukazeServer/Server/EncodeServer.cs b/AmatsukazeServer/Server/EncodeServer.cs index 011926c..02aa22e 100644 --- a/AmatsukazeServer/Server/EncodeServer.cs +++ b/AmatsukazeServer/Server/EncodeServer.cs @@ -1401,6 +1401,10 @@ private string GetEncoderName(EncoderType encoderType) { sb.Append(" --ignore-no-drcsmap"); } + if(profile.IgnoreAudioFormat) + { + sb.Append(" --ignore-audio-format"); + } if (profile.NoDelogo) { sb.Append(" --no-delogo"); diff --git a/AmatsukazeServer/Server/EncodeServerData.cs b/AmatsukazeServer/Server/EncodeServerData.cs index 285dc64..c8ba446 100644 --- a/AmatsukazeServer/Server/EncodeServerData.cs +++ b/AmatsukazeServer/Server/EncodeServerData.cs @@ -242,6 +242,8 @@ public class ProfileSetting : IExtensibleDataObject [DataMember] public bool IgnoreNoDrcsMap { get; set; } [DataMember] + public bool IgnoreAudioFormat { get; set; } + [DataMember] public bool LooseLogoDetection { get; set; } [DataMember] public bool IgnoreNoLogo { get; set; }