mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-16 00:17:44 +01:00
Trim tool, Quick Settings WIP
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
1) Download...
|
||||
- FF-Slim if you have an AMD/Intel GPU, or if you have an Nvidia GPU and Pytorch already installed
|
||||
- FF-Full if you have an Nvidia Turing (RTX 2000) or older GPU
|
||||
- FF-Full-RTX3000 if you have an Nvidia Ampere (RTX 3000) GPU. Also compatible with older GPUs, but has bigger filesize.
|
||||
- FF-Slim if you have an AMD/Intel graphics card, or if you have an Nvidia GPU and Pytorch already installed
|
||||
- FF-Full if you have an Nvidia Turing (RTX 2000) or older card
|
||||
- FF-Full-RTX3000 if you have an Nvidia Ampere (RTX 3000) card. Also compatible with older card, but has bigger filesize than Full.
|
||||
|
||||
2) Extract the 7z file using 7zip or any other program that supports it
|
||||
|
||||
@@ -277,7 +277,7 @@
|
||||
<Compile Include="UI\GetWebInfo.cs" />
|
||||
<Compile Include="UI\MainUiFunctions.cs" />
|
||||
<Compile Include="UI\UIUtils.cs" />
|
||||
<Compile Include="UI\UtilsTab.cs" />
|
||||
<Compile Include="UI\QuickSettingsTab.cs" />
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
348
Code/Form1.Designer.cs
generated
348
Code/Form1.Designer.cs
generated
@@ -48,19 +48,9 @@
|
||||
this.inputTbox = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label24 = new System.Windows.Forms.Label();
|
||||
this.utilsConvCrf = new System.Windows.Forms.ComboBox();
|
||||
this.utilsConvertMp4Btn = new System.Windows.Forms.Button();
|
||||
this.label23 = new System.Windows.Forms.Label();
|
||||
this.utilsSpeedCombox = new System.Windows.Forms.ComboBox();
|
||||
this.utilsChangeSpeedBtn = new System.Windows.Forms.Button();
|
||||
this.label20 = new System.Windows.Forms.Label();
|
||||
this.label19 = new System.Windows.Forms.Label();
|
||||
this.utilsLoopTimesCombox = new System.Windows.Forms.ComboBox();
|
||||
this.label18 = new System.Windows.Forms.Label();
|
||||
this.utilsLoopVidBtn = new System.Windows.Forms.Button();
|
||||
this.label17 = new System.Windows.Forms.Label();
|
||||
this.debugExtractFramesBtn = new System.Windows.Forms.Button();
|
||||
this.label16 = new System.Windows.Forms.Label();
|
||||
this.label14 = new System.Windows.Forms.Label();
|
||||
this.runBtn = new System.Windows.Forms.Button();
|
||||
@@ -79,8 +69,6 @@
|
||||
this.pictureBox3 = new System.Windows.Forms.PictureBox();
|
||||
this.info1 = new System.Windows.Forms.PictureBox();
|
||||
this.panel4 = new System.Windows.Forms.Panel();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.panel3 = new System.Windows.Forms.Panel();
|
||||
this.settingsBtn = new HTAlt.WinForms.HTButton();
|
||||
this.patreonBtn = new HTAlt.WinForms.HTButton();
|
||||
this.paypalBtn = new HTAlt.WinForms.HTButton();
|
||||
@@ -105,9 +93,13 @@
|
||||
this.browseOutBtn = new HTAlt.WinForms.HTButton();
|
||||
this.browseInputFileBtn = new HTAlt.WinForms.HTButton();
|
||||
this.browseInputBtn = new HTAlt.WinForms.HTButton();
|
||||
this.videoUtilsTab = new System.Windows.Forms.TabPage();
|
||||
this.quickSettingsTab = new System.Windows.Forms.TabPage();
|
||||
this.trimPanel = new System.Windows.Forms.Panel();
|
||||
this.trimResetBtn = new HTAlt.WinForms.HTButton();
|
||||
this.trimStartBox = new System.Windows.Forms.TextBox();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.utilsExtractAudioCbox = new System.Windows.Forms.CheckBox();
|
||||
this.trimEndBox = new System.Windows.Forms.TextBox();
|
||||
this.trimCombox = new System.Windows.Forms.ComboBox();
|
||||
this.previewTab = new System.Windows.Forms.TabPage();
|
||||
this.label22 = new System.Windows.Forms.Label();
|
||||
this.previewPicturebox = new System.Windows.Forms.PictureBox();
|
||||
@@ -126,7 +118,8 @@
|
||||
this.panel8.SuspendLayout();
|
||||
this.panel6.SuspendLayout();
|
||||
this.interpOptsTab.SuspendLayout();
|
||||
this.videoUtilsTab.SuspendLayout();
|
||||
this.quickSettingsTab.SuspendLayout();
|
||||
this.trimPanel.SuspendLayout();
|
||||
this.previewTab.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.previewPicturebox)).BeginInit();
|
||||
this.abtTab.SuspendLayout();
|
||||
@@ -358,45 +351,6 @@
|
||||
this.label2.TabIndex = 0;
|
||||
this.label2.Text = "Input Video (Or Frames Folder)";
|
||||
//
|
||||
// label24
|
||||
//
|
||||
this.label24.AutoSize = true;
|
||||
this.label24.ForeColor = System.Drawing.Color.White;
|
||||
this.label24.Location = new System.Drawing.Point(441, 100);
|
||||
this.label24.Margin = new System.Windows.Forms.Padding(8, 0, 3, 0);
|
||||
this.label24.Name = "label24";
|
||||
this.label24.Size = new System.Drawing.Size(78, 15);
|
||||
this.label24.TabIndex = 29;
|
||||
this.label24.Text = "Quality Level:";
|
||||
//
|
||||
// utilsConvCrf
|
||||
//
|
||||
this.utilsConvCrf.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.utilsConvCrf.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.utilsConvCrf.ForeColor = System.Drawing.Color.White;
|
||||
this.utilsConvCrf.FormattingEnabled = true;
|
||||
this.utilsConvCrf.Items.AddRange(new object[] {
|
||||
"Quality: High (CRF 16)",
|
||||
"Quality: Normal (CRF 20)",
|
||||
"Quality: Medium (CRF 24)",
|
||||
"Quality: Low (CRF 28)"});
|
||||
this.utilsConvCrf.Location = new System.Drawing.Point(575, 97);
|
||||
this.utilsConvCrf.Name = "utilsConvCrf";
|
||||
this.utilsConvCrf.Size = new System.Drawing.Size(147, 23);
|
||||
this.utilsConvCrf.TabIndex = 28;
|
||||
//
|
||||
// utilsConvertMp4Btn
|
||||
//
|
||||
this.utilsConvertMp4Btn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.utilsConvertMp4Btn.ForeColor = System.Drawing.Color.White;
|
||||
this.utilsConvertMp4Btn.Location = new System.Drawing.Point(280, 95);
|
||||
this.utilsConvertMp4Btn.Name = "utilsConvertMp4Btn";
|
||||
this.utilsConvertMp4Btn.Size = new System.Drawing.Size(150, 23);
|
||||
this.utilsConvertMp4Btn.TabIndex = 27;
|
||||
this.utilsConvertMp4Btn.Text = "Convert Input Video";
|
||||
this.utilsConvertMp4Btn.UseVisualStyleBackColor = true;
|
||||
this.utilsConvertMp4Btn.Click += new System.EventHandler(this.utilsConvertMp4Btn_Click);
|
||||
//
|
||||
// label23
|
||||
//
|
||||
this.label23.AutoSize = true;
|
||||
@@ -404,50 +358,9 @@
|
||||
this.label23.Location = new System.Drawing.Point(10, 100);
|
||||
this.label23.Margin = new System.Windows.Forms.Padding(8, 0, 3, 0);
|
||||
this.label23.Name = "label23";
|
||||
this.label23.Size = new System.Drawing.Size(124, 15);
|
||||
this.label23.Size = new System.Drawing.Size(136, 15);
|
||||
this.label23.TabIndex = 26;
|
||||
this.label23.Text = "Convert Video To MP4";
|
||||
//
|
||||
// utilsSpeedCombox
|
||||
//
|
||||
this.utilsSpeedCombox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.utilsSpeedCombox.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.utilsSpeedCombox.ForeColor = System.Drawing.Color.White;
|
||||
this.utilsSpeedCombox.FormattingEnabled = true;
|
||||
this.utilsSpeedCombox.Items.AddRange(new object[] {
|
||||
"25%",
|
||||
"50%",
|
||||
"75%",
|
||||
"125%",
|
||||
"150%",
|
||||
"200%"});
|
||||
this.utilsSpeedCombox.Location = new System.Drawing.Point(575, 67);
|
||||
this.utilsSpeedCombox.Name = "utilsSpeedCombox";
|
||||
this.utilsSpeedCombox.Size = new System.Drawing.Size(100, 23);
|
||||
this.utilsSpeedCombox.TabIndex = 23;
|
||||
//
|
||||
// utilsChangeSpeedBtn
|
||||
//
|
||||
this.utilsChangeSpeedBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.utilsChangeSpeedBtn.ForeColor = System.Drawing.Color.White;
|
||||
this.utilsChangeSpeedBtn.Location = new System.Drawing.Point(280, 65);
|
||||
this.utilsChangeSpeedBtn.Name = "utilsChangeSpeedBtn";
|
||||
this.utilsChangeSpeedBtn.Size = new System.Drawing.Size(150, 23);
|
||||
this.utilsChangeSpeedBtn.TabIndex = 22;
|
||||
this.utilsChangeSpeedBtn.Text = "Change Video Speed";
|
||||
this.utilsChangeSpeedBtn.UseVisualStyleBackColor = true;
|
||||
this.utilsChangeSpeedBtn.Click += new System.EventHandler(this.utilsChangeSpeedBtn_Click);
|
||||
//
|
||||
// label20
|
||||
//
|
||||
this.label20.AutoSize = true;
|
||||
this.label20.ForeColor = System.Drawing.Color.White;
|
||||
this.label20.Location = new System.Drawing.Point(441, 70);
|
||||
this.label20.Margin = new System.Windows.Forms.Padding(8, 0, 3, 0);
|
||||
this.label20.Name = "label20";
|
||||
this.label20.Size = new System.Drawing.Size(69, 15);
|
||||
this.label20.TabIndex = 21;
|
||||
this.label20.Text = "New Speed:";
|
||||
this.label23.Text = "Scene Change Detection";
|
||||
//
|
||||
// label19
|
||||
//
|
||||
@@ -456,48 +369,9 @@
|
||||
this.label19.Location = new System.Drawing.Point(10, 70);
|
||||
this.label19.Margin = new System.Windows.Forms.Padding(8, 0, 3, 0);
|
||||
this.label19.Name = "label19";
|
||||
this.label19.Size = new System.Drawing.Size(170, 15);
|
||||
this.label19.Size = new System.Drawing.Size(34, 15);
|
||||
this.label19.TabIndex = 20;
|
||||
this.label19.Text = "Change Video Speed Losslessly";
|
||||
//
|
||||
// utilsLoopTimesCombox
|
||||
//
|
||||
this.utilsLoopTimesCombox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.utilsLoopTimesCombox.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.utilsLoopTimesCombox.ForeColor = System.Drawing.Color.White;
|
||||
this.utilsLoopTimesCombox.FormattingEnabled = true;
|
||||
this.utilsLoopTimesCombox.Items.AddRange(new object[] {
|
||||
"2",
|
||||
"4",
|
||||
"8",
|
||||
"10"});
|
||||
this.utilsLoopTimesCombox.Location = new System.Drawing.Point(575, 37);
|
||||
this.utilsLoopTimesCombox.Name = "utilsLoopTimesCombox";
|
||||
this.utilsLoopTimesCombox.Size = new System.Drawing.Size(100, 23);
|
||||
this.utilsLoopTimesCombox.TabIndex = 19;
|
||||
//
|
||||
// label18
|
||||
//
|
||||
this.label18.AutoSize = true;
|
||||
this.label18.ForeColor = System.Drawing.Color.White;
|
||||
this.label18.Location = new System.Drawing.Point(441, 40);
|
||||
this.label18.Margin = new System.Windows.Forms.Padding(8, 0, 3, 0);
|
||||
this.label18.Name = "label18";
|
||||
this.label18.Size = new System.Drawing.Size(128, 15);
|
||||
this.label18.TabIndex = 6;
|
||||
this.label18.Text = "Loop This Many Times:";
|
||||
//
|
||||
// utilsLoopVidBtn
|
||||
//
|
||||
this.utilsLoopVidBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.utilsLoopVidBtn.ForeColor = System.Drawing.Color.White;
|
||||
this.utilsLoopVidBtn.Location = new System.Drawing.Point(280, 35);
|
||||
this.utilsLoopVidBtn.Name = "utilsLoopVidBtn";
|
||||
this.utilsLoopVidBtn.Size = new System.Drawing.Size(150, 23);
|
||||
this.utilsLoopVidBtn.TabIndex = 5;
|
||||
this.utilsLoopVidBtn.Text = "Create Looped Video";
|
||||
this.utilsLoopVidBtn.UseVisualStyleBackColor = true;
|
||||
this.utilsLoopVidBtn.Click += new System.EventHandler(this.utilsLoopVidBtn_Click);
|
||||
this.label19.Text = "Loop";
|
||||
//
|
||||
// label17
|
||||
//
|
||||
@@ -506,21 +380,9 @@
|
||||
this.label17.Location = new System.Drawing.Point(10, 40);
|
||||
this.label17.Margin = new System.Windows.Forms.Padding(8, 0, 3, 0);
|
||||
this.label17.Name = "label17";
|
||||
this.label17.Size = new System.Drawing.Size(121, 15);
|
||||
this.label17.Size = new System.Drawing.Size(87, 15);
|
||||
this.label17.TabIndex = 4;
|
||||
this.label17.Text = "Loop Video Losslessly";
|
||||
//
|
||||
// debugExtractFramesBtn
|
||||
//
|
||||
this.debugExtractFramesBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.debugExtractFramesBtn.ForeColor = System.Drawing.Color.White;
|
||||
this.debugExtractFramesBtn.Location = new System.Drawing.Point(280, 6);
|
||||
this.debugExtractFramesBtn.Name = "debugExtractFramesBtn";
|
||||
this.debugExtractFramesBtn.Size = new System.Drawing.Size(150, 23);
|
||||
this.debugExtractFramesBtn.TabIndex = 3;
|
||||
this.debugExtractFramesBtn.Text = "Extract Frames";
|
||||
this.debugExtractFramesBtn.UseVisualStyleBackColor = true;
|
||||
this.debugExtractFramesBtn.Click += new System.EventHandler(this.debugExtractFramesBtn_Click);
|
||||
this.label17.Text = "De-Duplication";
|
||||
//
|
||||
// label16
|
||||
//
|
||||
@@ -529,9 +391,9 @@
|
||||
this.label16.Location = new System.Drawing.Point(10, 10);
|
||||
this.label16.Margin = new System.Windows.Forms.Padding(8, 8, 3, 0);
|
||||
this.label16.Name = "label16";
|
||||
this.label16.Size = new System.Drawing.Size(265, 15);
|
||||
this.label16.Size = new System.Drawing.Size(61, 15);
|
||||
this.label16.TabIndex = 2;
|
||||
this.label16.Text = "Extract Frames From Video Without Interpolating";
|
||||
this.label16.Text = "Trim Input";
|
||||
//
|
||||
// label14
|
||||
//
|
||||
@@ -718,32 +580,12 @@
|
||||
//
|
||||
this.panel4.BackgroundImage = global::Flowframes.Properties.Resources.baseline_create_white_18dp_semiTransparent;
|
||||
this.panel4.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.panel4.Location = new System.Drawing.Point(728, 98);
|
||||
this.panel4.Location = new System.Drawing.Point(849, 203);
|
||||
this.panel4.Name = "panel4";
|
||||
this.panel4.Size = new System.Drawing.Size(21, 21);
|
||||
this.panel4.TabIndex = 60;
|
||||
this.toolTip1.SetToolTip(this.panel4, "Allows custom input.");
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.BackgroundImage = global::Flowframes.Properties.Resources.baseline_create_white_18dp_semiTransparent;
|
||||
this.panel2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.panel2.Location = new System.Drawing.Point(681, 69);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(21, 21);
|
||||
this.panel2.TabIndex = 59;
|
||||
this.toolTip1.SetToolTip(this.panel2, "Allows custom input.");
|
||||
//
|
||||
// panel3
|
||||
//
|
||||
this.panel3.BackgroundImage = global::Flowframes.Properties.Resources.baseline_create_white_18dp_semiTransparent;
|
||||
this.panel3.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.panel3.Location = new System.Drawing.Point(681, 39);
|
||||
this.panel3.Name = "panel3";
|
||||
this.panel3.Size = new System.Drawing.Size(21, 21);
|
||||
this.panel3.TabIndex = 58;
|
||||
this.toolTip1.SetToolTip(this.panel3, "Allows custom input.");
|
||||
//
|
||||
// settingsBtn
|
||||
//
|
||||
this.settingsBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
|
||||
@@ -871,7 +713,7 @@
|
||||
this.mainTabControl.BorderTabLineColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(122)))), ((int)(((byte)(204)))));
|
||||
this.mainTabControl.Controls.Add(this.welcomeTab);
|
||||
this.mainTabControl.Controls.Add(this.interpOptsTab);
|
||||
this.mainTabControl.Controls.Add(this.videoUtilsTab);
|
||||
this.mainTabControl.Controls.Add(this.quickSettingsTab);
|
||||
this.mainTabControl.Controls.Add(this.previewTab);
|
||||
this.mainTabControl.Controls.Add(this.abtTab);
|
||||
this.mainTabControl.DisableClose = true;
|
||||
@@ -1110,56 +952,100 @@
|
||||
this.browseInputBtn.UseVisualStyleBackColor = false;
|
||||
this.browseInputBtn.Click += new System.EventHandler(this.browseInputBtn_Click);
|
||||
//
|
||||
// videoUtilsTab
|
||||
// quickSettingsTab
|
||||
//
|
||||
this.videoUtilsTab.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
|
||||
this.videoUtilsTab.Controls.Add(this.panel4);
|
||||
this.videoUtilsTab.Controls.Add(this.panel2);
|
||||
this.videoUtilsTab.Controls.Add(this.panel3);
|
||||
this.videoUtilsTab.Controls.Add(this.label10);
|
||||
this.videoUtilsTab.Controls.Add(this.utilsExtractAudioCbox);
|
||||
this.videoUtilsTab.Controls.Add(this.label16);
|
||||
this.videoUtilsTab.Controls.Add(this.debugExtractFramesBtn);
|
||||
this.videoUtilsTab.Controls.Add(this.label17);
|
||||
this.videoUtilsTab.Controls.Add(this.utilsLoopVidBtn);
|
||||
this.videoUtilsTab.Controls.Add(this.label24);
|
||||
this.videoUtilsTab.Controls.Add(this.label18);
|
||||
this.videoUtilsTab.Controls.Add(this.utilsConvCrf);
|
||||
this.videoUtilsTab.Controls.Add(this.utilsLoopTimesCombox);
|
||||
this.videoUtilsTab.Controls.Add(this.utilsConvertMp4Btn);
|
||||
this.videoUtilsTab.Controls.Add(this.label19);
|
||||
this.videoUtilsTab.Controls.Add(this.label23);
|
||||
this.videoUtilsTab.Controls.Add(this.label20);
|
||||
this.videoUtilsTab.Controls.Add(this.utilsChangeSpeedBtn);
|
||||
this.videoUtilsTab.Controls.Add(this.utilsSpeedCombox);
|
||||
this.videoUtilsTab.Location = new System.Drawing.Point(4, 27);
|
||||
this.videoUtilsTab.Name = "videoUtilsTab";
|
||||
this.videoUtilsTab.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.videoUtilsTab.Size = new System.Drawing.Size(901, 258);
|
||||
this.videoUtilsTab.TabIndex = 1;
|
||||
this.videoUtilsTab.Text = "Video Utilities";
|
||||
this.quickSettingsTab.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
|
||||
this.quickSettingsTab.Controls.Add(this.trimPanel);
|
||||
this.quickSettingsTab.Controls.Add(this.trimCombox);
|
||||
this.quickSettingsTab.Controls.Add(this.panel4);
|
||||
this.quickSettingsTab.Controls.Add(this.label16);
|
||||
this.quickSettingsTab.Controls.Add(this.label17);
|
||||
this.quickSettingsTab.Controls.Add(this.label19);
|
||||
this.quickSettingsTab.Controls.Add(this.label23);
|
||||
this.quickSettingsTab.Location = new System.Drawing.Point(4, 27);
|
||||
this.quickSettingsTab.Name = "quickSettingsTab";
|
||||
this.quickSettingsTab.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.quickSettingsTab.Size = new System.Drawing.Size(901, 258);
|
||||
this.quickSettingsTab.TabIndex = 1;
|
||||
this.quickSettingsTab.Text = "Quick Settings";
|
||||
//
|
||||
// trimPanel
|
||||
//
|
||||
this.trimPanel.Controls.Add(this.trimResetBtn);
|
||||
this.trimPanel.Controls.Add(this.trimStartBox);
|
||||
this.trimPanel.Controls.Add(this.label10);
|
||||
this.trimPanel.Controls.Add(this.trimEndBox);
|
||||
this.trimPanel.Location = new System.Drawing.Point(433, 7);
|
||||
this.trimPanel.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.trimPanel.Name = "trimPanel";
|
||||
this.trimPanel.Size = new System.Drawing.Size(426, 23);
|
||||
this.trimPanel.TabIndex = 65;
|
||||
//
|
||||
// trimResetBtn
|
||||
//
|
||||
this.trimResetBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.trimResetBtn.FlatAppearance.BorderSize = 0;
|
||||
this.trimResetBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.trimResetBtn.ForeColor = System.Drawing.Color.White;
|
||||
this.trimResetBtn.Location = new System.Drawing.Point(183, 0);
|
||||
this.trimResetBtn.Name = "trimResetBtn";
|
||||
this.trimResetBtn.Size = new System.Drawing.Size(150, 23);
|
||||
this.trimResetBtn.TabIndex = 80;
|
||||
this.trimResetBtn.Text = "Reset To Full Length";
|
||||
this.trimResetBtn.UseVisualStyleBackColor = false;
|
||||
this.trimResetBtn.Click += new System.EventHandler(this.trimResetBtn_Click);
|
||||
//
|
||||
// trimStartBox
|
||||
//
|
||||
this.trimStartBox.AllowDrop = true;
|
||||
this.trimStartBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.trimStartBox.ForeColor = System.Drawing.Color.White;
|
||||
this.trimStartBox.Location = new System.Drawing.Point(3, 0);
|
||||
this.trimStartBox.MinimumSize = new System.Drawing.Size(4, 21);
|
||||
this.trimStartBox.Name = "trimStartBox";
|
||||
this.trimStartBox.Size = new System.Drawing.Size(75, 23);
|
||||
this.trimStartBox.TabIndex = 62;
|
||||
this.trimStartBox.Text = "00:00:00";
|
||||
this.trimStartBox.TextChanged += new System.EventHandler(this.trimBox_TextChanged);
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.ForeColor = System.Drawing.Color.White;
|
||||
this.label10.Location = new System.Drawing.Point(441, 10);
|
||||
this.label10.Margin = new System.Windows.Forms.Padding(8, 0, 3, 0);
|
||||
this.label10.Location = new System.Drawing.Point(84, 3);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(107, 15);
|
||||
this.label10.TabIndex = 35;
|
||||
this.label10.Text = "Also Extract Audio:";
|
||||
this.label10.Size = new System.Drawing.Size(12, 15);
|
||||
this.label10.TabIndex = 64;
|
||||
this.label10.Text = "-";
|
||||
//
|
||||
// utilsExtractAudioCbox
|
||||
// trimEndBox
|
||||
//
|
||||
this.utilsExtractAudioCbox.AutoSize = true;
|
||||
this.utilsExtractAudioCbox.Checked = true;
|
||||
this.utilsExtractAudioCbox.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.utilsExtractAudioCbox.Location = new System.Drawing.Point(575, 11);
|
||||
this.utilsExtractAudioCbox.Name = "utilsExtractAudioCbox";
|
||||
this.utilsExtractAudioCbox.Size = new System.Drawing.Size(15, 14);
|
||||
this.utilsExtractAudioCbox.TabIndex = 34;
|
||||
this.utilsExtractAudioCbox.UseVisualStyleBackColor = true;
|
||||
this.trimEndBox.AllowDrop = true;
|
||||
this.trimEndBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.trimEndBox.ForeColor = System.Drawing.Color.White;
|
||||
this.trimEndBox.Location = new System.Drawing.Point(102, 0);
|
||||
this.trimEndBox.MinimumSize = new System.Drawing.Size(4, 21);
|
||||
this.trimEndBox.Name = "trimEndBox";
|
||||
this.trimEndBox.Size = new System.Drawing.Size(75, 23);
|
||||
this.trimEndBox.TabIndex = 63;
|
||||
this.trimEndBox.Text = "00:00:00";
|
||||
this.trimEndBox.TextChanged += new System.EventHandler(this.trimBox_TextChanged);
|
||||
//
|
||||
// trimCombox
|
||||
//
|
||||
this.trimCombox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.trimCombox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.trimCombox.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.trimCombox.ForeColor = System.Drawing.Color.White;
|
||||
this.trimCombox.FormattingEnabled = true;
|
||||
this.trimCombox.Items.AddRange(new object[] {
|
||||
"Don\'t Trim",
|
||||
"Trim by Start/End Time"});
|
||||
this.trimCombox.Location = new System.Drawing.Point(280, 7);
|
||||
this.trimCombox.Name = "trimCombox";
|
||||
this.trimCombox.Size = new System.Drawing.Size(150, 23);
|
||||
this.trimCombox.TabIndex = 61;
|
||||
this.trimCombox.SelectedIndexChanged += new System.EventHandler(this.trimCombox_SelectedIndexChanged);
|
||||
//
|
||||
// previewTab
|
||||
//
|
||||
@@ -1311,8 +1197,10 @@
|
||||
this.panel6.PerformLayout();
|
||||
this.interpOptsTab.ResumeLayout(false);
|
||||
this.interpOptsTab.PerformLayout();
|
||||
this.videoUtilsTab.ResumeLayout(false);
|
||||
this.videoUtilsTab.PerformLayout();
|
||||
this.quickSettingsTab.ResumeLayout(false);
|
||||
this.quickSettingsTab.PerformLayout();
|
||||
this.trimPanel.ResumeLayout(false);
|
||||
this.trimPanel.PerformLayout();
|
||||
this.previewTab.ResumeLayout(false);
|
||||
this.previewTab.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.previewPicturebox)).EndInit();
|
||||
@@ -1352,26 +1240,16 @@
|
||||
private System.Windows.Forms.Label label13;
|
||||
private System.Windows.Forms.ComboBox aiModel;
|
||||
private System.Windows.Forms.Label label14;
|
||||
private System.Windows.Forms.Button debugExtractFramesBtn;
|
||||
private System.Windows.Forms.Label label16;
|
||||
private System.Windows.Forms.ComboBox utilsLoopTimesCombox;
|
||||
private System.Windows.Forms.Label label18;
|
||||
private System.Windows.Forms.Button utilsLoopVidBtn;
|
||||
private System.Windows.Forms.Label label17;
|
||||
private System.Windows.Forms.Label label19;
|
||||
private System.Windows.Forms.ComboBox utilsSpeedCombox;
|
||||
private System.Windows.Forms.Button utilsChangeSpeedBtn;
|
||||
private System.Windows.Forms.Label label20;
|
||||
private System.Windows.Forms.PictureBox info1;
|
||||
private System.Windows.Forms.ToolTip toolTip1;
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private System.Windows.Forms.PictureBox pictureBox2;
|
||||
private System.Windows.Forms.PictureBox pictureBox4;
|
||||
private System.Windows.Forms.PictureBox pictureBox3;
|
||||
private System.Windows.Forms.Button utilsConvertMp4Btn;
|
||||
private System.Windows.Forms.Label label23;
|
||||
private System.Windows.Forms.ComboBox utilsConvCrf;
|
||||
private System.Windows.Forms.Label label24;
|
||||
private HTAlt.WinForms.HTProgressBar longProgBar;
|
||||
private System.Windows.Forms.Button cancelBtn;
|
||||
private HTAlt.WinForms.HTButton discordBtn;
|
||||
@@ -1379,7 +1257,7 @@
|
||||
private HTAlt.WinForms.HTButton patreonBtn;
|
||||
private HTAlt.WinForms.HTButton settingsBtn;
|
||||
private System.Windows.Forms.TabPage interpOptsTab;
|
||||
private System.Windows.Forms.TabPage videoUtilsTab;
|
||||
private System.Windows.Forms.TabPage quickSettingsTab;
|
||||
private System.Windows.Forms.TabPage abtTab;
|
||||
private HTAlt.WinForms.HTButton browseOutBtn;
|
||||
private HTAlt.WinForms.HTButton browseInputFileBtn;
|
||||
@@ -1389,11 +1267,7 @@
|
||||
public HTAlt.WinForms.HTTabControl mainTabControl;
|
||||
private HTAlt.WinForms.HTButton queueBtn;
|
||||
private HTAlt.WinForms.HTButton htButton1;
|
||||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.CheckBox utilsExtractAudioCbox;
|
||||
private System.Windows.Forms.Panel panel4;
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
private System.Windows.Forms.Panel panel3;
|
||||
private HTAlt.WinForms.HTButton updateBtn;
|
||||
private System.Windows.Forms.TabPage welcomeTab;
|
||||
private System.Windows.Forms.Label label11;
|
||||
@@ -1409,6 +1283,12 @@
|
||||
private System.Windows.Forms.Label label22;
|
||||
private System.Windows.Forms.Label inputInfo;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.TextBox trimEndBox;
|
||||
private System.Windows.Forms.TextBox trimStartBox;
|
||||
private System.Windows.Forms.ComboBox trimCombox;
|
||||
private System.Windows.Forms.Panel trimPanel;
|
||||
private HTAlt.WinForms.HTButton trimResetBtn;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,9 +49,7 @@ namespace Flowframes
|
||||
UIUtils.InitCombox(outModeCombox, 0);
|
||||
UIUtils.InitCombox(aiModel, 2);
|
||||
// Video Utils
|
||||
UIUtils.InitCombox(utilsLoopTimesCombox, 0);
|
||||
UIUtils.InitCombox(utilsSpeedCombox, 0);
|
||||
UIUtils.InitCombox(utilsConvCrf, 0);
|
||||
UIUtils.InitCombox(trimCombox, 0);
|
||||
|
||||
Program.mainForm = this;
|
||||
Logger.textbox = logBox;
|
||||
@@ -152,12 +150,13 @@ namespace Flowframes
|
||||
public float currInFps;
|
||||
public int currInFrames;
|
||||
public long currInDuration;
|
||||
public long currInDurationCut;
|
||||
public void UpdateInputInfo ()
|
||||
{
|
||||
string str = $"Resolution: {(!currInRes.IsEmpty ? $"{currInRes.Width}x{currInRes.Height}" : "Unknown")} - ";
|
||||
str += $"Framerate: {(currInFps > 0f ? $"{currInFps.ToStringDot()} FPS" : "Unknown")} - ";
|
||||
str += $"Frame Count: {(currInFrames > 0 ? $"{currInFrames}" : "Unknown")} - ";
|
||||
str += $"Duration: {(currInDuration > 0 ? $"{FormatUtils.MsToTimestamp(currInDuration)}" : "Unknown")}";
|
||||
str += $"Duration: {(currInDuration > 0 ? FormatUtils.MsToTimestamp(currInDuration) : "Unknown")}";
|
||||
inputInfo.Text = str;
|
||||
}
|
||||
|
||||
@@ -167,6 +166,7 @@ namespace Flowframes
|
||||
currInFps = 0;
|
||||
currInFrames = 0;
|
||||
currInDuration = 0;
|
||||
currInDurationCut = 0;
|
||||
UpdateInputInfo();
|
||||
}
|
||||
|
||||
@@ -328,26 +328,11 @@ namespace Flowframes
|
||||
Logger.Log("Closing main form.", true);
|
||||
}
|
||||
|
||||
private async void debugExtractFramesBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
await UtilsTab.ExtractVideo(inputTbox.Text.Trim(), utilsExtractAudioCbox.Checked);
|
||||
}
|
||||
|
||||
private void licenseBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
Process.Start("explorer.exe", Path.Combine(Paths.GetPkgPath(), Path.GetFileNameWithoutExtension(Packages.licenses.fileName)));
|
||||
}
|
||||
|
||||
private async void utilsLoopVidBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
await UtilsTab.LoopVideo(inputTbox.Text.Trim(), utilsLoopTimesCombox);
|
||||
}
|
||||
|
||||
private async void utilsChangeSpeedBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
await UtilsTab.ChangeSpeed(inputTbox.Text.Trim(), utilsSpeedCombox);
|
||||
}
|
||||
|
||||
private void Form1_DragEnter(object sender, DragEventArgs e) { e.Effect = DragDropEffects.Copy; }
|
||||
|
||||
private void Form1_DragDrop(object sender, DragEventArgs e)
|
||||
@@ -377,25 +362,12 @@ namespace Flowframes
|
||||
if (resume)
|
||||
ResumeUtils.LoadTempFolder(files[0]);
|
||||
|
||||
trimCombox.SelectedIndex = 0;
|
||||
|
||||
MainUiFunctions.InitInput(outputTbox, inputTbox, fpsInTbox);
|
||||
}
|
||||
}
|
||||
|
||||
private async void utilsConvertMp4Btn_Click(object sender, EventArgs e)
|
||||
{
|
||||
await UtilsTab.Convert(inputTbox.Text.Trim(), utilsConvCrf);
|
||||
}
|
||||
|
||||
private void utilsDedupBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
UtilsTab.Dedupe(inputTbox.Text.Trim(), false);
|
||||
}
|
||||
|
||||
private void utilsDedupTestBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
UtilsTab.Dedupe(inputTbox.Text.Trim(), true);
|
||||
}
|
||||
|
||||
private void cancelBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
SetTab("interpolation");
|
||||
@@ -475,5 +447,28 @@ namespace Flowframes
|
||||
if (!initialized) return;
|
||||
aiCombox_SelectedIndexChanged(null, null);
|
||||
}
|
||||
|
||||
private void trimCombox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
QuickSettingsTab.trimEnabled = trimCombox.SelectedIndex > 0;
|
||||
trimPanel.Visible = QuickSettingsTab.trimEnabled;
|
||||
|
||||
if (trimCombox.SelectedIndex == 1)
|
||||
{
|
||||
trimStartBox.Text = "00:00:00";
|
||||
Logger.Log("Setting trimEndBox text to FormatUtils.MsToTimestamp(currInDuration) = " + FormatUtils.MsToTimestamp(currInDuration));
|
||||
trimEndBox.Text = FormatUtils.MsToTimestamp(currInDuration);
|
||||
}
|
||||
}
|
||||
|
||||
private void trimResetBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
trimCombox_SelectedIndexChanged(null, null);
|
||||
}
|
||||
|
||||
private void trimBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
QuickSettingsTab.UpdateTrim(trimStartBox, trimEndBox);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,14 +157,17 @@ namespace Flowframes
|
||||
|
||||
public static void UpdateFfmpegProgress(string ffmpegTime)
|
||||
{
|
||||
if (Program.mainForm.currInDuration < 1)
|
||||
Form1 form = Program.mainForm;
|
||||
long currInDuration = (form.currInDuration != form.currInDurationCut) ? form.currInDurationCut : form.currInDuration;
|
||||
|
||||
if (currInDuration < 1)
|
||||
{
|
||||
Program.mainForm.SetProgress(0);
|
||||
return;
|
||||
}
|
||||
|
||||
long total = Program.mainForm.currInDuration / 100;
|
||||
long current = FormatUtils.MsFromTimestamp(ffmpegTime);
|
||||
long total = currInDuration / 100;
|
||||
long current = FormatUtils.TimestampToMs(ffmpegTime);
|
||||
int progress = Convert.ToInt32(current / total);
|
||||
Program.mainForm.SetProgress(progress);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Flowframes
|
||||
Logger.Log($"GetDuration({inputFile}) - Reading Duration using ffprobe.", true, false, "ffmpeg");
|
||||
string args = $" -v panic -select_streams v:0 -show_entries format=duration -of csv=s=x:p=0 -sexagesimal {inputFile.Wrap()}";
|
||||
string info = GetFfprobeOutput(args);
|
||||
return FormatUtils.MsFromTimestamp(info);
|
||||
return FormatUtils.TimestampToMs(info);
|
||||
}
|
||||
|
||||
public static async Task<float> GetFramerate(string inputFile)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Flowframes.IO;
|
||||
using Flowframes.Main;
|
||||
using Flowframes.MiscUtils;
|
||||
using Flowframes.UI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
@@ -41,9 +42,9 @@ namespace Flowframes.Media
|
||||
string vf = filters.Length > 2 ? $"-vf {filters}" : "";
|
||||
string rateArg = (rate > 0) ? $" -r {rate.ToStringDot()}" : "";
|
||||
string pixFmt = alpha ? "-pix_fmt rgba" : "-pix_fmt rgb24"; // Use RGBA for GIF for alpha support
|
||||
string args = $"{rateArg} -i {inputFile.Wrap()} {pngComprArg} -vsync 0 {pixFmt} {timecodeStr} {vf} {sizeStr} \"{framesDir}/%{Padding.inputFrames}d.png\"";
|
||||
string args = $"{rateArg} -i {inputFile.Wrap()} {pngComprArg} -vsync 0 {pixFmt} {timecodeStr} {vf} {sizeStr} {GetTrimArg()} \"{framesDir}/%{Padding.inputFrames}d.png\"";
|
||||
LogMode logMode = Interpolate.currentInputFrameCount > 50 ? LogMode.OnlyLastLine : LogMode.Hidden;
|
||||
await AvProcess.RunFfmpeg(args, logMode, TaskType.ExtractFrames, true);
|
||||
await RunFfmpeg(args, logMode, TaskType.ExtractFrames, true);
|
||||
int amount = IOUtils.GetAmountOfFiles(framesDir, false, "*.png");
|
||||
if (!sceneDetect) Logger.Log($"Extracted {amount} {(amount == 1 ? "frame" : "frames")} from input.", false, true);
|
||||
await Task.Delay(1);
|
||||
@@ -68,11 +69,19 @@ namespace Flowframes.Media
|
||||
string vf = alpha ? $"-filter_complex \"[0:v]{divisionFilter},split[a][b];[a]palettegen=reserve_transparent=on:transparency_color=ffffff[p];[b][p]paletteuse\"" : $"-vf {divisionFilter}";
|
||||
string args = $" -loglevel panic -f concat -safe 0 -i {concatFile.Wrap()} {pngComprArg} {sizeStr} {pixFmt} -vsync 0 {vf} \"{outpath}/%{Padding.inputFrames}d.png\"";
|
||||
LogMode logMode = IOUtils.GetAmountOfFiles(inpath, false) > 50 ? LogMode.OnlyLastLine : LogMode.Hidden;
|
||||
await AvProcess.RunFfmpeg(args, logMode, TaskType.ExtractFrames);
|
||||
await RunFfmpeg(args, logMode, TaskType.ExtractFrames);
|
||||
if (delSrc)
|
||||
DeleteSource(inpath);
|
||||
}
|
||||
|
||||
static string GetTrimArg ()
|
||||
{
|
||||
if (!QuickSettingsTab.trimEnabled)
|
||||
return "";
|
||||
|
||||
return $"-ss {QuickSettingsTab.trimStart} -to {QuickSettingsTab.trimEnd}";
|
||||
}
|
||||
|
||||
public static async Task ImportSingleImage(string inputFile, string outPath, Size size)
|
||||
{
|
||||
string sizeStr = (size.Width > 1 && size.Height > 1) ? $"-s {size.Width}x{size.Height}" : "";
|
||||
@@ -80,7 +89,7 @@ namespace Flowframes.Media
|
||||
string comprArg = isPng ? pngComprArg : "";
|
||||
string pixFmt = "-pix_fmt " + (isPng ? $"rgb24 {comprArg}" : "yuvj420p");
|
||||
string args = $"-i {inputFile.Wrap()} {comprArg} {sizeStr} {pixFmt} -vf {divisionFilter} {outPath.Wrap()}";
|
||||
await AvProcess.RunFfmpeg(args, LogMode.Hidden, TaskType.ExtractFrames);
|
||||
await RunFfmpeg(args, LogMode.Hidden, TaskType.ExtractFrames);
|
||||
}
|
||||
|
||||
public static async Task ExtractSingleFrame(string inputFile, string outputPath, int frameNum)
|
||||
@@ -89,19 +98,25 @@ namespace Flowframes.Media
|
||||
string comprArg = isPng ? pngComprArg : "";
|
||||
string pixFmt = "-pix_fmt " + (isPng ? $"rgb24 {comprArg}" : "yuvj420p");
|
||||
string args = $"-i {inputFile.Wrap()} -vf \"select=eq(n\\,{frameNum})\" -vframes 1 {pixFmt} {outputPath.Wrap()}";
|
||||
await AvProcess.RunFfmpeg(args, LogMode.Hidden, TaskType.ExtractFrames);
|
||||
await RunFfmpeg(args, LogMode.Hidden, TaskType.ExtractFrames);
|
||||
}
|
||||
|
||||
public static async Task ExtractLastFrame(string inputFile, string outputPath, Size size)
|
||||
{
|
||||
if (QuickSettingsTab.trimEnabled)
|
||||
return;
|
||||
|
||||
if (IOUtils.IsPathDirectory(outputPath))
|
||||
outputPath = Path.Combine(outputPath, "last.png");
|
||||
|
||||
bool isPng = (Path.GetExtension(outputPath).ToLower() == ".png");
|
||||
string comprArg = isPng ? pngComprArg : "";
|
||||
string pixFmt = "-pix_fmt " + (isPng ? $"rgb24 {comprArg}" : "yuvj420p");
|
||||
string sizeStr = (size.Width > 1 && size.Height > 1) ? $"-s {size.Width}x{size.Height}" : "";
|
||||
string args = $"-sseof -1 -i {inputFile.Wrap()} -update 1 {pixFmt} {sizeStr} {outputPath.Wrap()}";
|
||||
await AvProcess.RunFfmpeg(args, LogMode.Hidden, TaskType.ExtractFrames);
|
||||
string trim = QuickSettingsTab.trimEnabled ? $"-ss {QuickSettingsTab.GetTrimEndMinusOne()} -to {QuickSettingsTab.trimEnd}" : "";
|
||||
string sseof = string.IsNullOrWhiteSpace(trim) ? "-sseof -1" : "";
|
||||
string args = $"{sseof} -i {inputFile.Wrap()} -update 1 {pixFmt} {sizeStr} {trim} {outputPath.Wrap()}";
|
||||
await RunFfmpeg(args, LogMode.Hidden, TaskType.ExtractFrames);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace Flowframes.MiscUtils
|
||||
return Time(elapsedMs);
|
||||
}
|
||||
|
||||
public static long MsFromTimestamp(string timestamp)
|
||||
public static long TimestampToSecs(string timestamp, bool hasMilliseconds = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -65,8 +65,45 @@ namespace Flowframes.MiscUtils
|
||||
int hours = int.Parse(values[0]);
|
||||
int minutes = int.Parse(values[1]);
|
||||
int seconds = int.Parse(values[2].Split('.')[0]);
|
||||
int milliseconds = int.Parse(values[2].Split('.')[1].Substring(0, 2)) * 10;
|
||||
long ms = hours * 3600000 + minutes * 60000 + seconds * 1000 + milliseconds;
|
||||
long secs = hours * 3600000 + minutes * 60000 + seconds;
|
||||
|
||||
if (hasMilliseconds)
|
||||
{
|
||||
int milliseconds = int.Parse(values[2].Split('.')[1].Substring(0, 2)) * 10;
|
||||
|
||||
if (milliseconds >= 500)
|
||||
secs++;
|
||||
}
|
||||
|
||||
return secs;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Log($"TimestampToSecs({timestamp}) Exception: {e.Message}", true);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static long TimestampToMs(string timestamp, bool hasMilliseconds = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
string[] values = timestamp.Split(':');
|
||||
int hours = int.Parse(values[0]);
|
||||
int minutes = int.Parse(values[1]);
|
||||
int seconds = int.Parse(values[2].Split('.')[0]);
|
||||
long ms = 0;
|
||||
|
||||
if (hasMilliseconds)
|
||||
{
|
||||
int milliseconds = int.Parse(values[2].Split('.')[1].Substring(0, 2)) * 10;
|
||||
ms = hours * 3600000 + minutes * 60000 + seconds * 1000 + milliseconds;
|
||||
}
|
||||
else
|
||||
{
|
||||
ms = hours * 3600000 + minutes * 60000 + seconds * 1000;
|
||||
}
|
||||
|
||||
return ms;
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -76,6 +113,11 @@ namespace Flowframes.MiscUtils
|
||||
}
|
||||
}
|
||||
|
||||
public static string SecsToTimestamp(long seconds)
|
||||
{
|
||||
return (new DateTime(1970, 1, 1)).AddSeconds(seconds).ToString("HH:mm:ss");
|
||||
}
|
||||
|
||||
public static string MsToTimestamp(long milliseconds)
|
||||
{
|
||||
return (new DateTime(1970, 1, 1)).AddMilliseconds(milliseconds).ToString("HH:mm:ss");
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace Flowframes.UI
|
||||
|
||||
Logger.Log("Loading metadata...");
|
||||
Program.mainForm.currInDuration = FfmpegCommands.GetDuration(path);
|
||||
Program.mainForm.currInDurationCut = Program.mainForm.currInDuration;
|
||||
int frameCount = await InterpolateUtils.GetInputFrameCountAsync(path);
|
||||
string fpsStr = "Not Found";
|
||||
float fps = await IOUtils.GetFpsFolderOrVideo(path);
|
||||
|
||||
44
Code/UI/QuickSettingsTab.cs
Normal file
44
Code/UI/QuickSettingsTab.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using Flowframes.Media;
|
||||
using Flowframes.IO;
|
||||
using Flowframes.Magick;
|
||||
using Flowframes.Main;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Flowframes.MiscUtils;
|
||||
|
||||
namespace Flowframes.UI
|
||||
{
|
||||
class QuickSettingsTab
|
||||
{
|
||||
public static bool trimEnabled;
|
||||
public static string trimStart;
|
||||
public static string trimEnd;
|
||||
|
||||
public static void UpdateTrim (TextBox trimStartBox, TextBox trimEndBox)
|
||||
{
|
||||
trimStart = trimStartBox.Text.Trim();
|
||||
trimEnd = trimEndBox.Text.Trim();
|
||||
|
||||
long startSecs = FormatUtils.TimestampToSecs(trimStart, false);
|
||||
long endSecs = FormatUtils.TimestampToSecs(trimEnd, false);
|
||||
|
||||
if (endSecs <= startSecs)
|
||||
trimEndBox.Text = FormatUtils.SecsToTimestamp(startSecs + 1);
|
||||
|
||||
long dur = FormatUtils.TimestampToMs(trimStart, false) - FormatUtils.TimestampToMs(trimEnd, false);
|
||||
Program.mainForm.currInDurationCut = dur;
|
||||
}
|
||||
|
||||
public static string GetTrimEndMinusOne ()
|
||||
{
|
||||
TimeSpan minusOne = TimeSpan.Parse(trimEnd).Subtract(new TimeSpan(0, 0, 1));
|
||||
Logger.Log($"returning {minusOne}", true, false, "ffmpeg");
|
||||
return minusOne.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
using Flowframes.Media;
|
||||
using Flowframes.IO;
|
||||
using Flowframes.Magick;
|
||||
using Flowframes.Main;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Flowframes.UI
|
||||
{
|
||||
class UtilsTab
|
||||
{
|
||||
|
||||
public static async Task ExtractVideo(string videoPath, bool withAudio)
|
||||
{
|
||||
string outPath = Path.ChangeExtension(videoPath, null) + "-extracted";
|
||||
Program.mainForm.SetWorking(true);
|
||||
await FfmpegExtract.VideoToFrames(videoPath, Path.Combine(outPath, Paths.framesDir), false, Interpolate.current.inFps, false, false);
|
||||
File.WriteAllText(Path.Combine(outPath, "fps.ini"), Interpolate.current.inFps.ToString());
|
||||
if (withAudio)
|
||||
await FfmpegAudioAndMetadata.ExtractAudio(videoPath, Path.Combine(outPath, "audio"));
|
||||
Program.mainForm.SetWorking(false);
|
||||
Logger.Log("Done.");
|
||||
Program.mainForm.SetProgress(0);
|
||||
}
|
||||
|
||||
public static async Task LoopVideo (string inputFile, ComboBox loopTimes)
|
||||
{
|
||||
if (!InputIsValid(inputFile))
|
||||
return;
|
||||
int times = loopTimes.GetInt();
|
||||
Logger.Log("Lopping video " + times + "x...", true);
|
||||
await FfmpegCommands.LoopVideo(inputFile, times, false);
|
||||
Logger.Log("Done", true);
|
||||
Program.mainForm.SetProgress(0);
|
||||
}
|
||||
|
||||
public static async Task ChangeSpeed(string inputFile, ComboBox speed)
|
||||
{
|
||||
if (!InputIsValid(inputFile))
|
||||
return;
|
||||
float speedFloat = speed.GetFloat();
|
||||
Logger.Log("Creating video with " + speed + "% speed...", true);
|
||||
await FfmpegCommands.ChangeSpeed(inputFile, speedFloat, false);
|
||||
Logger.Log("Done", true);
|
||||
Program.mainForm.SetProgress(0);
|
||||
}
|
||||
|
||||
public static async Task Convert(string inputFile, ComboBox crfBox)
|
||||
{
|
||||
if (!InputIsValid(inputFile))
|
||||
return;
|
||||
int crf = crfBox.GetInt();
|
||||
Logger.Log("Creating MP4 with CRF " + crf + "...", true);
|
||||
if(Path.GetExtension(inputFile).ToUpper() != ".MP4")
|
||||
await FfmpegEncode.Encode(inputFile, "libx264", "aac", crf, 128);
|
||||
else
|
||||
await FfmpegEncode.Encode(inputFile, "libx264", "copy", crf); // Copy audio if input is MP4
|
||||
Logger.Log("Done", true);
|
||||
Program.mainForm.SetProgress(0);
|
||||
}
|
||||
|
||||
static bool InputIsValid (string inPath)
|
||||
{
|
||||
bool isFile = !IOUtils.IsPathDirectory(inPath);
|
||||
if ((isFile && !IOUtils.IsFileValid(inPath)) || (!isFile && !IOUtils.IsDirValid(inPath)))
|
||||
{
|
||||
MessageBox.Show("Input path is not valid!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static async void Dedupe (string inPath, bool testRun)
|
||||
{
|
||||
bool isFile = !IOUtils.IsPathDirectory(inPath);
|
||||
if ((isFile && !IOUtils.IsFileValid(inPath)) || (!isFile && !IOUtils.IsDirValid(inPath)))
|
||||
{
|
||||
MessageBox.Show("Input path is not valid!");
|
||||
return;
|
||||
}
|
||||
|
||||
string framesPath;
|
||||
|
||||
if (isFile)
|
||||
{
|
||||
Logger.Log("Input is a file, not directory");
|
||||
if (!InterpolateUtils.IsVideoValid(inPath))
|
||||
{
|
||||
MessageBox.Show("Input file is not valid!", "Error");
|
||||
return;
|
||||
}
|
||||
Program.mainForm.SetWorking(true);
|
||||
await Task.Delay(10);
|
||||
framesPath = Path.ChangeExtension(inPath, null) + "-frames";
|
||||
Directory.CreateDirectory(framesPath);
|
||||
await Interpolate.ExtractFrames(inPath, framesPath, false, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
framesPath = inPath;
|
||||
}
|
||||
Program.mainForm.SetWorking(true);
|
||||
Logger.Log("Running frame de-duplication", true);
|
||||
await Task.Delay(10);
|
||||
await Magick.Dedupe.Run(framesPath, testRun);
|
||||
IOUtils.TryDeleteIfExists(framesPath);
|
||||
Program.mainForm.SetProgress(0);
|
||||
Program.mainForm.SetWorking(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user