From 5822b3916619c69e8ddee6b6de5a68b812d20912 Mon Sep 17 00:00:00 2001 From: Anime4000 Date: Sun, 18 Aug 2024 03:08:03 +0800 Subject: [PATCH] rel 8.3.7 --- IFME/MediaEncoding.cs | 29 +++++++++-------- IFME/Plugins/PluginsLoad.cs | 4 +-- IFME/frmMain.Designer.cs | 5 ++- IFME/frmMain.Function.cs | 6 ---- IFME/frmMain.cs | 64 ++++++++++++++++++++++++++++--------- changelog.txt | 3 +- 6 files changed, 72 insertions(+), 39 deletions(-) diff --git a/IFME/MediaEncoding.cs b/IFME/MediaEncoding.cs index a05c5d3..a9ea313 100644 --- a/IFME/MediaEncoding.cs +++ b/IFME/MediaEncoding.cs @@ -389,8 +389,9 @@ internal static void Video(MediaQueue queue, string tempDir) } // Encoder Pixel Format BitDepth (only to YUV) - if (en_csp.Contains("yuv")) - en_csp += yuv_bit_enc; + if (!vc.Args.Pipe) + if (en_csp.Contains("yuv")) + en_csp += yuv_bit_enc; // Encoder Preset en_preset = ArgsParser.Parse(vc.Args.Preset, item.Encoder.Preset); @@ -504,7 +505,7 @@ internal static void Video(MediaQueue queue, string tempDir) var cmd_ff = $"-map 0:{item.Id} {ff_trim} {ff_yuv} -vf {string.Join(",", ff_vf)}"; - var cmd_en = $"{en_res} {en_fps} {en_bit} {en_csp}"; + var cmd_en = ff ? cmd_ff : $"{en_res} {en_fps} {en_bit} {en_csp}"; var cmd_ff_en = ff ? cmd_ff : cmd_en; @@ -626,22 +627,24 @@ internal static int Muxing(MediaQueue queue, string tempDir, string saveDir, str if (queue.OutputFormat == MediaContainer.MP4) metadata += $" -c:s mov_text "; } + } + } - var tempDirFont = Path.Combine(tempDir, "attachment"); - if (Directory.Exists(tempDirFont)) + if (queue.OutputFormat == MediaContainer.MKV) + { + var tempDirFont = Path.Combine(tempDir, "attachment"); + if (Directory.Exists(tempDirFont)) + { + var files = Directory.GetFiles(tempDirFont, "*"); + for (int i = 0; i < files.Length; i++) { - var files = Directory.GetFiles(tempDirFont, "*"); - for (int i = 0; i < files.Length; i++) - { - argEmbed += $"-attach \"{Path.Combine("attachment", Path.GetFileName(files[i]))}\" "; - metadata += $"-metadata:s:{x} filename=\"{Path.GetFileName(files[i])}\" -metadata:s:{x} \"mimetype={queue.Attachment[i].Mime}\" "; - x++; - } + argEmbed += $"-attach \"{Path.Combine("attachment", Path.GetFileName(files[i]))}\" "; + metadata += $"-metadata:s:{x} filename=\"{Path.GetFileName(files[i])}\" -metadata:s:{x} \"mimetype={queue.Attachment[i].Mime}\" "; + x++; } } } - if (queue.OutputFormat == MediaContainer.MKV || queue.OutputFormat == MediaContainer.MP4 || queue.OutputFormat == MediaContainer.M4A || diff --git a/IFME/Plugins/PluginsLoad.cs b/IFME/Plugins/PluginsLoad.cs index a53f4c5..97c9772 100644 --- a/IFME/Plugins/PluginsLoad.cs +++ b/IFME/Plugins/PluginsLoad.cs @@ -285,8 +285,6 @@ private bool TestVideo(PluginsVideo codec) var ff_cmd = $"-pix_fmt yuv420p -vf \"scale={val_w}:{val_h}:flags=lanczos,fps={val_fps}\""; var en_cmd = $"{en_res} {en_fps} {en_bit} {vc.Chroma[0].Command} {vc.Args.Preset} {vc.PresetDefault} {vc.Args.Tune} {vc.TuneDefault} {en_frameCount}"; - var ff_enc = string.Equals(Path.GetFileNameWithoutExtension(en).ToLowerInvariant(), "ffmpeg") ? ff_cmd : en_cmd; - int exitCode; if (codec.Video.Args.Pipe) { @@ -294,7 +292,7 @@ private bool TestVideo(PluginsVideo codec) } else { - exitCode = ProcessManager.Start(outTempFolder, $"\"{en}\" {vc.Args.Input} \"{sampleFile}\" {ff_enc} {vc.Args.UnPipe} {vc.Args.Output} {outTempFile}"); + exitCode = ProcessManager.Start(outTempFolder, $"\"{en}\" {vc.Args.Input} \"{sampleFile}\" {vc.Args.UnPipe} {vc.Args.Output} {outTempFile}"); } return !IsExitError(exitCode); diff --git a/IFME/frmMain.Designer.cs b/IFME/frmMain.Designer.cs index 315bb8a..97e2e9e 100644 --- a/IFME/frmMain.Designer.cs +++ b/IFME/frmMain.Designer.cs @@ -348,6 +348,7 @@ private void InitializeComponent() this.tabConfigSubtitle.TabIndex = 2; this.tabConfigSubtitle.Text = "Subtitle"; this.tabConfigSubtitle.UseVisualStyleBackColor = true; + this.tabConfigSubtitle.Enter += new System.EventHandler(this.tabConfigSubtitle_Enter); // // btnSubMoveUp // @@ -939,12 +940,13 @@ private void InitializeComponent() this.tabConfigAdvance.TabIndex = 4; this.tabConfigAdvance.Text = "Advanced"; this.tabConfigAdvance.UseVisualStyleBackColor = true; + this.tabConfigAdvance.Enter += new System.EventHandler(this.tabConfigAdvance_Enter); // // chkAdvCropAuto // this.chkAdvCropAuto.Anchor = System.Windows.Forms.AnchorStyles.None; this.chkAdvCropAuto.AutoSize = true; - this.chkAdvCropAuto.Location = new System.Drawing.Point(509, 6); + this.chkAdvCropAuto.Location = new System.Drawing.Point(509, 5); this.chkAdvCropAuto.Name = "chkAdvCropAuto"; this.chkAdvCropAuto.Size = new System.Drawing.Size(292, 17); this.chkAdvCropAuto.TabIndex = 0; @@ -1425,6 +1427,7 @@ private void InitializeComponent() this.tabConfigVideo.TabIndex = 0; this.tabConfigVideo.Text = "Video"; this.tabConfigVideo.UseVisualStyleBackColor = true; + this.tabConfigVideo.Enter += new System.EventHandler(this.tabConfigVideo_Enter); // // chkVideoMP4Compt // diff --git a/IFME/frmMain.Function.cs b/IFME/frmMain.Function.cs index b8f99d9..722ad8e 100644 --- a/IFME/frmMain.Function.cs +++ b/IFME/frmMain.Function.cs @@ -184,12 +184,6 @@ private string[] OpenFiles(MediaType type, bool multiSelect = true) return Array.Empty(); } - public static void EnableTab(TabPage page, bool enable) - { - foreach (Control ctrl in page.Controls) - ctrl.Enabled = enable; - } - private void MediaFileListAdd(string path, bool isImages, string frameRate = "") { var fileData = new FFmpeg.MediaInfo(path, frameRate); diff --git a/IFME/frmMain.cs b/IFME/frmMain.cs index d1ac69c..b887556 100644 --- a/IFME/frmMain.cs +++ b/IFME/frmMain.cs @@ -434,6 +434,11 @@ private void lstFile_KeyDown(object sender, KeyEventArgs e) } } + private void tabConfigVideo_Enter(object sender, EventArgs e) + { + grpVideoInterlace.Enabled = chkVideoDeInterlace.Checked; + } + private void lstVideo_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) @@ -584,8 +589,18 @@ private void cboVideoEncoder_SelectedIndexChanged(object sender, EventArgs e) return; } - foreach (Control ctl in tabConfigVideo.Controls) - ctl.Enabled = true; + if (!cboProfile.Focused || !cboFormat.Focused) + { + foreach (Control ctrl in tabConfigVideo.Controls) + { + if (ctrl is GroupBox groupBox) + { + continue; + } + + ctrl.Enabled = true; + } + } var key = ((KeyValuePair)cboVideoEncoder.SelectedItem).Key; @@ -626,8 +641,6 @@ private void cboVideoEncoder_SelectedIndexChanged(object sender, EventArgs e) var topBitDepth = Convert.ToInt32(cboVideoBitDepth.Items[cboVideoBitDepth.Items.Count - 1]); var topPixelFmt = Convert.ToInt32(cboVideoPixFmt.Items[cboVideoPixFmt.Items.Count - 1]); - chkSubHard.Enabled = video.Args.Pipe; - if ((sender as Control).Focused) { var enc = new MediaQueueVideoEncoder @@ -1202,8 +1215,6 @@ private void cboVideoDeInterField_SelectedIndexChanged(object sender, EventArgs private void chkVideoMP4Compt_CheckedChanged(object sender, EventArgs e) { - chkAdvTrim.Enabled = !(chkAudioMP4Compt.Checked || chkVideoMP4Compt.Checked); // prevent user trim when do Fast Remux - if ((sender as Control).Focused) { if (lstFile.SelectedItems.Count == 1) @@ -1222,8 +1233,6 @@ private void chkVideoMP4Compt_CheckedChanged(object sender, EventArgs e) private void chkAudioMP4Compt_CheckedChanged(object sender, EventArgs e) { - chkAdvTrim.Enabled = !(chkAudioMP4Compt.Checked || chkVideoMP4Compt.Checked); // prevent user trim when do Fast Remux - if ((sender as Control).Focused) { if (lstFile.SelectedItems.Count == 1) @@ -1683,6 +1692,24 @@ private void btnAudioEnc_Click(object sender, EventArgs e) } } + private void tabConfigSubtitle_Enter(object sender, EventArgs e) + { + if (cboVideoEncoder.SelectedIndex < 0) + return; + + var key = ((KeyValuePair)cboVideoEncoder.SelectedItem).Key; + + if (Plugins.Items.Video.TryGetValue(key, out var temp)) + { + var video = temp.Video; + + var isFFmpeg = string.Equals(Path.GetFileNameWithoutExtension(video.Encoder[0].Binary).ToLowerInvariant(), "ffmpeg"); + var isPipe = video.Args.Pipe; + + chkSubHard.Enabled = isPipe || isFFmpeg; // check if selected video encoder is pipe or not for burning subs + } + } + private void btnSubAdd_Click(object sender, EventArgs e) { var btnSender = (Button)sender; @@ -1939,6 +1966,15 @@ private void tsmiFileAddAttachEmbed_Click(object sender, EventArgs e) ListViewItem_RefreshAttachment(); } + private void tabConfigAdvance_Enter(object sender, EventArgs e) + { + chkAdvTrim.Enabled = !(chkAudioMP4Compt.Checked || chkVideoMP4Compt.Checked); // prevent user trim when do Fast Remux + chkAdvCropAuto.Enabled = !chkVideoMP4Compt.Checked; // prevent user crop when do Fast Remux + + grpAdvTrim.Enabled = chkAdvTrim.Checked; + grpAdvCrop.Enabled = chkAdvCropAuto.Checked; + } + private void chkAdvTrim_CheckedChanged(object sender, EventArgs e) { grpAdvTrim.Enabled = chkAdvTrim.Checked; @@ -2130,14 +2166,12 @@ private void cboFormat_SelectedIndexChanged(object sender, EventArgs e) btnStart.Enabled = true; } - EnableTab(tabConfigMediaInfo, btnStart.Enabled); - EnableTab(tabConfigVideo, cboVideoEncoder.Items.Count > 0); - EnableTab(tabConfigAudio, cboAudioEncoder.Items.Count > 0); - EnableTab(tabConfigSubtitle, btnStart.Enabled); - EnableTab(tabConfigAttachment, btnStart.Enabled); - EnableTab(tabConfigAdvance, btnStart.Enabled); - + tabConfigMediaInfo.Enabled = btnStart.Enabled; + tabConfigVideo.Enabled = cboVideoEncoder.Items.Count > 0; + tabConfigAudio.Enabled = cboAudioEncoder.Items.Count > 0; + tabConfigSubtitle.Enabled = (MediaContainer)cboFormat.SelectedIndex < MediaContainer.WMV; tabConfigAttachment.Enabled = (MediaContainer)cboFormat.SelectedIndex == MediaContainer.MKV; + tabConfigAdvance.Enabled = btnStart.Enabled; DisplayProperties_Video(); DisplayProperties_Audio(); diff --git a/changelog.txt b/changelog.txt index 190b7e7..5045300 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,9 +1,10 @@ Version 8.3.7 ( -KIZUGUCHI- ) ----------------------------- -[New] Add Rigaya Intel Quick Sync Hardware Encoder (h264, hevc, mpeg2, vp9, av1) +[New] Add Rigaya Intel Quick Sync Hardware Encoder (h264, hevc, av1) [Fixed] FFmpeg Metadata file must be at index 0 [Fixed] Clear encoder args when user change encoder after selecting Profile [Fixed] Slow encoding performance on Rigaya NVEnc when pipe from FFmpeg, now Rigaya NVEnc decode and encode (no pipe) +[Fixed] Improve GUI responsive [Update] Improve performance on removing items [Update] Rigaya NVEnc to 7.64