public M2tsInfoTool(UserSettings settings, ref List<TitleInfo> result, List<string> m2tsFiles, List<string> videoTypes, List<string> ac3AudioTypes, List<string> dtsAudioTypes) : base() { try { this.settings = settings; result = new List<TitleInfo>(); this.result = result; this.m2tsFiles = m2tsFiles; this.Path = settings.eac3toPath; string tmpstr = ""; foreach (string s in m2tsFiles) { tmpstr += "\"" + s + "\"+"; } if (tmpstr.Length > 0) { if (tmpstr[tmpstr.Length - 1] == '+') { tmpstr = tmpstr.Substring(0, tmpstr.Length - 1); } } this.Parameter = tmpstr; this.videoTypes = videoTypes; this.ac3AudioTypes = ac3AudioTypes; this.dtsAudioTypes = dtsAudioTypes; } catch (Exception) { } }
public EditAvisynthProfilesWindow(UserSettings settings) { try { InitializeComponent(); this.settings = new UserSettings(settings); UpdateAvisynthProfiles(); } catch (Exception ex) { Global.ErrorMsg(ex); } }
public IndexTool(UserSettings settings, string filename, IndexType indexType) : base() { try { this.settings = settings; this.filename = filename; this.indexType = indexType; if (indexType == IndexType.ffmsindex) { if (settings.deleteIndex || isOlder(filename + ".ffindex", filename)) { if (File.Exists(filename + ".ffindex")) { try { File.Delete(filename + ".ffindex"); } catch (Exception) { } } } Path = settings.ffmsindexPath; Parameter = "\"" + filename + "\""; } else if (indexType == IndexType.dgindex) { string output = System.IO.Path.ChangeExtension(filename, "dgi"); if (settings.deleteIndex || isOlder(output, filename)) { if (File.Exists(output)) { try { File.Delete(output); } catch (Exception) { } } } Path = settings.dgindexnvPath; Parameter = "-i \"" + filename + "\" -o \"" + output + "\" -e"; } } catch (Exception) { } }
public StreamInfoTool(UserSettings settings, ref List<TitleInfo> result, string path, List<string> videoTypes, List<string> ac3AudioTypes, List<string> dtsAudioTypes) : base() { try { this.titlePath = path; this.settings = settings; result = new List<TitleInfo>(); this.result = result; this.Path = settings.eac3toPath; this.Parameter = "\"" + titlePath + "\""; this.videoTypes = videoTypes; this.ac3AudioTypes = ac3AudioTypes; this.dtsAudioTypes = dtsAudioTypes; } catch (Exception) { } }
public SubStreamInfoTool(UserSettings settings, ref List<TitleInfo> result, string path, string streamNumber, List<string> videoTypes, List<string> ac3AudioTypes, List<string> dtsAudioTypes, List<string> files) : base() { try { this.settings = settings; this.result = result; this.Path = settings.eac3toPath; this.Parameter = "\"" + path + "\" " + streamNumber + ")"; this.videoTypes = videoTypes; this.ac3AudioTypes = ac3AudioTypes; this.dtsAudioTypes = dtsAudioTypes; this.streamNumber = streamNumber + ")"; this.files = files; } catch (Exception) { } }
public Project(UserSettings settings, TitleInfo streamList, List<TitleInfo> titleList, int titleIndex, List<string> m2tsList) { try { this.settings = new UserSettings(settings); this.demuxedStreamList = new TitleInfo(streamList); this.titleList.Clear(); foreach (TitleInfo ti in titleList) { this.titleList.Add(new TitleInfo(ti)); } this.titleIndex = titleIndex; this.m2tsList.Clear(); foreach (string s in m2tsList) { this.m2tsList.Add(s); } } catch (Exception) { } }
public ExternalTools(UserSettings settings) { try { InitializeComponent(); this.settings = new UserSettings(settings); textBoxEac3toPath.Text = settings.eac3toPath; textBoxBDSup2subPath.Text = settings.sup2subPath; textBoxJavaPath.Text = settings.javaPath; textBoxX264Path.Text = settings.x264Path; textBoxMkvmergePath.Text = settings.mkvmergePath; textBoxFfmsindexPath.Text = settings.ffmsindexPath; textBoxDgindexnvPath.Text = settings.dgindexnvPath; textBoxX264x64Path.Text = settings.x264x64Path; textBoxAvs2yuvPath.Text = settings.avs2yuvPath; textBoxSuptitlePath.Text = settings.suptitlePath; } catch (Exception ex) { Global.ErrorMsg(ex); } }
public AutoCrop(string filename, UserSettings settings, ref CropInfo cropInfo) { InitializeComponent(); try { this.settings = settings; this.cropInfo = cropInfo; AviSynthScriptEnvironment asse = new AviSynthScriptEnvironment(); asc = asse.OpenScriptFile(filename); if(asc.HasVideo) { System.Drawing.Size s = new Size(asc.VideoWidth, asc.VideoHeight); this.ClientSize = s; maxFrames = asc.num_frames; // remove last ~10 minutes if (maxFrames > 30000) { maxFrames -= 15000; } numericUpDownFrame.Maximum = maxFrames; int step = 0; step = maxFrames / nrFrames; curFrame = step; Monitor.Enter(drawLock); bitmap = ReadFrameBitmap(asc, step); bitmapCopy = new Bitmap(bitmap); Monitor.Exit(drawLock); } } catch (Exception ex) { cropInfo.error = true; cropInfo.errorStr = ex.Message; } }
public DemuxTool(UserSettings settings, List<string> m2tsFiles, List<string> videoTypes, List<string> ac3AudioTypes, List<string> dtsAudioTypes, TitleInfo streamList, ref TitleInfo demuxedStreamList, string ac3Bitrate, string dtsBitrate) : base() { try { this.settings = settings; this.m2tsFiles = m2tsFiles; this.videoTypes = videoTypes; this.ac3AudioTypes = ac3AudioTypes; this.dtsAudioTypes = dtsAudioTypes; this.streamList = streamList; demuxedStreamList = new TitleInfo(); this.demuxedStreamList = demuxedStreamList; this.ac3Bitrate = ac3Bitrate; this.dtsBitrate = dtsBitrate; this.Path = settings.eac3toPath; Init(); } catch (Exception) { } }
private void menuItemFileOpen_Click(object sender, RoutedEventArgs e) { try { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = Global.Res("ProjectFileFilter"); if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Project project = new Project(); if (Project.LoadProjectFile(ref project, ofd.FileName)) { settings = new UserSettings(project.settings); titleList.Clear(); foreach (TitleInfo ti in project.titleList) { titleList.Add(new TitleInfo(ti)); } UpdateTitleList(); comboBoxTitle.SelectedIndex = project.titleIndex; demuxedStreamList = new TitleInfo(project.demuxedStreamList); m2tsList.Clear(); foreach (string s in project.m2tsList) { m2tsList.Add(s); } UpdateFromSettings(true); demuxedStreamsWindow.UpdateDemuxedStreams(); } } } catch (Exception) { } }
private void menuItemSettingsAvisynthProfiles_Click(object sender, RoutedEventArgs e) { try { EditAvisynthProfilesWindow eapw = new EditAvisynthProfilesWindow(settings); eapw.ShowDialog(); if (eapw.DialogResult == true) { settings = new UserSettings(eapw.UserSettings); UpdateAvisynthProfiles(); } } catch (Exception) { } }
private void DoPlugin(PluginType pluginType) { try { foreach (PluginBase plugin in pluginList) { if (plugin.Settings.activated && plugin.getPluginType() == pluginType) { Project project = new Project(settings, demuxedStreamList, titleList, comboBoxTitle.SelectedIndex, m2tsList); plugin.Init(project); plugin.Process(); settings = new UserSettings(plugin.project.settings); titleList.Clear(); foreach (TitleInfo ti in plugin.project.titleList) { titleList.Add(new TitleInfo(ti)); } UpdateTitleList(); comboBoxTitle.SelectedIndex = plugin.project.titleIndex; demuxedStreamList = new TitleInfo(plugin.project.demuxedStreamList); m2tsList.Clear(); foreach (string s in plugin.project.m2tsList) { m2tsList.Add(s); } UpdateFromSettings(true); demuxedStreamsWindow.UpdateDemuxedStreams(); } } } catch (Exception) { } }
private void menuItemSettingsProfiles_Click(object sender, RoutedEventArgs e) { try { EditEncodingProfilesWindow epw = new EditEncodingProfilesWindow(settings); epw.ShowDialog(); if (epw.DialogResult == true) { settings = new UserSettings(epw.UserSettings); UpdateEncodingProfiles(); UpdateBitrate(); } } catch (Exception) { } }
private void menuItemSettingsAdvanced_Click(object sender, RoutedEventArgs e) { try { bool expert = false; if (menuItemViewExpertMode.IsChecked) expert = true; AdvancedOptionsWindow aow = new AdvancedOptionsWindow(settings, expert, pluginList); aow.ShowDialog(); if (aow.DialogResult == true) { settings = new UserSettings(aow.UserSettings); } } catch (Exception) { } }
private void menuItemViewReset_Click(object sender, RoutedEventArgs e) { try { UserSettings settings = new UserSettings(); this.Left = settings.bluripX; this.Top = settings.bluripY; this.Height = settings.bluripHeight; this.Width = settings.bluripWidth; logWindow.Left = settings.logX; logWindow.Top = settings.logY; logWindow.Width = settings.logWidth; logWindow.Height = settings.logHeight; menuItemViewLog.IsChecked = settings.showLog; demuxedStreamsWindow.Left = settings.demuxedStreamsX; demuxedStreamsWindow.Top = settings.demuxedStreamsY; demuxedStreamsWindow.Height = settings.demuxedStreamsHeight; demuxedStreamsWindow.Width = settings.demuxedStreamsWidth; menuItemViewDemuxedStreams.IsChecked = settings.showDemuxedStream; queueWindow.Left = settings.queueX; queueWindow.Top = settings.queueY; queueWindow.Height = settings.queueHeight; queueWindow.Width = settings.queueWidth; menuItemViewQueue.IsChecked = settings.showQueue; UpdateDiff(); menuItemViewLog_Click(null, null); menuItemViewDemuxedStreams_Click(null, null); menuItemViewQueue_Click(null, null); } catch (Exception) { } }
public SubtitleTool(UserSettings settings, string fps, ref StreamInfo si, bool onlyForced, bool lowRes, bool pgs) : base() { try { this.settings = settings; this.fps = fps; this.Path = settings.javaPath; this.si = new StreamInfo(); this.si = si; this.onlyForced = onlyForced; this.lowRes = lowRes; this.pgs = pgs; if (this.fps == "24.000") this.fps = "24"; if (this.fps == "25.000") this.fps = "25"; if (this.fps == "50.000") this.fps = "50"; string format = ".sub"; if (pgs) { format = ".sup"; } if (!lowRes) { if (!onlyForced) { output = settings.workingDir + "\\" + System.IO.Path.GetFileNameWithoutExtension(si.filename) + "_complete" + format; outputIdx = settings.workingDir + "\\" + System.IO.Path.GetFileNameWithoutExtension(si.filename) + "_complete.idx"; } else { output = settings.workingDir + "\\" + System.IO.Path.GetFileNameWithoutExtension(si.filename) + "_onlyforced" + format; outputIdx = settings.workingDir + "\\" + System.IO.Path.GetFileNameWithoutExtension(si.filename) + "_onlyforced.idx"; } } else { if (!onlyForced) { output = settings.workingDir + "\\" + System.IO.Path.GetFileNameWithoutExtension(si.filename) + "_complete_lowres.sub"; outputIdx = settings.workingDir + "\\" + System.IO.Path.GetFileNameWithoutExtension(si.filename) + "_complete_lowres.idx"; } else { output = settings.workingDir + "\\" + System.IO.Path.GetFileNameWithoutExtension(si.filename) + "_onlyforced_lowres.sub"; outputIdx = settings.workingDir + "\\" + System.IO.Path.GetFileNameWithoutExtension(si.filename) + "_onlyforced_lowres.idx"; } } this.Parameter = "-jar \"" + settings.sup2subPath + "\" \"" + si.filename + "\" \"" + output + "\" /fps:" + this.fps; if (!onlyForced) { } else { this.Parameter += " /forced"; } if (!lowRes) { if (!settings.resize720p) { this.Parameter += " /res:1080"; } else { this.Parameter += " /res:720"; } } else { this.Parameter += " /res:576"; } } catch (Exception) { } }
public AdvancedOptionsWindow(UserSettings settings, bool expert, List<PluginBase> pluginList) { try { InitializeComponent(); this.settings = new UserSettings(settings); this.pluginList = pluginList; textBoxNrFrames.Text = settings.nrFrames.ToString(); textBoxRowSum.Text = settings.blackValue.ToString(); checkBoxMinimizeAutocrop.IsChecked = settings.minimizeAutocrop; if (settings.cropMode > -1 && settings.cropMode < comboBoxCropMethod.Items.Count) { comboBoxCropMethod.SelectedIndex = settings.cropMode; } checkBoxManualCrop.IsChecked = settings.manualCrop; checkBoxDeleteDemuxedFiles.IsChecked = settings.deleteAfterEncode; checkBoxAlwaysDeleteIndex.IsChecked = settings.deleteIndex; checkBoxDisableAudioHeaderCompression.IsChecked = settings.disableAudioHeaderCompression; checkBoxDisableVideoHeaderCompression.IsChecked = settings.disableVideoHeaderCompression; checkBoxDisableSubtitleHeaderCompression.IsChecked = settings.disableSubtitleHeaderCompression; checkBoxUseAutoSelect.IsChecked = settings.useAutoSelect; checkBoxIncludeChapters.IsChecked = settings.includeChapter; checkBoxPreferDTS.IsChecked = settings.preferDTS; checkBoxIncludeSubtitles.IsChecked = settings.includeSubtitle; checkBoxDefaultAudioTrack.IsChecked = settings.defaultAudio; checkBoxDefaultSubtitleTrack.IsChecked = settings.defaultSubtitle; checkBoxDefaultSubtitleForced.IsChecked = settings.defaultSubtitleForced; checkBoxForcedSubtitleFlag.IsChecked = settings.defaultForcedFlag; checkBoxDefaultSubtitleForced_Checked(null, null); checkBoxDefaultSubtitleTrack_Checked(null, null); comboBoxProcessPriority.Items.Clear(); foreach (string s in Enum.GetNames(typeof(ProcessPriorityClass))) { comboBoxProcessPriority.Items.Add(s); } comboBoxDTSBitrate.Items.Clear(); foreach (string s in GlobalVars.dtsBitrates) { comboBoxDTSBitrate.Items.Add(s); } comboBoxAC3Bitrate.Items.Clear(); foreach (string s in GlobalVars.ac3Bitrates) { comboBoxAC3Bitrate.Items.Add(s); } checkBoxConvertDTSBitrate.IsChecked = settings.downmixDTS; checkBoxConvertAC3Bitrate.IsChecked = settings.downmixAc3; checkBoxConvertAC3Bitrate_Checked(null, null); checkBoxConvertDTSBitrate_Checked(null, null); if (settings.downmixDTSIndex > -1 && settings.downmixDTSIndex < GlobalVars.dtsBitrates.Count) comboBoxDTSBitrate.SelectedIndex = settings.downmixDTSIndex; if (settings.downmixAc3Index > -1 && settings.downmixAc3Index < GlobalVars.ac3Bitrates.Count) comboBoxAC3Bitrate.SelectedIndex = settings.downmixAc3Index; comboBoxResizeMethod.Items.Clear(); foreach (string s in GlobalVars.resizeMethods) comboBoxResizeMethod.Items.Add(s); if (settings.resizeMethod > -1 && settings.resizeMethod < GlobalVars.resizeMethods.Count) comboBoxResizeMethod.SelectedIndex = settings.resizeMethod; comboBoxProcessPriority.SelectedItem = Enum.GetName(typeof(ProcessPriorityClass), settings.x264Priority); UpdatePreferredAudio(); UpdatePreferredSub(); if (expert) { EnableExpert(); } else { DisableExpert(); } UpdatePlugins(); } catch (Exception ex) { Global.ErrorMsg(ex); } }
public UserSettings(UserSettings orig) { this.eac3toPath = orig.eac3toPath; this.lastBluRayPath = orig.lastBluRayPath; this.useAutoSelect = orig.useAutoSelect; this.includeChapter = orig.includeChapter; this.includeSubtitle = orig.includeSubtitle; this.preferDTS = orig.preferDTS; this.preferredAudioLanguages.Clear(); this.workingDir = orig.workingDir; this.encodedMovieDir = orig.encodedMovieDir; this.ffmsindexPath = orig.ffmsindexPath; this.x264Path = orig.x264Path; this.sup2subPath = orig.sup2subPath; this.nrFrames = orig.nrFrames; this.blackValue = orig.blackValue; this.filePrefix = orig.filePrefix; this.javaPath = orig.javaPath; this.cropMode = orig.cropMode; this.mkvmergePath = orig.mkvmergePath; this.x264Priority = orig.x264Priority; this.targetFolder = orig.targetFolder; this.targetFilename = orig.targetFilename; this.movieTitle = orig.movieTitle; this.defaultAudio = orig.defaultAudio; this.defaultSubtitle = orig.defaultSubtitle; this.defaultSubtitleForced = orig.defaultSubtitleForced; this.defaultForcedFlag = orig.defaultForcedFlag; this.lastProfile = orig.lastProfile; this.dtsHdCore = orig.dtsHdCore; this.untouchedVideo = orig.untouchedVideo; this.lastAvisynthProfile = orig.lastAvisynthProfile; this.resize720p = orig.resize720p; this.downmixAc3 = orig.downmixAc3; this.downmixAc3Index = orig.downmixAc3Index; this.downmixDTS = orig.downmixDTS; this.downmixDTSIndex = orig.downmixDTSIndex; this.minimizeAutocrop = orig.minimizeAutocrop; this.cropInput = orig.cropInput; this.encodeInput = orig.encodeInput; this.untouchedAudio = orig.untouchedAudio; this.muxSubs = orig.muxSubs; this.copySubs = orig.copySubs; this.dgindexnvPath = orig.dgindexnvPath; this.convertDtsToAc3 = orig.convertDtsToAc3; this.x264x64Path = orig.x264x64Path; this.avs2yuvPath = orig.avs2yuvPath; this.use64bit = orig.use64bit; this.muxLowResSubs = orig.muxLowResSubs; this.deleteIndex = orig.deleteIndex; this.muxUntouchedSubs = orig.muxUntouchedSubs; this.copyUntouchedSubs = orig.copyUntouchedSubs; this.deleteAfterEncode = orig.deleteAfterEncode; this.doDemux = orig.doDemux; this.doIndex = orig.doIndex; this.doSubtitle = orig.doSubtitle; this.doEncode = orig.doEncode; this.doMux = orig.doMux; this.suptitlePath = orig.suptitlePath; this.autoScroll = orig.autoScroll; this.disableAudioHeaderCompression = orig.disableAudioHeaderCompression; this.disableVideoHeaderCompression = orig.disableVideoHeaderCompression; this.disableSubtitleHeaderCompression = orig.disableSubtitleHeaderCompression; this.resizeMethod = orig.resizeMethod; this.manualCrop = orig.manualCrop; this.addAc3ToAllDts = orig.addAc3ToAllDts; this.snap = orig.snap; this.expertMode = orig.expertMode; this.showLog = orig.showLog; this.logX = orig.logX; this.logY = orig.logY; this.logHeight = orig.logHeight; this.logWidth = orig.logWidth; this.showDemuxedStream = orig.showDemuxedStream; this.demuxedStreamsX = orig.demuxedStreamsX; this.demuxedStreamsY = orig.demuxedStreamsY; this.demuxedStreamsHeight = orig.demuxedStreamsHeight; this.demuxedStreamsWidth = orig.demuxedStreamsWidth; this.showQueue = orig.showQueue; this.queueX = orig.queueX; this.queueY = orig.queueY; this.queueHeight = orig.queueHeight; this.queueWidth = orig.queueWidth; this.bluripX = orig.bluripX; this.bluripY = orig.bluripY; this.bluripHeight = orig.bluripHeight; this.bluripWidth = orig.bluripWidth; this.language = orig.language; this.skin = orig.skin; this.preferredAudioLanguages.Clear(); this.preferredSubtitleLanguages.Clear(); this.encodingSettings.Clear(); this.avisynthSettings.Clear(); foreach (LanguageInfo li in orig.preferredAudioLanguages) { this.preferredAudioLanguages.Add(new LanguageInfo(li)); } foreach (LanguageInfo li in orig.preferredSubtitleLanguages) { this.preferredSubtitleLanguages.Add(new LanguageInfo(li)); } foreach (EncodingSettings es in orig.encodingSettings) { this.encodingSettings.Add(new EncodingSettings(es)); } foreach (AvisynthSettings avs in orig.avisynthSettings) { this.avisynthSettings.Add(new AvisynthSettings(avs)); } }
public UserSettings(UserSettings orig) { this.eac3toPath = orig.eac3toPath; this.lastBluRayPath = orig.lastBluRayPath; this.useAutoSelect = orig.useAutoSelect; this.includeChapter = orig.includeChapter; this.includeSubtitle = orig.includeSubtitle; this.preferDTS = orig.preferDTS; this.preferredAudioLanguages.Clear(); this.workingDir = orig.workingDir; this.encodedMovieDir = orig.encodedMovieDir; this.ffmsindexPath = orig.ffmsindexPath; this.x264Path = orig.x264Path; this.sup2subPath = orig.sup2subPath; this.nrFrames = orig.nrFrames; this.blackValue = orig.blackValue; this.filePrefix = orig.filePrefix; this.javaPath = orig.javaPath; this.cropMode = orig.cropMode; this.mkvmergePath = orig.mkvmergePath; this.x264Priority = orig.x264Priority; this.targetFolder = orig.targetFolder; this.targetFilename = orig.targetFilename; this.movieTitle = orig.movieTitle; this.defaultAudio = orig.defaultAudio; this.defaultSubtitle = orig.defaultSubtitle; this.defaultSubtitleForced = orig.defaultSubtitleForced; this.defaultForcedFlag = orig.defaultForcedFlag; this.lastProfile = orig.lastProfile; this.dtsHdCore = orig.dtsHdCore; this.untouchedVideo = orig.untouchedVideo; this.lastAvisynthProfile = orig.lastAvisynthProfile; this.resize720p = orig.resize720p; this.downmixAc3 = orig.downmixAc3; this.downmixAc3Index = orig.downmixAc3Index; this.downmixDTS = orig.downmixDTS; this.downmixDTSIndex = orig.downmixDTSIndex; this.minimizeAutocrop = orig.minimizeAutocrop; this.cropInput = orig.cropInput; this.encodeInput = orig.encodeInput; this.untouchedAudio = orig.untouchedAudio; this.muxSubs = orig.muxSubs; this.copySubs = orig.copySubs; this.dgindexnvPath = orig.dgindexnvPath; this.convertDtsToAc3 = orig.convertDtsToAc3; this.x264x64Path = orig.x264x64Path; this.avs2yuvPath = orig.avs2yuvPath; this.use64bit = orig.use64bit; this.muxLowResSubs = orig.muxLowResSubs; this.deleteIndex = orig.deleteIndex; this.muxUntouchedSubs = orig.muxUntouchedSubs; this.copyUntouchedSubs = orig.copyUntouchedSubs; this.deleteAfterEncode = orig.deleteAfterEncode; this.doDemux = orig.doDemux; this.doIndex = orig.doIndex; this.doSubtitle = orig.doSubtitle; this.doEncode = orig.doEncode; this.doMux = orig.doMux; this.suptitlePath = orig.suptitlePath; this.autoScroll = orig.autoScroll; this.mvcsourcePath = orig.mvcsourcePath; this.lsmashPath = orig.lsmashPath; this.disableAudioHeaderCompression = orig.disableAudioHeaderCompression; this.disableVideoHeaderCompression = orig.disableVideoHeaderCompression; this.disableSubtitleHeaderCompression = orig.disableSubtitleHeaderCompression; this.resizeMethod = orig.resizeMethod; this.manualCrop = orig.manualCrop; this.addAc3ToAllDts = orig.addAc3ToAllDts; this.snap = orig.snap; this.expertMode = orig.expertMode; this.showLog = orig.showLog; this.logX = orig.logX; this.logY = orig.logY; this.logHeight = orig.logHeight; this.logWidth = orig.logWidth; this.showDemuxedStream = orig.showDemuxedStream; this.demuxedStreamsX = orig.demuxedStreamsX; this.demuxedStreamsY = orig.demuxedStreamsY; this.demuxedStreamsHeight = orig.demuxedStreamsHeight; this.demuxedStreamsWidth = orig.demuxedStreamsWidth; this.showQueue = orig.showQueue; this.queueX = orig.queueX; this.queueY = orig.queueY; this.queueHeight = orig.queueHeight; this.queueWidth = orig.queueWidth; this.bluripX = orig.bluripX; this.bluripY = orig.bluripY; this.bluripHeight = orig.bluripHeight; this.bluripWidth = orig.bluripWidth; this.language = orig.language; this.skin = orig.skin; this.preferredAudioLanguages.Clear(); this.preferredSubtitleLanguages.Clear(); this.encodingSettings.Clear(); this.avisynthSettings.Clear(); foreach (LanguageInfo li in orig.preferredAudioLanguages) { this.preferredAudioLanguages.Add(new LanguageInfo(li)); } foreach (LanguageInfo li in orig.preferredSubtitleLanguages) { this.preferredSubtitleLanguages.Add(new LanguageInfo(li)); } foreach (EncodingSettings es in orig.encodingSettings) { this.encodingSettings.Add(new EncodingSettings(es)); } foreach(AvisynthSettings avs in orig.avisynthSettings) { this.avisynthSettings.Add(new AvisynthSettings(avs)); } }
public static bool LoadSettingsFile(ref UserSettings settings, string filename) { MemoryStream ms = null; try { if (!File.Exists(filename)) { return(false); } byte[] data = File.ReadAllBytes(filename); XmlSerializer xs = new XmlSerializer(typeof(UserSettings)); ms = new MemoryStream(data); ms.Seek(0, SeekOrigin.Begin); settings = (UserSettings)xs.Deserialize(ms); ms.Close(); if (settings.preferredAudioLanguages.Count == 0) { //settings.preferredAudioLanguages.Add(new LanguageInfo("German", "Deutsch", "de")); settings.preferredAudioLanguages.Add(new LanguageInfo("English", "Englisch", "en")); } if (settings.preferredSubtitleLanguages.Count == 0) { //settings.preferredSubtitleLanguages.Add(new LanguageInfo("German", "Deutsch", "de")); settings.preferredSubtitleLanguages.Add(new LanguageInfo("English", "Englisch", "en")); } if (settings.encodingSettings.Count == 0) { settings.encodingSettings.Add(new EncodingSettings("Crf 18.0/tune film", 18.0)); settings.encodingSettings.Add(new EncodingSettings("Crf 19.0/tune film", 19.0)); settings.encodingSettings.Add(new EncodingSettings("Crf 20.0/tune film", 20.0)); settings.encodingSettings.Add(new EncodingSettings("Crf 18.0/tune animation", 18.0, 2, 1)); settings.encodingSettings.Add(new EncodingSettings("Crf 19.0/tune animation", 19.0, 2, 1)); settings.encodingSettings.Add(new EncodingSettings("Crf 20.0/tune animation", 20.0, 2, 1)); settings.encodingSettings.Add(new EncodingSettings("2-pass 8000kbps/tune film", 8000, SizeType.Bitrate, 1, 0)); settings.encodingSettings.Add(new EncodingSettings("2-pass 8000kbps/tune animation", 8000, SizeType.Bitrate, 2, 1)); settings.encodingSettings.Add(new EncodingSettings("2-pass 10000Mb/tune film", 10000, SizeType.Size, 1, 0)); settings.encodingSettings.Add(new EncodingSettings("2-pass 10000Mb/tune animation", 10000, SizeType.Size, 2, 1)); } if (settings.avisynthSettings.Count == 0) { settings.avisynthSettings.Add(new AvisynthSettings("Empty", "")); settings.avisynthSettings.Add(new AvisynthSettings("Undot", "# undot - remove minimal noise\r\nUndot()\r\n")); } return(true); } catch (Exception) { return(false); } finally { if (ms != null) { ms.Close(); } } }
public static bool SaveSettingsFile(UserSettings settings, string filename) { MemoryStream ms = null; FileStream fs = null; XmlSerializer xs = null; try { ms = new MemoryStream(); fs = new FileStream(filename, FileMode.Create, FileAccess.Write); xs = new XmlSerializer(typeof(UserSettings)); xs.Serialize(ms, settings); ms.Seek(0, SeekOrigin.Begin); fs.Write(ms.ToArray(), 0, (int)ms.Length); ms.Close(); fs.Close(); return true; } catch (Exception) { return false; } finally { if (ms != null) ms.Close(); if (fs != null) fs.Close(); } }
public AdvancedOptionsWindow(UserSettings settings, bool expert, List <PluginBase> pluginList) { try { InitializeComponent(); this.settings = new UserSettings(settings); this.pluginList = pluginList; textBoxNrFrames.Text = settings.nrFrames.ToString(); textBoxRowSum.Text = settings.blackValue.ToString(); checkBoxMinimizeAutocrop.IsChecked = settings.minimizeAutocrop; if (settings.cropMode > -1 && settings.cropMode < comboBoxCropMethod.Items.Count) { comboBoxCropMethod.SelectedIndex = settings.cropMode; } checkBoxManualCrop.IsChecked = settings.manualCrop; checkBoxDeleteDemuxedFiles.IsChecked = settings.deleteAfterEncode; checkBoxAlwaysDeleteIndex.IsChecked = settings.deleteIndex; checkBoxDisableAudioHeaderCompression.IsChecked = settings.disableAudioHeaderCompression; checkBoxDisableVideoHeaderCompression.IsChecked = settings.disableVideoHeaderCompression; checkBoxDisableSubtitleHeaderCompression.IsChecked = settings.disableSubtitleHeaderCompression; checkBoxUseAutoSelect.IsChecked = settings.useAutoSelect; checkBoxIncludeChapters.IsChecked = settings.includeChapter; checkBoxPreferDTS.IsChecked = settings.preferDTS; checkBoxIncludeSubtitles.IsChecked = settings.includeSubtitle; checkBoxDefaultAudioTrack.IsChecked = settings.defaultAudio; checkBoxDefaultSubtitleTrack.IsChecked = settings.defaultSubtitle; checkBoxDefaultSubtitleForced.IsChecked = settings.defaultSubtitleForced; checkBoxForcedSubtitleFlag.IsChecked = settings.defaultForcedFlag; checkBoxDefaultSubtitleForced_Checked(null, null); checkBoxDefaultSubtitleTrack_Checked(null, null); comboBoxProcessPriority.Items.Clear(); foreach (string s in Enum.GetNames(typeof(ProcessPriorityClass))) { comboBoxProcessPriority.Items.Add(s); } comboBoxDTSBitrate.Items.Clear(); foreach (string s in GlobalVars.dtsBitrates) { comboBoxDTSBitrate.Items.Add(s); } comboBoxAC3Bitrate.Items.Clear(); foreach (string s in GlobalVars.ac3Bitrates) { comboBoxAC3Bitrate.Items.Add(s); } checkBoxConvertDTSBitrate.IsChecked = settings.downmixDTS; checkBoxConvertAC3Bitrate.IsChecked = settings.downmixAc3; checkBoxConvertAC3Bitrate_Checked(null, null); checkBoxConvertDTSBitrate_Checked(null, null); if (settings.downmixDTSIndex > -1 && settings.downmixDTSIndex < GlobalVars.dtsBitrates.Count) { comboBoxDTSBitrate.SelectedIndex = settings.downmixDTSIndex; } if (settings.downmixAc3Index > -1 && settings.downmixAc3Index < GlobalVars.ac3Bitrates.Count) { comboBoxAC3Bitrate.SelectedIndex = settings.downmixAc3Index; } comboBoxResizeMethod.Items.Clear(); foreach (string s in GlobalVars.resizeMethods) { comboBoxResizeMethod.Items.Add(s); } if (settings.resizeMethod > -1 && settings.resizeMethod < GlobalVars.resizeMethods.Count) { comboBoxResizeMethod.SelectedIndex = settings.resizeMethod; } comboBoxProcessPriority.SelectedItem = Enum.GetName(typeof(ProcessPriorityClass), settings.x264Priority); UpdatePreferredAudio(); UpdatePreferredSub(); if (expert) { EnableExpert(); } else { DisableExpert(); } UpdatePlugins(); } catch (Exception ex) { Global.ErrorMsg(ex); } }
public SubtitleTool(UserSettings settings, string fps, ref StreamInfo si, bool onlyForced, bool lowRes, bool pgs) : base() { try { this.settings = settings; this.fps = fps; this.Path = settings.javaPath; this.si = new StreamInfo(); this.si = si; this.onlyForced = onlyForced; this.lowRes = lowRes; this.pgs = pgs; if (this.fps == "24.000") { this.fps = "24"; } if (this.fps == "25.000") { this.fps = "25"; } if (this.fps == "50.000") { this.fps = "50"; } string format = ".sub"; if (pgs) { format = ".sup"; } if (!lowRes) { if (!onlyForced) { output = settings.workingDir + "\\" + System.IO.Path.GetFileNameWithoutExtension(si.filename) + "_complete" + format; outputIdx = settings.workingDir + "\\" + System.IO.Path.GetFileNameWithoutExtension(si.filename) + "_complete.idx"; } else { output = settings.workingDir + "\\" + System.IO.Path.GetFileNameWithoutExtension(si.filename) + "_onlyforced" + format; outputIdx = settings.workingDir + "\\" + System.IO.Path.GetFileNameWithoutExtension(si.filename) + "_onlyforced.idx"; } } else { if (!onlyForced) { output = settings.workingDir + "\\" + System.IO.Path.GetFileNameWithoutExtension(si.filename) + "_complete_lowres.sub"; outputIdx = settings.workingDir + "\\" + System.IO.Path.GetFileNameWithoutExtension(si.filename) + "_complete_lowres.idx"; } else { output = settings.workingDir + "\\" + System.IO.Path.GetFileNameWithoutExtension(si.filename) + "_onlyforced_lowres.sub"; outputIdx = settings.workingDir + "\\" + System.IO.Path.GetFileNameWithoutExtension(si.filename) + "_onlyforced_lowres.idx"; } } this.Parameter = "-jar \"" + settings.sup2subPath + "\" \"" + si.filename + "\" \"" + output + "\" /fps:" + this.fps; if (!onlyForced) { } else { this.Parameter += " /forced"; } if (!lowRes) { if (!settings.resize720p) { this.Parameter += " /res:1080"; } else { this.Parameter += " /res:720"; } } else { this.Parameter += " /res:576"; } } catch (Exception) { } }
public void ProcessQueue() { try { silent = true; abort = false; foreach (Project project in projectQueue) { logWindow.ClearAll(); logWindow.MessageMain(Global.ResFormat("InfoQueueStart", (projectQueue.IndexOf(project) + 1), projectQueue.Count)); if (!abort) { logWindow.MessageMain(Global.ResFormat("InfoQueueProjectStart", project.settings.movieTitle)); settings = new UserSettings(project.settings); titleList.Clear(); foreach (TitleInfo ti in project.titleList) { titleList.Add(new TitleInfo(ti)); } UpdateTitleList(); comboBoxTitle.SelectedIndex = project.titleIndex; demuxedStreamList = new TitleInfo(project.demuxedStreamList); m2tsList.Clear(); foreach (string s in project.m2tsList) { m2tsList.Add(s); } UpdateFromSettings(true); demuxedStreamsWindow.UpdateDemuxedStreams(); StartAll(); } else { logWindow.MessageMain(Global.Res("InfoQueueCancel")); } logWindow.MessageMain(Global.Res("InfoQueueDone")); if (projectQueue.IndexOf(project) != projectQueue.Count - 1) { ShutdownWindow sw = new ShutdownWindow("CaptionShutdownWindowQueue", "LabelShutdownCounterQueue", 20); sw.ShowDialog(); if (sw.DialogResult == false) break; } } if (queueWindow.checkBoxQueueShutdown.IsChecked == true) { ShutdownWindow sw = new ShutdownWindow(); sw.ShowDialog(); if (sw.DialogResult == true) { System.Diagnostics.Process.Start("ShutDown", "-s -f"); } } } catch (Exception ex) { logWindow.MessageMain(Global.Res("ErrorException") + " " + ex.Message); } finally { silent = false; } }
public MuxTool(UserSettings settings, TitleInfo titleInfo) : base() { try { this.settings = settings; this.titleInfo = titleInfo; this.Path = settings.mkvmergePath; this.Parameter += "--title \"" + settings.movieTitle + "\" -o \"" + settings.targetFolder + "\\" + settings.targetFilename + ".mkv\" "; int trackId = 0; // video + chapter foreach (StreamInfo si in titleInfo.streams) { string lan = ""; if (settings.preferredAudioLanguages.Count > 0) { lan = settings.preferredAudioLanguages[0].languageShort; } if (si.streamType == StreamType.Chapter) { if (lan != "") { this.Parameter += "--chapter-language " + lan + " "; } this.Parameter += "--chapters \"" + si.filename + "\" "; } else if (si.streamType == StreamType.Video) { trackId++; if (settings.disableVideoHeaderCompression) { this.Parameter += headerCompression; } if (si.advancedOptions != null && si.advancedOptions.GetType() == typeof(AdvancedVideoOptions)) { avo = new AdvancedVideoOptions(si.advancedOptions); } if (avo != null && avo.manualAspectRatio) { this.Parameter += "--aspect-ratio 0:" + avo.aspectRatio + " "; } if (si.extraFileInfo != null && si.extraFileInfo.GetType() == typeof(VideoFileInfo)) { this.Parameter += "\"" + ((VideoFileInfo)si.extraFileInfo).encodedFile + "\" "; } } } // audio bool defaultSet = false; foreach (StreamInfo si in titleInfo.streams) { if (si.streamType == StreamType.Audio) { trackId++; string st = ""; st = getShortAudioLanguage(si.language); if (st != "") { this.Parameter += "--language 0" + ":" + st + " "; } if (settings.disableAudioHeaderCompression) { this.Parameter += headerCompression; } if (!settings.defaultSubtitle) { this.Parameter += "--default-track 0:no "; } if (settings.preferredAudioLanguages.Count > 0 && settings.preferredAudioLanguages[0].language == si.language) { if (!defaultSet) { if (settings.defaultAudio) { this.Parameter += "--default-track 0:yes "; } defaultSet = true; } } this.Parameter += "\"" + si.filename + "\" "; // add additional ac3 track if (si.advancedOptions != null && si.advancedOptions.GetType() == typeof(AdvancedAudioOptions)) { AdvancedAudioOptions aao = (AdvancedAudioOptions)si.advancedOptions; if (aao.additionalAc3Track && File.Exists(aao.additionalFilename)) { trackId++; if (st != "") { this.Parameter += "--language 0" + ":" + st + " "; } if (settings.disableAudioHeaderCompression) { this.Parameter += headerCompression; } this.Parameter += "\"" + aao.additionalFilename + "\" "; } } if (settings.addAc3ToAllDts) { // check if already added by advanced audiooptions bool ac3Added = false; if (si.advancedOptions != null && si.advancedOptions.GetType() == typeof(AdvancedAudioOptions) && ((AdvancedAudioOptions)si.advancedOptions).additionalAc3Track) { ac3Added = true; } if (!ac3Added) { if (si.advancedOptions != null && si.advancedOptions.GetType() == typeof(AdvancedAudioOptions)) { AdvancedAudioOptions aao = (AdvancedAudioOptions)si.advancedOptions; if (File.Exists(aao.additionalFilename)) { trackId++; if (st != "") { this.Parameter += "--language 0" + ":" + st + " "; } if (settings.disableAudioHeaderCompression) { this.Parameter += headerCompression; } this.Parameter += "\"" + aao.additionalFilename + "\" "; } } } } } } List <int> subsCount = new List <int>(); List <int> forcedSubsCount = new List <int>(); for (int i = 0; i < settings.preferredSubtitleLanguages.Count; i++) { subsCount.Add(0); forcedSubsCount.Add(0); } // hardcode subs? do not mux subtitles even if selected bool suptitle = false; foreach (StreamInfo si in titleInfo.streams) { if (si.streamType == StreamType.Subtitle) { if (si.advancedOptions != null && si.advancedOptions.GetType() == typeof(AdvancedSubtitleOptions)) { if (((AdvancedSubtitleOptions)si.advancedOptions).supTitle) { if (!suptitle) { suptitle = true; } } } } } if ((settings.muxSubs > 0 || settings.muxUntouchedSubs) && !suptitle) { // subtitle defaultSet = false; foreach (StreamInfo si in titleInfo.streams) { if (si.streamType == StreamType.Subtitle) { SubtitleFileInfo sfi = (SubtitleFileInfo)si.extraFileInfo; bool isForced = false; if (si.advancedOptions != null && si.advancedOptions.GetType() == typeof(AdvancedSubtitleOptions) && ((AdvancedSubtitleOptions)si.advancedOptions).isForced) { isForced = true; } bool mux = false; bool pgs = false; bool untouched = false; if (settings.muxUntouchedSubs) { if (!sfi.isSecond) { mux = true; untouched = true; } } else if (settings.muxSubs == 1) { mux = true; } else if (settings.muxSubs == 2) { if (sfi.forcedIdx != "") { mux = true; } } else if (settings.muxSubs == 3) { int lang = -1; for (int i = 0; i < settings.preferredSubtitleLanguages.Count; i++) { if (settings.preferredSubtitleLanguages[i].language == si.language) { lang = i; } } if (lang > -1) { if (sfi.normalIdx != "") { if (subsCount[lang] == 0) { mux = true; subsCount[lang]++; } } else if (sfi.forcedIdx != "") { if (forcedSubsCount[lang] == 0) { mux = true; forcedSubsCount[lang]++; } } } } else if (settings.muxSubs == 4) { mux = true; pgs = true; } else if (settings.muxSubs == 5) { if (sfi.forcedSup != "") { mux = true; pgs = true; } } else if (settings.muxSubs == 6) { int lang = -1; for (int i = 0; i < settings.preferredSubtitleLanguages.Count; i++) { if (settings.preferredSubtitleLanguages[i].language == si.language) { lang = i; } } if (lang > -1) { if (sfi.normalSup != "") { if (subsCount[lang] == 0) { mux = true; pgs = true; subsCount[lang]++; } } else if (sfi.forcedSup != "") { if (forcedSubsCount[lang] == 0) { mux = true; pgs = true; forcedSubsCount[lang]++; } } } } if (mux) { trackId++; string st = ""; st = getShortSubLanguage(si.language); if (st != "") { this.Parameter += "--language 0" + ":" + st + " "; } if (settings.preferredSubtitleLanguages.Count > 0 && settings.preferredSubtitleLanguages[0].language == si.language) { if (!defaultSet) { if (settings.defaultSubtitle) { if (!settings.defaultSubtitleForced) { this.Parameter += "--default-track 0:yes "; defaultSet = true; } else { if (hasForcedSub(si.language)) { if (!untouched && !pgs) { if (sfi.forcedIdx != "") { this.Parameter += "--default-track 0 "; if (settings.defaultForcedFlag) { this.Parameter += "--forced-track 0 "; } defaultSet = true; } } else if (!untouched && pgs) { if (sfi.forcedSup != "") { this.Parameter += "--default-track 0 "; if (settings.defaultForcedFlag) { this.Parameter += "--forced-track 0 "; } defaultSet = true; } } } } } } } if (!settings.defaultSubtitle) { this.Parameter += "--default-track 0:no "; } if (untouched) { if (si.filename != "") { this.Parameter += "\"" + si.filename + "\" "; } } else if (!settings.muxLowResSubs && !pgs) { if (sfi.normalIdx != "" && !isForced) { this.Parameter += "\"" + sfi.normalIdx + "\" "; } else if (sfi.forcedIdx != "") { this.Parameter += " --track-name 0:Forced "; this.Parameter += "\"" + sfi.forcedIdx + "\" "; } else if (sfi.normalIdx != "" && isForced) { this.Parameter += " --track-name 0:Forced "; this.Parameter += "\"" + sfi.normalIdx + "\" "; } } else if (!settings.muxLowResSubs && pgs) { if (sfi.normalSup != "" && !isForced) { this.Parameter += "\"" + sfi.normalSup + "\" "; } else if (sfi.forcedSup != "") { this.Parameter += " --track-name 0:Forced "; this.Parameter += "\"" + sfi.forcedSup + "\" "; } else if (sfi.normalSup != "") { this.Parameter += " --track-name 0:Forced "; this.Parameter += "\"" + sfi.normalSup + "\" "; } } else { if (sfi.normalIdxLowRes != "" && !isForced) { this.Parameter += "\"" + sfi.normalIdxLowRes + "\" "; } else if (sfi.forcedIdxLowRes != "") { this.Parameter += " --track-name 0:Forced "; this.Parameter += "\"" + sfi.forcedIdxLowRes + "\" "; } else if (sfi.normalIdxLowRes != "" && isForced) { this.Parameter += " --track-name 0:Forced "; this.Parameter += "\"" + sfi.normalIdxLowRes + "\" "; } } } } } } } catch (Exception ex) { Info("Exception: " + ex.Message); } }
private void menuItemSettingsExternalTools_Click(object sender, RoutedEventArgs e) { try { ExternalTools et = new ExternalTools(settings); et.ShowDialog(); if (et.DialogResult == true) { settings = new UserSettings(et.userSettings); } } catch (Exception) { } }
public MuxTool(UserSettings settings, TitleInfo titleInfo) : base() { try { this.settings = settings; this.titleInfo = titleInfo; this.Path = settings.mkvmergePath; this.Parameter += "--title \"" + settings.movieTitle + "\" -o \"" + settings.targetFolder + "\\" + settings.targetFilename + ".mkv\" "; int trackId = 0; // video + chapter foreach (StreamInfo si in titleInfo.streams) { string lan = ""; if (settings.preferredAudioLanguages.Count > 0) lan = settings.preferredAudioLanguages[0].languageShort; if (si.streamType == StreamType.Chapter) { if (lan != "") this.Parameter += "--chapter-language " + lan + " "; this.Parameter += "--chapters \"" + si.filename + "\" "; } else if (si.streamType == StreamType.Video) { trackId++; if (settings.disableVideoHeaderCompression) { this.Parameter += headerCompression; } if (si.advancedOptions != null && si.advancedOptions.GetType() == typeof(AdvancedVideoOptions)) { avo = new AdvancedVideoOptions(si.advancedOptions); } if (avo != null && avo.manualAspectRatio) { this.Parameter += "--aspect-ratio 0:" + avo.aspectRatio + " "; } if (si.extraFileInfo != null && si.extraFileInfo.GetType() == typeof(VideoFileInfo)) { this.Parameter += "\"" + ((VideoFileInfo)si.extraFileInfo).encodedFile + "\" "; } } } // audio bool defaultSet = false; foreach (StreamInfo si in titleInfo.streams) { if (si.streamType == StreamType.Audio) { trackId++; string st = ""; st = getShortAudioLanguage(si.language); if (st != "") this.Parameter += "--language 0" + ":" + st + " "; if (settings.disableAudioHeaderCompression) { this.Parameter += headerCompression; } if (!settings.defaultSubtitle) { this.Parameter += "--default-track 0:no "; } if (settings.preferredAudioLanguages.Count > 0 && settings.preferredAudioLanguages[0].language == si.language) { if (!defaultSet) { if (settings.defaultAudio) { this.Parameter += "--default-track 0:yes "; } defaultSet = true; } } this.Parameter += "\"" + si.filename + "\" "; // add additional ac3 track if (si.advancedOptions != null && si.advancedOptions.GetType() == typeof(AdvancedAudioOptions)) { AdvancedAudioOptions aao = (AdvancedAudioOptions)si.advancedOptions; if (aao.additionalAc3Track && File.Exists(aao.additionalFilename)) { trackId++; if (st != "") this.Parameter += "--language 0" + ":" + st + " "; if (settings.disableAudioHeaderCompression) { this.Parameter += headerCompression; } this.Parameter += "\"" + aao.additionalFilename + "\" "; } } if (settings.addAc3ToAllDts) { // check if already added by advanced audiooptions bool ac3Added = false; if (si.advancedOptions != null && si.advancedOptions.GetType() == typeof(AdvancedAudioOptions) && ((AdvancedAudioOptions)si.advancedOptions).additionalAc3Track) { ac3Added = true; } if (!ac3Added) { if (si.advancedOptions != null && si.advancedOptions.GetType() == typeof(AdvancedAudioOptions)) { AdvancedAudioOptions aao = (AdvancedAudioOptions)si.advancedOptions; if (File.Exists(aao.additionalFilename)) { trackId++; if (st != "") this.Parameter += "--language 0" + ":" + st + " "; if (settings.disableAudioHeaderCompression) { this.Parameter += headerCompression; } this.Parameter += "\"" + aao.additionalFilename + "\" "; } } } } } } List<int> subsCount = new List<int>(); List<int> forcedSubsCount = new List<int>(); for (int i = 0; i < settings.preferredSubtitleLanguages.Count; i++) { subsCount.Add(0); forcedSubsCount.Add(0); } // hardcode subs? do not mux subtitles even if selected bool suptitle = false; foreach (StreamInfo si in titleInfo.streams) { if (si.streamType == StreamType.Subtitle) { if (si.advancedOptions != null && si.advancedOptions.GetType() == typeof(AdvancedSubtitleOptions)) { if (((AdvancedSubtitleOptions)si.advancedOptions).supTitle) { if (!suptitle) { suptitle = true; } } } } } if ((settings.muxSubs > 0 || settings.muxUntouchedSubs) && !suptitle) { // subtitle defaultSet = false; foreach (StreamInfo si in titleInfo.streams) { if (si.streamType == StreamType.Subtitle) { SubtitleFileInfo sfi = (SubtitleFileInfo)si.extraFileInfo; bool isForced = false; if (si.advancedOptions != null && si.advancedOptions.GetType() == typeof(AdvancedSubtitleOptions) && ((AdvancedSubtitleOptions)si.advancedOptions).isForced) isForced = true; bool mux = false; bool pgs = false; bool untouched = false; if (settings.muxUntouchedSubs) { if (!sfi.isSecond) { mux = true; untouched = true; } } else if (settings.muxSubs == 1) { mux = true; } else if (settings.muxSubs == 2) { if (sfi.forcedIdx != "") mux = true; } else if (settings.muxSubs == 3) { int lang = -1; for (int i = 0; i < settings.preferredSubtitleLanguages.Count; i++) { if (settings.preferredSubtitleLanguages[i].language == si.language) lang = i; } if (lang > -1) { if (sfi.normalIdx != "") { if (subsCount[lang] == 0) { mux = true; subsCount[lang]++; } } else if (sfi.forcedIdx != "") { if (forcedSubsCount[lang] == 0) { mux = true; forcedSubsCount[lang]++; } } } } else if (settings.muxSubs == 4) { mux = true; pgs = true; } else if (settings.muxSubs == 5) { if (sfi.forcedSup != "") { mux = true; pgs = true; } } else if (settings.muxSubs == 6) { int lang = -1; for (int i = 0; i < settings.preferredSubtitleLanguages.Count; i++) { if (settings.preferredSubtitleLanguages[i].language == si.language) lang = i; } if (lang > -1) { if (sfi.normalSup != "") { if (subsCount[lang] == 0) { mux = true; pgs = true; subsCount[lang]++; } } else if (sfi.forcedSup != "") { if (forcedSubsCount[lang] == 0) { mux = true; pgs = true; forcedSubsCount[lang]++; } } } } if (mux) { trackId++; string st = ""; st = getShortSubLanguage(si.language); if (st != "") this.Parameter += "--language 0" + ":" + st + " "; if (settings.preferredSubtitleLanguages.Count > 0 && settings.preferredSubtitleLanguages[0].language == si.language) { if (!defaultSet) { if (settings.defaultSubtitle) { if (!settings.defaultSubtitleForced) { this.Parameter += "--default-track 0:yes "; defaultSet = true; } else { if (hasForcedSub(si.language)) { if (!untouched && !pgs) { if (sfi.forcedIdx != "") { this.Parameter += "--default-track 0 "; if (settings.defaultForcedFlag) { this.Parameter += "--forced-track 0 "; } defaultSet = true; } } else if (!untouched && pgs) { if (sfi.forcedSup != "") { this.Parameter += "--default-track 0 "; if (settings.defaultForcedFlag) { this.Parameter += "--forced-track 0 "; } defaultSet = true; } } } } } } } if (!settings.defaultSubtitle) { this.Parameter += "--default-track 0:no "; } if (untouched) { if (si.filename != "") { this.Parameter += "\"" + si.filename + "\" "; } } else if (!settings.muxLowResSubs && !pgs) { if (sfi.normalIdx != "" && !isForced) { this.Parameter += "\"" + sfi.normalIdx + "\" "; } else if (sfi.forcedIdx != "") { this.Parameter += " --track-name 0:Forced "; this.Parameter += "\"" + sfi.forcedIdx + "\" "; } else if (sfi.normalIdx != "" && isForced) { this.Parameter += " --track-name 0:Forced "; this.Parameter += "\"" + sfi.normalIdx + "\" "; } } else if (!settings.muxLowResSubs && pgs) { if (sfi.normalSup != "" && !isForced) { this.Parameter += "\"" + sfi.normalSup + "\" "; } else if (sfi.forcedSup != "") { this.Parameter += " --track-name 0:Forced "; this.Parameter += "\"" + sfi.forcedSup + "\" "; } else if (sfi.normalSup != "") { this.Parameter += " --track-name 0:Forced "; this.Parameter += "\"" + sfi.normalSup + "\" "; } } else { if (sfi.normalIdxLowRes != "" && !isForced) { this.Parameter += "\"" + sfi.normalIdxLowRes + "\" "; } else if (sfi.forcedIdxLowRes != "") { this.Parameter += " --track-name 0:Forced "; this.Parameter += "\"" + sfi.forcedIdxLowRes + "\" "; } else if (sfi.normalIdxLowRes != "" && isForced) { this.Parameter += " --track-name 0:Forced "; this.Parameter += "\"" + sfi.normalIdxLowRes + "\" "; } } } } } } } catch (Exception ex) { Info("Exception: " + ex.Message); } }
public EncodeTool(UserSettings settings, TitleInfo titleInfo, int profile, bool secondPass, VideoFileInfo vfi) : base() { try { this.settings = settings; this.secondPass = secondPass; this.Priority = settings.x264Priority; this.vfi = vfi; this.titleInfo = titleInfo; this.profile = profile; bool is2pass = settings.encodingSettings[profile].pass2; if (settings.encodingSettings[profile].pass2) { if (settings.encodingSettings[profile].sizeType == SizeType.Bitrate) { bitrate = (int)settings.encodingSettings[profile].sizeValue; } else if (settings.encodingSettings[profile].sizeType == SizeType.Size) { try { length = Convert.ToInt32(vfi.length); length = (int)(length / 1000); } catch (Exception) { } try { frames = Convert.ToInt32(vfi.frames); } catch (Exception) { } // use frame count to calculate overhead // to be done... totalSize = GetSize(); targetSize = Convert.ToInt64(settings.encodingSettings[profile].sizeValue * 1024.0 * 1024.0); bitrate = (int)((targetSize - totalSize) / 1024 / length); //kbyte/s bitrate *= 8; //kbit/s // no mkv overhead used yet } } string outdir = settings.workingDir; if (settings.encodedMovieDir != "") outdir = settings.encodedMovieDir; string statsFile = outdir + "\\" + settings.filePrefix + "_stats"; if (!secondPass) { if (!settings.encodingSettings[profile].pass2) { if (!settings.use64bit) { this.Path = settings.x264Path; this.Parameter = settings.encodingSettings[profile].GetParam + " \"" + vfi.encodeAvs + "\" -o \"" + outdir + "\\" + settings.filePrefix + "_video.mkv\""; } else { this.Path = "cmd.exe"; this.Parameter = "/c \"\"" + settings.avs2yuvPath + "\" -raw \"" + vfi.encodeAvs + "\" -o - | \"" + settings.x264x64Path + "\" " + settings.encodingSettings[profile].GetParam + " --fps " + vfi.fps + " " + " -o \"" + outdir + "\\" + settings.filePrefix + "_video.mkv\"" + " --input-res " + vfi.cropInfo.resizeX + "x" + vfi.cropInfo.resizeY + "\" -"; } } else { if (!settings.use64bit) { this.Path = settings.x264Path; this.Parameter = string.Format(settings.encodingSettings[profile].GetParam, bitrate, statsFile) + " \"" + vfi.encodeAvs + "\" -o NUL"; } else { this.Path = "cmd.exe"; this.Parameter = "/c \"\"" + settings.avs2yuvPath + "\" -raw \"" + vfi.encodeAvs + "\" -o - | \"" + settings.x264x64Path + "\" " + string.Format(settings.encodingSettings[profile].GetParam, bitrate, statsFile) + " --fps " + vfi.fps + " -o NUL" + " --input-res " + vfi.cropInfo.resizeX + "x" + vfi.cropInfo.resizeY + "\" -"; } } } else { if (!settings.use64bit) { this.Path = settings.x264Path; this.Parameter = string.Format(settings.encodingSettings[profile].GetSecondParam, bitrate, statsFile) + " \"" + vfi.encodeAvs + "\" -o \"" + outdir + "\\" + settings.filePrefix + "_video.mkv\""; } else { this.Path = "cmd.exe"; this.Parameter = "/c \"\"" + settings.avs2yuvPath + "\" -raw \"" + vfi.encodeAvs + "\" -o - | \"" + settings.x264x64Path + "\" " + string.Format(settings.encodingSettings[profile].GetSecondParam, bitrate, statsFile) + " --fps " + vfi.fps + " -o \"" + outdir + "\\" + settings.filePrefix + "_video.mkv\"" + " --input-res " + vfi.cropInfo.resizeX + "x" + vfi.cropInfo.resizeY + "\" -"; } } } catch (Exception) { } }
public static bool LoadSettingsFile(ref UserSettings settings, string filename) { MemoryStream ms = null; try { if (!File.Exists(filename)) return false; byte[] data = File.ReadAllBytes(filename); XmlSerializer xs = new XmlSerializer(typeof(UserSettings)); ms = new MemoryStream(data); ms.Seek(0, SeekOrigin.Begin); settings = (UserSettings)xs.Deserialize(ms); ms.Close(); if (settings.preferredAudioLanguages.Count == 0) { //settings.preferredAudioLanguages.Add(new LanguageInfo("German", "Deutsch", "de")); settings.preferredAudioLanguages.Add(new LanguageInfo("English","Englisch","en")); } if (settings.preferredSubtitleLanguages.Count == 0) { //settings.preferredSubtitleLanguages.Add(new LanguageInfo("German", "Deutsch", "de")); settings.preferredSubtitleLanguages.Add(new LanguageInfo("English", "Englisch", "en")); } if(settings.encodingSettings.Count == 0) { settings.encodingSettings.Add(new EncodingSettings("Crf 18.0/tune film",18.0)); settings.encodingSettings.Add(new EncodingSettings("Crf 19.0/tune film", 19.0)); settings.encodingSettings.Add(new EncodingSettings("Crf 20.0/tune film", 20.0)); settings.encodingSettings.Add(new EncodingSettings("Crf 18.0/tune animation", 18.0, 2, 1)); settings.encodingSettings.Add(new EncodingSettings("Crf 19.0/tune animation", 19.0, 2, 1)); settings.encodingSettings.Add(new EncodingSettings("Crf 20.0/tune animation", 20.0, 2, 1)); settings.encodingSettings.Add(new EncodingSettings("2-pass 8000kbps/tune film", 8000, SizeType.Bitrate, 1, 0)); settings.encodingSettings.Add(new EncodingSettings("2-pass 8000kbps/tune animation", 8000, SizeType.Bitrate, 2, 1)); settings.encodingSettings.Add(new EncodingSettings("2-pass 10000Mb/tune film", 10000, SizeType.Size, 1, 0)); settings.encodingSettings.Add(new EncodingSettings("2-pass 10000Mb/tune animation", 10000, SizeType.Size, 2, 1)); } if (settings.avisynthSettings.Count == 0) { settings.avisynthSettings.Add(new AvisynthSettings("Empty", "")); settings.avisynthSettings.Add(new AvisynthSettings("Undot", "# undot - remove minimal noise\r\nUndot()\r\n")); } return true; } catch (Exception) { return false; } finally { if (ms != null) ms.Close(); } }