jjbell170 / lazy-compress-h265

Compress or convert your video files to h.265 (hevc) format with one-click, make its size much smaller!
0 stars 0 forks source link

Sweep: The current arguments for FFMPEG uses the hevc codec, which uses the CPU. Add hevc_nvenc (for NVIDIA cuda acceleration) as an option #1

Closed jjbell170 closed 3 months ago

jjbell170 commented 3 months ago
Checklist - [X] Modify `Form1.Designer.cs` ✓ https://github.com/jjbell170/lazy-compress-h265/commit/e0e8cf4dee481368b89694949545e6d886c2a6ab [Edit](https://github.com/jjbell170/lazy-compress-h265/edit/sweep/the_current_arguments_for_ffmpeg_uses_th/Form1.Designer.cs) - [X] Modify `Form1.cs` ✓ https://github.com/jjbell170/lazy-compress-h265/commit/e0e8cf4dee481368b89694949545e6d886c2a6ab [Edit](https://github.com/jjbell170/lazy-compress-h265/edit/sweep/the_current_arguments_for_ffmpeg_uses_th/Form1.cs)
sweep-ai[bot] commented 3 months ago

🚀 Here's the PR! #4

See Sweep's progress at the progress dashboard!
💎 Sweep Pro: I'm using GPT-4. You have unlimited GPT-4 tickets. (tracking ID: ae8aef2dce)
Install Sweep Configs: Pull Request

[!TIP] I can email you next time I complete a pull request if you set up your email here!


Actions (click)


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I think are relevant in decreasing order of relevance (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/jjbell170/lazy-compress-h265/blob/ac63e215ff4a3b4888640da6a272ead2549687ef/Form1.cs#L1-L278 https://github.com/jjbell170/lazy-compress-h265/blob/ac63e215ff4a3b4888640da6a272ead2549687ef/Form1.Designer.cs#L1-L167

Step 2: ⌨️ Coding

this.buttonContextMenu.Click += new System.EventHandler(this.button3_Click); // // label1 // this.label1.Location = new System.Drawing.Point(12, 99); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(100, 23); this.label1.TabIndex = 7; this.label1.Text = "Task List"; // // dataGridView1 // this.dataGridView1.AllowUserToAddRows = false; this.dataGridView1.AllowUserToDeleteRows = false; this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.ButtonHighlight; this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {this.FilePath, this.Status}); this.dataGridView1.Location = new System.Drawing.Point(12, 120); this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.ReadOnly = true; this.dataGridView1.RowTemplate.Height = 24; this.dataGridView1.Size = new System.Drawing.Size(586, 141); this.dataGridView1.TabIndex = 8; this.buttonContextMenu.Click += new System.EventHandler(this.button3_Click); // // checkBoxNvenc // this.checkBoxNvenc.AutoSize = true; this.checkBoxNvenc.Location = new System.Drawing.Point(224, 50); this.checkBoxNvenc.Name = "checkBoxNvenc"; this.checkBoxNvenc.Size = new System.Drawing.Size(134, 21); this.checkBoxNvenc.TabIndex = 6; this.checkBoxNvenc.Text = "Use NVIDIA CUDA"; this.checkBoxNvenc.UseVisualStyleBackColor = true; // // label1 // this.label1.Location = new System.Drawing.Point(12, 99); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(100, 23); this.label1.TabIndex = 7; this.label1.Text = "Task List"; // // dataGridView1 // this.dataGridView1.AllowUserToAddRows = false; this.dataGridView1.AllowUserToDeleteRows = false; this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.ButtonHighlight; this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {this.FilePath, this.Status}); this.dataGridView1.Location = new System.Drawing.Point(12, 120); this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.ReadOnly = true; this.dataGridView1.RowTemplate.Height = 24; this.dataGridView1.Size = new System.Drawing.Size(586, 141); this.dataGridView1.TabIndex = 8;

// Converting 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.UseShellExecute = false; process.StartInfo.CreateNoWindow = true; MessageBox.Show(process.StartInfo.Arguments); var rowID = nextTaskID++; var msgQueue = new Queue(); dataGridView1.Rows.Insert(rowID, shortName, "Preparing..."); var row = dataGridView1.Rows[rowID]; process.StartInfo.RedirectStandardError = true; process.ErrorDataReceived += (errorEvent,errorArgs) => { if (errorArgs.Data == null || errorArgs.Data.Trim() == "") { return; } msgQueue.Enqueue(errorArgs.Data); if (msgQueue.Count == 5) { msgQueue.Dequeue(); } row.Cells[1].Value = String.Join(" | ", msgQueue.Reverse()); }; string videoCodec = checkBoxNvenc.Checked ? "hevc_nvenc" : "hevc"; // Converting process.StartInfo.FileName = "ffmpeg.exe"; process.StartInfo.Arguments = $" -i \"{inputFilename}\" -vcodec {videoCodec} -map_metadata 0 -vf yadif -crf 20 -preset medium {fpsParam} \"{outputFilename}\""; process.StartInfo.UseShellExecute = false; process.StartInfo.CreateNoWindow = true; MessageBox.Show(process.StartInfo.Arguments); var rowID = nextTaskID++; var msgQueue = new Queue(); dataGridView1.Rows.Insert(rowID, shortName, "Preparing..."); var row = dataGridView1.Rows[rowID]; process.StartInfo.RedirectStandardError = true; process.ErrorDataReceived += (errorEvent,errorArgs) => { if (errorArgs.Data == null || errorArgs.Data.Trim() == "") { return; } msgQueue.Enqueue(errorArgs.Data); if (msgQueue.Count == 5) { msgQueue.Dequeue(); } row.Cells[1].Value = String.Join(" | ", msgQueue.Reverse()); };


Step 3: 🔁 Code Review

I have finished reviewing the code for completeness. I did not find errors for sweep/the_current_arguments_for_ffmpeg_uses_th.


🎉 Latest improvements to Sweep:
  • New dashboard launched for real-time tracking of Sweep issues, covering all stages from search to coding.
  • Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.
  • Use the GitHub issues extension for creating Sweep issues directly from your editor.

💡 To recreate the pull request edit the issue title or description. Something wrong? Let us know.

This is an automated message generated by Sweep AI.

jjbell170 commented 3 months ago

Will this also apply when using the context menu?