private void queueVideoButton_Click(object sender, System.EventArgs e) { fileType_SelectedIndexChanged(sender, e); // to select always correct output file extension string settingsError = verifyVideoSettings(); // basic input, logfile and output file settings are okay if (settingsError != null) { MessageBox.Show(settingsError, "Unsupported configuration", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } VideoCodecSettings vSettings = this.CurrentSettings.Clone(); string videoOutput = info.VideoOutput; if ((MainForm.Instance.Settings.UseExternalMuxerX264 || fileType.Text.Equals("MP4")) && (!fileType.Text.StartsWith("RAW") && vSettings.SettingsID.StartsWith("x26"))) { if (vSettings.SettingsID.Equals("x264")) { videoOutput = Path.ChangeExtension(videoOutput, "264"); } else if (vSettings.SettingsID.Equals("x265")) { videoOutput = Path.ChangeExtension(videoOutput, "hevc"); } } JobChain prepareJobs = mainForm.JobUtil.AddVideoJobs(info.VideoInput, videoOutput, this.CurrentSettings.Clone(), info.IntroEndFrame, info.CreditsStartFrame, info.DAR, PrerenderJob, true, info.Zones); if ((MainForm.Instance.Settings.UseExternalMuxerX264 || fileType.Text.Equals("MP4")) && (!fileType.Text.StartsWith("RAW") && vSettings.SettingsID.StartsWith("x26"))) { // create job MuxJob mJob = new MuxJob(); mJob.Input = videoOutput; if (fileType.Text.Equals("MKV")) { mJob.MuxType = MuxerType.MKVMERGE; mJob.Output = Path.ChangeExtension(videoOutput, "mkv"); } else { mJob.MuxType = MuxerType.MP4BOX; mJob.Output = Path.ChangeExtension(videoOutput, "mp4"); } mJob.Settings.MuxAll = true; mJob.Settings.Framerate = decimal.Round((decimal)FrameRate, 3, MidpointRounding.AwayFromZero); mJob.Settings.MuxedInput = mJob.Input; mJob.Settings.MuxedOutput = mJob.Output; mJob.FilesToDelete.Add(videoOutput); // add job to queue prepareJobs = new SequentialChain(prepareJobs, new SequentialChain(mJob)); } mainForm.Jobs.addJobsWithDependencies(prepareJobs, true); }
protected override void RunInThread() { JobChain c = null; List <string> intermediateFiles = new List <string>(); bool bError = false; try { log.LogEvent("Processing thread started"); su.Status = "Preprocessing... ***PLEASE WAIT***"; su.ResetTime(); List <string> arrAudioFilesDelete = new List <string>(); audioFiles = new Dictionary <int, string>(); List <AudioTrackInfo> arrAudioTracks = new List <AudioTrackInfo>(); List <AudioJob> arrAudioJobs = new List <AudioJob>(); List <MuxStream> arrMuxStreams = new List <MuxStream>(); FileUtil.ensureDirectoryExists(job.PostprocessingProperties.WorkingDirectory); // audio handling foreach (OneClickAudioTrack oAudioTrack in job.PostprocessingProperties.AudioTracks) { if (IsJobStopped()) { return; } if (oAudioTrack.AudioTrackInfo != null) { if (oAudioTrack.AudioTrackInfo.ExtractMKVTrack) { if (job.PostprocessingProperties.ApplyDelayCorrection && File.Exists(job.PostprocessingProperties.IntermediateMKVFile)) { MediaInfoFile oFile = new MediaInfoFile(job.PostprocessingProperties.IntermediateMKVFile, ref log); bool bFound = false; foreach (AudioTrackInfo oAudioInfo in oFile.AudioInfo.Tracks) { if (oAudioInfo.MMGTrackID == oAudioTrack.AudioTrackInfo.MMGTrackID) { bFound = true; } } int mmgTrackID = 0; if (!bFound) { mmgTrackID = oFile.AudioInfo.Tracks[oAudioTrack.AudioTrackInfo.TrackIndex].MMGTrackID; } else { mmgTrackID = oAudioTrack.AudioTrackInfo.MMGTrackID; } foreach (AudioTrackInfo oAudioInfo in oFile.AudioInfo.Tracks) { if (oAudioInfo.MMGTrackID == mmgTrackID) { if (oAudioTrack.DirectMuxAudio != null) { oAudioTrack.DirectMuxAudio.delay = oAudioInfo.Delay; } if (oAudioTrack.AudioJob != null) { oAudioTrack.AudioJob.Delay = oAudioInfo.Delay; } break; } } } if (!audioFiles.ContainsKey(oAudioTrack.AudioTrackInfo.TrackID)) { audioFiles.Add(oAudioTrack.AudioTrackInfo.TrackID, job.PostprocessingProperties.WorkingDirectory + "\\" + oAudioTrack.AudioTrackInfo.DemuxFileName); arrAudioFilesDelete.Add(job.PostprocessingProperties.WorkingDirectory + "\\" + oAudioTrack.AudioTrackInfo.DemuxFileName); } } else { arrAudioTracks.Add(oAudioTrack.AudioTrackInfo); } } if (oAudioTrack.AudioJob != null) { if (job.PostprocessingProperties.IndexType == FileIndexerWindow.IndexType.NONE && String.IsNullOrEmpty(oAudioTrack.AudioJob.Input)) { oAudioTrack.AudioJob.Input = job.Input; } arrAudioJobs.Add(oAudioTrack.AudioJob); } if (oAudioTrack.DirectMuxAudio != null) { arrMuxStreams.Add(oAudioTrack.DirectMuxAudio); } } if (audioFiles.Count == 0 && !job.PostprocessingProperties.Eac3toDemux && job.PostprocessingProperties.IndexType != FileIndexerWindow.IndexType.NONE && job.PostprocessingProperties.IndexType != FileIndexerWindow.IndexType.AVISOURCE) { if ((job.PostprocessingProperties.IndexType == FileIndexerWindow.IndexType.DGI || job.PostprocessingProperties.IndexType == FileIndexerWindow.IndexType.DGM) && File.Exists(Path.ChangeExtension(job.IndexFile, ".log"))) { job.PostprocessingProperties.FilesToDelete.Add(Path.ChangeExtension(job.IndexFile, ".log")); audioFiles = AudioUtil.GetAllDemuxedAudioFromDGI(arrAudioTracks, out arrAudioFilesDelete, job.IndexFile, log); } else { audioFiles = VideoUtil.getAllDemuxedAudio(arrAudioTracks, new List <AudioTrackInfo>(), out arrAudioFilesDelete, job.IndexFile, log); } } FillInAudioInformation(ref arrAudioJobs, arrMuxStreams); if (!String.IsNullOrEmpty(job.PostprocessingProperties.VideoFileToMux)) { log.LogEvent("Don't encode video: True"); } else { log.LogEvent("Desired size: " + job.PostprocessingProperties.OutputSize); } log.LogEvent("Split size: " + job.PostprocessingProperties.Splitting); if (IsJobStopped()) { return; } // video file handling string avsFile = String.Empty; VideoStream myVideo = new VideoStream(); VideoCodecSettings videoSettings = job.PostprocessingProperties.VideoSettings; if (String.IsNullOrEmpty(job.PostprocessingProperties.VideoFileToMux)) { //Open the video try { avsFile = CreateAVSFile(job.IndexFile, job.Input, job.PostprocessingProperties.DAR, job.PostprocessingProperties.HorizontalOutputResolution, log, job.PostprocessingProperties.AvsSettings, job.PostprocessingProperties.AutoDeinterlace, videoSettings, job.PostprocessingProperties.AutoCrop, job.PostprocessingProperties.KeepInputResolution, job.PostprocessingProperties.UseChaptersMarks); } catch (Exception ex) { log.LogValue("An error occurred creating the AVS file", ex, ImageType.Error); } if (IsJobStopped()) { return; } if (!String.IsNullOrEmpty(avsFile)) { // check AVS file JobUtil.GetInputProperties(avsFile, out ulong frameCount, out double frameRate); myVideo.Input = avsFile; myVideo.Output = Path.Combine(job.PostprocessingProperties.WorkingDirectory, Path.GetFileNameWithoutExtension(job.Input) + "_Video"); myVideo.NumberOfFrames = frameCount; myVideo.Framerate = (decimal)frameRate; myVideo.VideoType = new MuxableType((new VideoEncoderProvider().GetSupportedOutput(videoSettings.EncoderType))[0], videoSettings.Codec); myVideo.Settings = videoSettings; } else { bError = true; } } else { myVideo.DAR = job.PostprocessingProperties.ForcedDAR; myVideo.Output = job.PostprocessingProperties.VideoFileToMux; MediaInfoFile oInfo = new MediaInfoFile(myVideo.Output, ref log); if (Path.GetExtension(job.PostprocessingProperties.VideoFileToMux).Equals(".unknown") && !String.IsNullOrEmpty(oInfo.ContainerFileTypeString)) { job.PostprocessingProperties.VideoFileToMux = Path.ChangeExtension(job.PostprocessingProperties.VideoFileToMux, oInfo.ContainerFileTypeString.ToLowerInvariant()); File.Move(myVideo.Output, job.PostprocessingProperties.VideoFileToMux); myVideo.Output = job.PostprocessingProperties.VideoFileToMux; job.PostprocessingProperties.FilesToDelete.Add(myVideo.Output); } myVideo.Settings = videoSettings; myVideo.Framerate = (decimal)oInfo.VideoInfo.FPS; myVideo.NumberOfFrames = oInfo.VideoInfo.FrameCount; } if (IsJobStopped()) { return; } intermediateFiles.Add(avsFile); intermediateFiles.Add(job.IndexFile); intermediateFiles.AddRange(audioFiles.Values); foreach (string file in arrAudioFilesDelete) { intermediateFiles.Add(file); } intermediateFiles.Add(Path.ChangeExtension(job.Input, ".log")); foreach (string file in job.PostprocessingProperties.FilesToDelete) { intermediateFiles.Add(file); } // subtitle handling List <MuxStream> subtitles = new List <MuxStream>(); if (job.PostprocessingProperties.SubtitleTracks.Count > 0) { foreach (OneClickStream oTrack in job.PostprocessingProperties.SubtitleTracks) { if (oTrack.TrackInfo.ExtractMKVTrack) { //demuxed MKV string trackFile = Path.GetDirectoryName(job.IndexFile) + "\\" + oTrack.TrackInfo.DemuxFileName; if (File.Exists(trackFile)) { intermediateFiles.Add(trackFile); if (Path.GetExtension(trackFile).ToLowerInvariant().Equals(".idx")) { intermediateFiles.Add(FileUtil.GetPathWithoutExtension(trackFile) + ".sub"); } subtitles.Add(new MuxStream(trackFile, oTrack.Language, oTrack.Name, oTrack.Delay, oTrack.DefaultStream, oTrack.ForcedStream, null)); } else { log.LogEvent("Ignoring subtitle as the it cannot be found: " + trackFile, ImageType.Warning); } } else { // sometimes the language is detected differently by vsrip and the IFO parser. Therefore search also for other files string strDemuxFile = oTrack.DemuxFilePath; if (!File.Exists(strDemuxFile) && Path.GetFileNameWithoutExtension(strDemuxFile).Contains("_")) { string strDemuxFileName = Path.GetFileNameWithoutExtension(strDemuxFile); strDemuxFileName = strDemuxFileName.Substring(0, strDemuxFileName.LastIndexOf("_")) + "_*" + Path.GetExtension(strDemuxFile); foreach (string strFileName in Directory.GetFiles(Path.GetDirectoryName(strDemuxFile), strDemuxFileName)) { strDemuxFile = Path.Combine(Path.GetDirectoryName(strDemuxFile), strFileName); intermediateFiles.Add(strDemuxFile); intermediateFiles.Add(Path.ChangeExtension(strDemuxFile, ".sub")); log.LogEvent("Subtitle + " + oTrack.DemuxFilePath + " cannot be found. " + strFileName + " will be used instead", ImageType.Information); break; } } if (File.Exists(strDemuxFile)) { string strTrackName = oTrack.Name; // check if a forced stream is available string strForcedFile = Path.Combine(Path.GetDirectoryName(strDemuxFile), Path.GetFileNameWithoutExtension(strDemuxFile) + "_forced.idx"); if (File.Exists(strForcedFile)) { subtitles.Add(new MuxStream(strForcedFile, oTrack.Language, SubtitleUtil.ApplyForcedStringToTrackName(true, oTrack.Name), oTrack.Delay, oTrack.DefaultStream, true, null)); intermediateFiles.Add(strForcedFile); intermediateFiles.Add(Path.ChangeExtension(strForcedFile, ".sub")); } subtitles.Add(new MuxStream(strDemuxFile, oTrack.Language, SubtitleUtil.ApplyForcedStringToTrackName(false, oTrack.Name), oTrack.Delay, oTrack.DefaultStream, (File.Exists(strForcedFile) ? false : oTrack.ForcedStream), null)); } else { log.LogEvent("Ignoring subtitle as the it cannot be found: " + oTrack.DemuxFilePath, ImageType.Warning); } } } } if (IsJobStopped()) { return; } if (!bError) { c = VideoUtil.GenerateJobSeries(myVideo, job.PostprocessingProperties.FinalOutput, arrAudioJobs.ToArray(), subtitles.ToArray(), job.PostprocessingProperties.Attachments, job.PostprocessingProperties.TimeStampFile, job.PostprocessingProperties.ChapterInfo, job.PostprocessingProperties.OutputSize, job.PostprocessingProperties.Splitting, job.PostprocessingProperties.Container, job.PostprocessingProperties.PrerenderJob, arrMuxStreams.ToArray(), log, job.PostprocessingProperties.DeviceOutputType, null, job.PostprocessingProperties.VideoFileToMux, job.PostprocessingProperties.AudioTracks.ToArray(), true); } if (c != null && !String.IsNullOrEmpty(job.PostprocessingProperties.TimeStampFile) && c.Jobs[c.Jobs.Length - 1].Job is MuxJob && (c.Jobs[c.Jobs.Length - 1].Job as MuxJob).MuxType == MuxerType.MP4BOX) { // last job is a mp4box job and vfr timecode data has to be applied MP4FpsModJob mp4FpsMod = new MP4FpsModJob(((MuxJob)c.Jobs[c.Jobs.Length - 1].Job).Output, job.PostprocessingProperties.TimeStampFile); c = new SequentialChain(c, new SequentialChain(mp4FpsMod)); } } catch (Exception e) { log.LogValue("An error occurred", e, ImageType.Error); bError = true; } if (c == null || bError) { log.Error("Job creation aborted"); su.HasError = true; } // add cleanup job also in case of an error c = CleanupJob.AddAfter(c, intermediateFiles, job.PostprocessingProperties.FinalOutput); MainForm.Instance.Jobs.AddJobsWithDependencies(c, false); // batch processing other input files if necessary if (job.PostprocessingProperties.FilesToProcess.Count > 0) { OneClickWindow ocw = new OneClickWindow(); ocw.setBatchProcessing(job.PostprocessingProperties.FilesToProcess, job.PostprocessingProperties.OneClickSetting); } su.IsComplete = true; }
/// <summary> /// creates a project /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void queueButton_Click(object sender, System.EventArgs e) { if (dialogMode) { return; } if (!configured) { MessageBox.Show("You must select the input and output file to continue", "Configuration incomplete", MessageBoxButtons.OK); return; } if (!Drives.ableToWriteOnThisDrive(Path.GetPathRoot(output.Filename))) { MessageBox.Show("MeGUI cannot write on the disc " + Path.GetPathRoot(output.Filename) + "\n" + "Please, select another output path to save your project...", "Configuration Incomplete", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } JobChain prepareJobs = null; string videoInput = input.Filename; // create pgcdemux job if needed if (Path.GetExtension(input.Filename).ToUpperInvariant().Equals(".IFO")) { if (iFile.VideoInfo.PGCCount > 1 || iFile.VideoInfo.AngleCount > 0) { // pgcdemux must be used as either multiple PGCs or a multi-angle disc are found string tempFile = Path.Combine(Path.GetDirectoryName(output.Filename), Path.GetFileNameWithoutExtension(output.Filename) + "_1.VOB"); prepareJobs = new SequentialChain(new PgcDemuxJob(videoInput, tempFile, iFile.VideoInfo.PGCNumber, iFile.VideoInfo.AngleNumber)); videoInput = tempFile; string filesToOverwrite = string.Empty; for (int i = 1; i < 10; i++) { string file = Path.Combine(Path.GetDirectoryName(output.Filename), Path.GetFileNameWithoutExtension(output.Filename) + "_" + i + ".VOB"); if (File.Exists(file)) { filesToOverwrite += file + "\n"; } } if (!String.IsNullOrEmpty(filesToOverwrite)) { DialogResult dr = MessageBox.Show("The pgc demux files already exist: \n" + filesToOverwrite + "\n" + "Do you want to overwrite these files?", "Configuration Incomplete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dr == DialogResult.No) { return; } } } else { // change from _0.IFO to _1.VOB for the indexer videoInput = input.Filename.Substring(0, input.Filename.Length - 5) + "1.VOB"; if (!File.Exists(videoInput)) { MessageBox.Show("The file following file cannot be found: \n" + videoInput, "Configuration Incomplete", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } } else if (Path.GetExtension(input.Filename).ToUpperInvariant().Equals(".MPLS") && IndexerUsed != IndexType.DGI && IndexerUsed != IndexType.DGM) { // blu-ray playlist without DGI/DGM used - therefore eac3to must be used first string strTempMKVFile = Path.Combine(Path.GetDirectoryName(output.Filename), Path.GetFileNameWithoutExtension(output.Filename) + ".mkv"); if (File.Exists(strTempMKVFile)) { DialogResult dr = MessageBox.Show("The demux file already exist: \n" + strTempMKVFile + "\n" + "Do you want to overwrite this file?", "Configuration Incomplete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dr == DialogResult.No) { return; } } StringBuilder sb = new StringBuilder(); sb.Append(string.Format("{0}:\"{1}\" ", iFile.VideoInfo.Track.TrackID, strTempMKVFile)); foreach (AudioTrackInfo oStreamControl in AudioTracks.CheckedItems) { bool bCoreOnly = false; AudioCodec audioCodec = oStreamControl.AudioCodec; if (oStreamControl.HasCore && !MainForm.Instance.Settings.Eac3toDefaultToHD) { // audio file can be demuxed && should be touched (core needed) if (audioCodec == AudioCodec.THDAC3) { oStreamControl.Codec = "AC-3"; oStreamControl.AudioType = AudioType.AC3; oStreamControl.AudioCodec = AudioCodec.AC3; bCoreOnly = true; oStreamControl.HasCore = false; } else if (audioCodec == AudioCodec.DTS) { oStreamControl.Codec = "DTS"; oStreamControl.AudioType = AudioType.DTS; oStreamControl.AudioCodec = AudioCodec.DTS; oStreamControl.HasCore = false; bCoreOnly = true; } } // core must be extracted (workaround for an eac3to issue) // http://bugs.madshi.net/view.php?id=450 if (audioCodec == AudioCodec.EAC3) { bCoreOnly = true; } string strSourceFileName = Path.Combine(Path.GetDirectoryName(input.Filename), Path.GetFileNameWithoutExtension(strTempMKVFile)); oStreamControl.SourceFileName = strSourceFileName; sb.Append(string.Format("{0}:\"{1}\" ", oStreamControl.TrackID, Path.Combine(Path.GetDirectoryName(output.Filename), oStreamControl.DemuxFileName))); if (bCoreOnly) { sb.Append("-core "); } } HDStreamsExJob oJob = new HDStreamsExJob(new List <string>() { input.Filename }, Path.GetDirectoryName(output.Filename), null, sb.ToString(), 2); prepareJobs = new SequentialChain(oJob); videoInput = strTempMKVFile; } switch (IndexerUsed) { case IndexType.D2V: { prepareJobs = new SequentialChain(prepareJobs, new SequentialChain(generateD2VIndexJob(videoInput))); MainForm.Instance.Jobs.AddJobsWithDependencies(prepareJobs, true); if (this.closeOnQueue.Checked) { this.Close(); } break; } case IndexType.DGI: { prepareJobs = new SequentialChain(prepareJobs, new SequentialChain(generateDGNVIndexJob(videoInput))); MainForm.Instance.Jobs.AddJobsWithDependencies(prepareJobs, true); if (this.closeOnQueue.Checked) { this.Close(); } break; } case IndexType.DGM: { prepareJobs = new SequentialChain(prepareJobs, new SequentialChain(generateDGMIndexJob(videoInput))); MainForm.Instance.Jobs.AddJobsWithDependencies(prepareJobs, true); if (this.closeOnQueue.Checked) { this.Close(); } break; } case IndexType.FFMS: { FFMSIndexJob job = generateFFMSIndexJob(videoInput); if (job.DemuxMode > 0 && job.AudioTracks.Count > 0 && (txtContainerInformation.Text.Trim().ToUpperInvariant().Equals("MATROSKA") || txtContainerInformation.Text.Trim().ToUpperInvariant().Equals("BLU-RAY PLAYLIST"))) { job.DemuxMode = 0; job.AudioTracksDemux = job.AudioTracks; job.AudioTracks = new List <AudioTrackInfo>(); if (txtContainerInformation.Text.Trim().ToUpperInvariant().Equals("MATROSKA")) { MkvExtractJob extractJob = new MkvExtractJob(videoInput, Path.GetDirectoryName(this.output.Filename), job.AudioTracksDemux); prepareJobs = new SequentialChain(prepareJobs, new SequentialChain(extractJob)); } } prepareJobs = new SequentialChain(prepareJobs, new SequentialChain(job)); MainForm.Instance.Jobs.AddJobsWithDependencies(prepareJobs, true); if (this.closeOnQueue.Checked) { this.Close(); } break; } case IndexType.LSMASH: { LSMASHIndexJob job = generateLSMASHIndexJob(videoInput); if (job.DemuxMode > 0 && job.AudioTracks.Count > 0 && (txtContainerInformation.Text.Trim().ToUpperInvariant().Equals("MATROSKA") || txtContainerInformation.Text.Trim().ToUpperInvariant().Equals("BLU-RAY PLAYLIST"))) { job.DemuxMode = 0; job.AudioTracksDemux = job.AudioTracks; job.AudioTracks = new List <AudioTrackInfo>(); if (txtContainerInformation.Text.Trim().ToUpperInvariant().Equals("MATROSKA")) { MkvExtractJob extractJob = new MkvExtractJob(videoInput, Path.GetDirectoryName(this.output.Filename), job.AudioTracksDemux); prepareJobs = new SequentialChain(prepareJobs, new SequentialChain(extractJob)); } } prepareJobs = new SequentialChain(prepareJobs, new SequentialChain(job)); MainForm.Instance.Jobs.AddJobsWithDependencies(prepareJobs, true); if (this.closeOnQueue.Checked) { this.Close(); } break; } } }
/// <summary> /// creates a project /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void queueButton_Click(object sender, System.EventArgs e) { if (dialogMode) { return; } if (!configured) { MessageBox.Show("You must select the input and output file to continue", "Configuration incomplete", MessageBoxButtons.OK); return; } if (!Drives.ableToWriteOnThisDrive(Path.GetPathRoot(output.Text))) { MessageBox.Show("MeGUI cannot write on the disc " + Path.GetPathRoot(output.Text) + "\n" + "Please, select another output path to save your project...", "Configuration Incomplete", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } JobChain prepareJobs = null; string videoInput = input.Filename; // create pgcdemux job if needed if (cbPGC.SelectedIndex > 0 && Path.GetExtension(input.Filename.ToUpper(System.Globalization.CultureInfo.InvariantCulture)) == ".VOB") { string videoIFO; // PGC numbers are not present in VOB, so we check the main IFO if (Path.GetFileName(input.Filename).ToUpper(System.Globalization.CultureInfo.InvariantCulture).Substring(0, 4) == "VTS_") { videoIFO = input.Filename.Substring(0, input.Filename.LastIndexOf("_")) + "_0.IFO"; } else { videoIFO = Path.ChangeExtension(input.Filename, ".IFO"); } if (File.Exists(videoIFO)) { prepareJobs = new SequentialChain(new PgcDemuxJob(videoIFO, Path.GetDirectoryName(output.Text), cbPGC.SelectedIndex)); videoInput = Path.Combine(Path.GetDirectoryName(output.Text), "VTS_01_1.VOB"); for (int i = 1; i < 10; i++) { string file = Path.Combine(Path.GetDirectoryName(output.Text), "VTS_01_" + i + ".VOB"); if (File.Exists(file)) { MessageBox.Show("The pgc demux file already exists: \n" + file + "\n\n" + "Please select another output path to save your project.", "Configuration Incomplete", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } } } switch (IndexerUsed) { case IndexType.D2V: { prepareJobs = new SequentialChain(prepareJobs, new SequentialChain(generateD2VIndexJob(videoInput))); mainForm.Jobs.addJobsWithDependencies(prepareJobs); if (this.closeOnQueue.Checked) { this.Close(); } break; } case IndexType.DGI: { prepareJobs = new SequentialChain(prepareJobs, new SequentialChain(generateDGNVIndexJob(videoInput))); mainForm.Jobs.addJobsWithDependencies(prepareJobs); if (this.closeOnQueue.Checked) { this.Close(); } break; } case IndexType.DGA: { prepareJobs = new SequentialChain(prepareJobs, new SequentialChain(generateDGAIndexJob(videoInput))); mainForm.Jobs.addJobsWithDependencies(prepareJobs); if (this.closeOnQueue.Checked) { this.Close(); } break; } case IndexType.FFMS: { FFMSIndexJob job = generateFFMSIndexJob(videoInput); if (txtContainerInformation.Text.Trim().ToUpper(System.Globalization.CultureInfo.InvariantCulture).Equals("MATROSKA") && job.DemuxMode > 0 && job.AudioTracks.Count > 0) { job.AudioTracksDemux = job.AudioTracks; job.AudioTracks = new List <AudioTrackInfo>(); MkvExtractJob extractJob = new MkvExtractJob(videoInput, Path.GetDirectoryName(this.output.Text), job.AudioTracksDemux); prepareJobs = new SequentialChain(prepareJobs, new SequentialChain(extractJob)); } prepareJobs = new SequentialChain(prepareJobs, new SequentialChain(job)); mainForm.Jobs.addJobsWithDependencies(prepareJobs); if (this.closeOnQueue.Checked) { this.Close(); } break; } } }
private void queueVideoButton_Click(object sender, System.EventArgs e) { fileType_SelectedIndexChanged(sender, e); // to select always correct output file extension string settingsError = verifyVideoSettings(); // basic input, logfile and output file settings are okay if (settingsError != null) { MessageBox.Show(settingsError, "Unsupported configuration", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } VideoCodecSettings vSettings = this.CurrentSettings.Clone(); string videoOutput = info.VideoOutput; // special handling as the encoders cannot output all desired container types if (!fileType.Text.StartsWith("RAW") && (!vSettings.SettingsID.Equals("x264") || !fileType.Text.Equals("MKV") || MainForm.Instance.Settings.UseExternalMuxerX264)) { if (vSettings.SettingsID.Equals("x264")) { videoOutput = Path.ChangeExtension(videoOutput, "264"); } else if (vSettings.SettingsID.Equals("x265")) { videoOutput = Path.ChangeExtension(videoOutput, "hevc"); } else if (vSettings.SettingsID.Equals("XviD")) { videoOutput = Path.ChangeExtension(videoOutput, "m4v"); } } JobUtil.GetInputProperties(info.VideoInput, out ulong frameCount, out double frameRate); JobChain prepareJobs = JobUtil.AddVideoJobs(info.VideoInput, videoOutput, this.CurrentSettings.Clone(), info.IntroEndFrame, info.CreditsStartFrame, info.DAR, PrerenderJob, info.Zones, (int)frameCount); if (!fileType.Text.StartsWith("RAW") && vSettings.VideoEncodingType != MeGUI.VideoCodecSettings.VideoEncodingMode.twopass1 && vSettings.VideoEncodingType != MeGUI.VideoCodecSettings.VideoEncodingMode.threepass1 && (!vSettings.SettingsID.Equals("x264") || !fileType.Text.Equals("MKV") || MainForm.Instance.Settings.UseExternalMuxerX264)) { // create mux job MuxJob mJob = new MuxJob(); mJob.Input = videoOutput; if (vSettings.SettingsID.Equals("XviD")) { mJob.MuxType = MuxerType.FFMPEG; mJob.Output = Path.ChangeExtension(videoOutput, "avi"); if (fileType.Text.Equals("MKV")) { mJob.Output = Path.ChangeExtension(videoOutput, "mkv"); } } else if (fileType.Text.Equals("MKV")) { mJob.MuxType = MuxerType.MKVMERGE; mJob.Output = Path.ChangeExtension(videoOutput, "mkv"); } else { mJob.MuxType = MuxerType.MP4BOX; mJob.Output = Path.ChangeExtension(videoOutput, "mp4"); } mJob.Settings.MuxAll = true; mJob.Settings.MuxedInput = mJob.Input; mJob.Settings.MuxedOutput = mJob.Output; mJob.FilesToDelete.Add(videoOutput); // add job to queue prepareJobs = new SequentialChain(prepareJobs, new SequentialChain(mJob)); } MainForm.Instance.Jobs.AddJobsWithDependencies(prepareJobs, true); }