Skip to content

Commit

Permalink
rel 8.3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Anime4000 committed Aug 17, 2024
1 parent 751a125 commit 5822b39
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 39 deletions.
29 changes: 16 additions & 13 deletions IFME/MediaEncoding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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 ||
Expand Down
4 changes: 1 addition & 3 deletions IFME/Plugins/PluginsLoad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,16 +285,14 @@ 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)
{
exitCode = ProcessManager.Start(outTempFolder, $"\"{ff}\" -hide_banner -v error -i \"{sampleFile}\" {ff_raw} {ff_cmd} - | \"{en}\" {vc.Args.Input} {vc.Args.Y4M} {en_cmd} {vc.Args.Output} {outTempFile}");
}
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);
Expand Down
5 changes: 4 additions & 1 deletion IFME/frmMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions IFME/frmMain.Function.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,6 @@ private string[] OpenFiles(MediaType type, bool multiSelect = true)
return Array.Empty<string>();
}

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);
Expand Down
64 changes: 49 additions & 15 deletions IFME/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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<Guid, string>)cboVideoEncoder.SelectedItem).Key;

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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<Guid, string>)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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 5822b39

Please sign in to comment.