diff --git a/BizHawk.Client.EmuHawk/AVOut/FFmpegWriter.cs b/BizHawk.Client.EmuHawk/AVOut/FFmpegWriter.cs index 367e50bf3c..2a1cee9ad9 100644 --- a/BizHawk.Client.EmuHawk/AVOut/FFmpegWriter.cs +++ b/BizHawk.Client.EmuHawk/AVOut/FFmpegWriter.cs @@ -308,7 +308,7 @@ namespace BizHawk.Client.EmuHawk public string DesiredExtension() { // this needs to interface with the codec token - return _token.Defaultext; + return _token.Extension; } public void SetDefaultVideoCodecToken() diff --git a/BizHawk.Client.EmuHawk/AVOut/FFmpegWriterForm.Designer.cs b/BizHawk.Client.EmuHawk/AVOut/FFmpegWriterForm.Designer.cs index a91075f162..f95e6f3d62 100644 --- a/BizHawk.Client.EmuHawk/AVOut/FFmpegWriterForm.Designer.cs +++ b/BizHawk.Client.EmuHawk/AVOut/FFmpegWriterForm.Designer.cs @@ -28,133 +28,132 @@ /// private void InitializeComponent() { - this.label1 = new System.Windows.Forms.Label(); - this.listBox1 = new System.Windows.Forms.ListBox(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.textBox1 = new System.Windows.Forms.TextBox(); - this.button1 = new System.Windows.Forms.Button(); - this.button2 = new System.Windows.Forms.Button(); - this.label5 = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(5, 5); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(47, 13); - this.label1.TabIndex = 0; - this.label1.Text = "Formats:"; - // - // listBox1 - // - this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.label1 = new System.Windows.Forms.Label(); + this.listBox1 = new System.Windows.Forms.ListBox(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.label5 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(5, 5); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(47, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Formats:"; + // + // listBox1 + // + this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.listBox1.FormattingEnabled = true; - this.listBox1.Location = new System.Drawing.Point(5, 23); - this.listBox1.Name = "listBox1"; - this.listBox1.Size = new System.Drawing.Size(275, 147); - this.listBox1.TabIndex = 1; - this.listBox1.SelectedIndexChanged += new System.EventHandler(this.ListBox1_SelectedIndexChanged); - // - // label2 - // - this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(7, 176); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(63, 13); - this.label2.TabIndex = 2; - this.label2.Text = "Description:"; - // - // label3 - // - this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(6, 193); - this.label3.MaximumSize = new System.Drawing.Size(260, 0); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(0, 13); - this.label3.TabIndex = 3; - // - // label4 - // - this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(10, 255); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(57, 13); - this.label4.TabIndex = 4; - this.label4.Text = "Command:"; - // - // textBox1 - // - this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + this.listBox1.FormattingEnabled = true; + this.listBox1.Location = new System.Drawing.Point(5, 23); + this.listBox1.Name = "listBox1"; + this.listBox1.Size = new System.Drawing.Size(275, 160); + this.listBox1.TabIndex = 1; + this.listBox1.SelectedIndexChanged += new System.EventHandler(this.ListBox1_SelectedIndexChanged); + // + // label2 + // + this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(7, 189); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(63, 13); + this.label2.TabIndex = 2; + this.label2.Text = "Description:"; + // + // label3 + // + this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(6, 206); + this.label3.MaximumSize = new System.Drawing.Size(260, 0); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(0, 13); + this.label3.TabIndex = 3; + // + // label4 + // + this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(10, 268); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(57, 13); + this.label4.TabIndex = 4; + this.label4.Text = "Command:"; + // + // textBox1 + // + this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.textBox1.Location = new System.Drawing.Point(8, 273); - this.textBox1.Name = "textBox1"; - this.textBox1.ReadOnly = true; - this.textBox1.Size = new System.Drawing.Size(272, 20); - this.textBox1.TabIndex = 5; - // - // button1 - // - this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.button1.DialogResult = System.Windows.Forms.DialogResult.OK; - this.button1.Location = new System.Drawing.Point(124, 314); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(75, 23); - this.button1.TabIndex = 6; - this.button1.Text = "OK"; - this.button1.UseVisualStyleBackColor = true; - // - // button2 - // - this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.button2.Location = new System.Drawing.Point(205, 314); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(75, 23); - this.button2.TabIndex = 7; - this.button2.Text = "Cancel"; - this.button2.UseVisualStyleBackColor = true; - // - // label5 - // - this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(159, 176); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(56, 13); - this.label5.TabIndex = 8; - this.label5.Text = "Extension:"; - // - // FFmpegWriterForm - // - this.AcceptButton = this.button1; - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.CancelButton = this.button2; - this.ClientSize = new System.Drawing.Size(292, 349); - this.Controls.Add(this.label5); - this.Controls.Add(this.button2); - this.Controls.Add(this.button1); - this.Controls.Add(this.textBox1); - this.Controls.Add(this.label4); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); - this.Controls.Add(this.listBox1); - this.Controls.Add(this.label1); - this.MinimumSize = new System.Drawing.Size(300, 360); - this.Name = "FFmpegWriterForm"; - this.ShowIcon = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Choose Video Format"; - this.ResumeLayout(false); - this.PerformLayout(); + this.textBox1.Location = new System.Drawing.Point(8, 286); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(272, 20); + this.textBox1.TabIndex = 5; + // + // button1 + // + this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.button1.DialogResult = System.Windows.Forms.DialogResult.OK; + this.button1.Location = new System.Drawing.Point(124, 327); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 6; + this.button1.Text = "OK"; + this.button1.UseVisualStyleBackColor = true; + // + // button2 + // + this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.button2.Location = new System.Drawing.Point(205, 327); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(75, 23); + this.button2.TabIndex = 7; + this.button2.Text = "Cancel"; + this.button2.UseVisualStyleBackColor = true; + // + // label5 + // + this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(159, 189); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(56, 13); + this.label5.TabIndex = 8; + this.label5.Text = "Extension:"; + // + // FFmpegWriterForm + // + this.AcceptButton = this.button1; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.button2; + this.ClientSize = new System.Drawing.Size(292, 362); + this.Controls.Add(this.label5); + this.Controls.Add(this.button2); + this.Controls.Add(this.button1); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.listBox1); + this.Controls.Add(this.label1); + this.MinimumSize = new System.Drawing.Size(300, 360); + this.Name = "FFmpegWriterForm"; + this.ShowIcon = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Choose Video Format"; + this.ResumeLayout(false); + this.PerformLayout(); } diff --git a/BizHawk.Client.EmuHawk/AVOut/FFmpegWriterForm.cs b/BizHawk.Client.EmuHawk/AVOut/FFmpegWriterForm.cs index 8de8b2cb29..12d526efd0 100644 --- a/BizHawk.Client.EmuHawk/AVOut/FFmpegWriterForm.cs +++ b/BizHawk.Client.EmuHawk/AVOut/FFmpegWriterForm.cs @@ -38,7 +38,7 @@ namespace BizHawk.Client.EmuHawk /// /// Gets the default file extension /// - public string Defaultext { get; } + public string Extension { get; set; } /// /// get a list of canned presets @@ -48,8 +48,10 @@ namespace BizHawk.Client.EmuHawk { return new[] { - new FormatPreset("AVI Lossless", "Lossless AVC video and uncompressed audio in an AVI container. High speed and compression, compatible with AVISource().", - "-c:a pcm_s16le -c:v libx264rgb -qp 0 -preset ultrafast -g 30 -pix_fmt rgb24 -f avi", false, "avi"), + new FormatPreset("AVI Lossless AVC", "Lossless AVC video and uncompressed audio in an AVI container. High speed and compression, compatible with AVISource().", + "-c:a pcm_s16le -c:v libx264rgb -qp 0 -preset ultrafast -g 10 -pix_fmt rgb24 -f avi", false, "avi"), + new FormatPreset("AVI Lossless FFV1", "Lossless FFV1 video and uncompressed audio in an AVI container. Compatible with AVISource(), if ffmpeg based decoder is installed.", + "-c:a pcm_s16le -c:v ffv1 -pix_fmt bgr0 -level 1 -g 1 -coder 1 -context 1 -f avi", false, "avi"), new FormatPreset("AVI Uncompressed", "Uncompressed video and audio in an AVI container. Very large, don't use!", "-c:a pcm_s16le -c:v rawvideo -f avi", false, "avi"), new FormatPreset("Matroska Lossless", "Lossless AVC video and uncompressed audio in a Matroska container.", @@ -104,7 +106,19 @@ namespace BizHawk.Client.EmuHawk { } - private FormatPreset(string name, string desc, string commandline, bool custom, string defaultext) + public void DeduceFormat(string commandline) + { + string formatkey = "-f "; + Extension = commandline.Substring(commandline.IndexOf(formatkey) + formatkey.Length); + + // are there other formats that don't match their file extensions? + if (Extension == "matroska") + { + Extension = "mkv"; + } + } + + private FormatPreset(string name, string desc, string commandline, bool custom, string ext) { Name = name; Desc = desc; @@ -114,7 +128,7 @@ namespace BizHawk.Client.EmuHawk ? Global.Config.FFmpegCustomCommand : commandline; - Defaultext = defaultext; + DeduceFormat(Commandline); } } @@ -128,11 +142,9 @@ namespace BizHawk.Client.EmuHawk if (listBox1.SelectedIndex != -1) { var f = (FormatPreset)listBox1.SelectedItem; - - label5.Text = "Extension: " + f.Defaultext; + label5.Text = "Extension: " + f.Extension; label3.Text = f.Desc; textBox1.Text = f.Commandline; - textBox1.ReadOnly = !f.Custom; } } @@ -163,8 +175,11 @@ namespace BizHawk.Client.EmuHawk Global.Config.FFmpegFormat = ret.ToString(); if (ret.Custom) { - ret.Commandline = dlg.textBox1.Text; - Global.Config.FFmpegCustomCommand = dlg.textBox1.Text; + ret.Commandline = + Global.Config.FFmpegCustomCommand = + dlg.textBox1.Text; + + ret.DeduceFormat(ret.Commandline); } }