Compare commits
No commits in common. "master" and "1.1" have entirely different histories.
|
@ -109,7 +109,7 @@
|
||||||
this.dataGridView1.Name = "dataGridView1";
|
this.dataGridView1.Name = "dataGridView1";
|
||||||
this.dataGridView1.ReadOnly = true;
|
this.dataGridView1.ReadOnly = true;
|
||||||
this.dataGridView1.RowTemplate.Height = 24;
|
this.dataGridView1.RowTemplate.Height = 24;
|
||||||
this.dataGridView1.Size = new System.Drawing.Size(586, 141);
|
this.dataGridView1.Size = new System.Drawing.Size(587, 141);
|
||||||
this.dataGridView1.TabIndex = 8;
|
this.dataGridView1.TabIndex = 8;
|
||||||
//
|
//
|
||||||
// FilePath
|
// FilePath
|
||||||
|
@ -117,7 +117,6 @@
|
||||||
this.FilePath.HeaderText = "File Path";
|
this.FilePath.HeaderText = "File Path";
|
||||||
this.FilePath.Name = "FilePath";
|
this.FilePath.Name = "FilePath";
|
||||||
this.FilePath.ReadOnly = true;
|
this.FilePath.ReadOnly = true;
|
||||||
this.FilePath.Width = 272;
|
|
||||||
//
|
//
|
||||||
// Status
|
// Status
|
||||||
//
|
//
|
||||||
|
|
65
Form1.cs
65
Form1.cs
|
@ -22,8 +22,6 @@ namespace CompressH265 {
|
||||||
|
|
||||||
private int runningProcessCount = 0;
|
private int runningProcessCount = 0;
|
||||||
|
|
||||||
private LinkedList<Process> processList = new LinkedList<Process>();
|
|
||||||
|
|
||||||
public Form1() {
|
public Form1() {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
@ -116,24 +114,11 @@ namespace CompressH265 {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get FPS
|
|
||||||
var fps = GetFPS(inputFilename);
|
|
||||||
var fpsParam = "";
|
|
||||||
|
|
||||||
if (fps > 0) {
|
|
||||||
fpsParam = "-r " + fps;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Converting
|
|
||||||
process.StartInfo.FileName = "ffmpeg.exe";
|
process.StartInfo.FileName = "ffmpeg.exe";
|
||||||
process.StartInfo.Arguments = $" -i \"{inputFilename}\" -vcodec hevc -map_metadata 0 -vf yadif -crf 20 -preset medium {fpsParam} \"{outputFilename}\"";
|
process.StartInfo.Arguments = $"-i \"{inputFilename}\" -vcodec hevc -map_metadata 0 \"{outputFilename}\"";
|
||||||
process.StartInfo.UseShellExecute = false;
|
process.StartInfo.UseShellExecute = false;
|
||||||
process.StartInfo.CreateNoWindow = true;
|
process.StartInfo.CreateNoWindow = true;
|
||||||
|
|
||||||
MessageBox.Show(process.StartInfo.Arguments);
|
|
||||||
|
|
||||||
var rowID = nextTaskID++;
|
var rowID = nextTaskID++;
|
||||||
var msgQueue = new Queue<string>();
|
var msgQueue = new Queue<string>();
|
||||||
dataGridView1.Rows.Insert(rowID, shortName, "Preparing...");
|
dataGridView1.Rows.Insert(rowID, shortName, "Preparing...");
|
||||||
|
@ -175,41 +160,6 @@ namespace CompressH265 {
|
||||||
runningProcessCount++;
|
runningProcessCount++;
|
||||||
process.Start();
|
process.Start();
|
||||||
process.BeginErrorReadLine();
|
process.BeginErrorReadLine();
|
||||||
|
|
||||||
processList.AddLast(process);
|
|
||||||
}
|
|
||||||
|
|
||||||
private float GetFPS(string inputFilename) {
|
|
||||||
Process process = new Process();
|
|
||||||
process.StartInfo.FileName = "ffmpeg.exe";
|
|
||||||
process.StartInfo.Arguments = $"-i \"{inputFilename}\"";
|
|
||||||
process.StartInfo.UseShellExecute = false;
|
|
||||||
process.StartInfo.CreateNoWindow = true;
|
|
||||||
process.StartInfo.RedirectStandardError = true;
|
|
||||||
process.Start();
|
|
||||||
process.WaitForExit();
|
|
||||||
string err = process.StandardError.ReadToEnd();
|
|
||||||
|
|
||||||
var end = err.IndexOf(" fps,");
|
|
||||||
|
|
||||||
if (end < 0) {
|
|
||||||
return -1f;
|
|
||||||
}
|
|
||||||
|
|
||||||
var start = end;
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
if (err[start - 1] == ' ') {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
start--;
|
|
||||||
|
|
||||||
if (start < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return float.Parse(err.Substring(start, end - start));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void button3_Click(object sender, EventArgs e) {
|
private void button3_Click(object sender, EventArgs e) {
|
||||||
|
@ -265,16 +215,13 @@ namespace CompressH265 {
|
||||||
|
|
||||||
private void Form1_FormClosing(object sender, FormClosingEventArgs e) {
|
private void Form1_FormClosing(object sender, FormClosingEventArgs e) {
|
||||||
if (runningProcessCount > 0) {
|
if (runningProcessCount > 0) {
|
||||||
var result = MessageBox.Show("Are you sure want to stop the processing?", "Stop process", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
var result = MessageBox.Show("Are you sure want to stop the processing?", "Stop process",
|
||||||
|
MessageBoxButtons.YesNo,
|
||||||
|
MessageBoxIcon.Question);
|
||||||
|
|
||||||
if (result == DialogResult.Yes) {
|
e.Cancel = (result == DialogResult.No);
|
||||||
foreach (var p in processList) {
|
|
||||||
p.Kill();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
e.Cancel = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.3.0.0")]
|
[assembly: AssemblyVersion("1.1.0.0")]
|
||||||
[assembly: AssemblyFileVersion("1.3.0.0")]
|
[assembly: AssemblyFileVersion("1.1.0.0")]
|
Loading…
Reference in New Issue