Add ProRes for "Generate video with burned-in sub"

This commit is contained in:
niksedk 2023-06-02 20:07:47 +02:00
parent 8f1bbb3b3f
commit 4cda9dcba7
3 changed files with 98 additions and 9 deletions

View File

@ -153,7 +153,7 @@ namespace Nikse.SubtitleEdit.Forms
this.contextMenuStripGenerate.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.contextMenuStripGenerate.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.promptParameterBeforeGenerateToolStripMenuItem}); this.promptParameterBeforeGenerateToolStripMenuItem});
this.contextMenuStripGenerate.Name = "contextMenuStripGenerate"; this.contextMenuStripGenerate.Name = "contextMenuStripGenerate";
this.contextMenuStripGenerate.Size = new System.Drawing.Size(290, 48); this.contextMenuStripGenerate.Size = new System.Drawing.Size(290, 26);
// //
// promptParameterBeforeGenerateToolStripMenuItem // promptParameterBeforeGenerateToolStripMenuItem
// //
@ -670,7 +670,8 @@ namespace Nikse.SubtitleEdit.Forms
"h264_nvenc", "h264_nvenc",
"hevc_nvenc", "hevc_nvenc",
"h264_amf", "h264_amf",
"hevc_amf"}); "hevc_amf",
"prores_ks"});
this.comboBoxVideoEncoding.Location = new System.Drawing.Point(95, 58); this.comboBoxVideoEncoding.Location = new System.Drawing.Point(95, 58);
this.comboBoxVideoEncoding.Name = "comboBoxVideoEncoding"; this.comboBoxVideoEncoding.Name = "comboBoxVideoEncoding";
this.comboBoxVideoEncoding.Size = new System.Drawing.Size(121, 21); this.comboBoxVideoEncoding.Size = new System.Drawing.Size(121, 21);

View File

@ -296,6 +296,11 @@ namespace Nikse.SubtitleEdit.Forms
using (var saveDialog = new SaveFileDialog { FileName = SuggestNewVideoFileName(), Filter = "MP4|*.mp4|Matroska|*.mkv|WebM|*.webm", AddExtension = true }) using (var saveDialog = new SaveFileDialog { FileName = SuggestNewVideoFileName(), Filter = "MP4|*.mp4|Matroska|*.mkv|WebM|*.webm", AddExtension = true })
{ {
if (comboBoxVideoEncoding.Text == "prores_ks")
{
saveDialog.Filter = "mov|*.mov|Matroska|*.mkv|Material eXchange Format|*.mxf";
}
if (saveDialog.ShowDialog(this) != DialogResult.OK) if (saveDialog.ShowDialog(this) != DialogResult.OK)
{ {
buttonGenerate.Enabled = true; buttonGenerate.Enabled = true;
@ -475,6 +480,10 @@ namespace Nikse.SubtitleEdit.Forms
{ {
fileName += ".vp9"; fileName += ".vp9";
} }
else if (comboBoxVideoEncoding.Text == "prores_ks")
{
fileName += ".ProRes";
}
else else
{ {
fileName += ".x264"; fileName += ".x264";
@ -485,6 +494,11 @@ namespace Nikse.SubtitleEdit.Forms
fileName += $".{numericUpDownCutFromHours.Text}-{numericUpDownCutFromMinutes.Text}-{numericUpDownCutFromSeconds.Text}_{numericUpDownCutToHours.Text}-{numericUpDownCutToMinutes.Text}-{numericUpDownCutToSeconds.Text}"; fileName += $".{numericUpDownCutFromHours.Text}-{numericUpDownCutFromMinutes.Text}-{numericUpDownCutFromSeconds.Text}_{numericUpDownCutToHours.Text}-{numericUpDownCutToMinutes.Text}-{numericUpDownCutToSeconds.Text}";
} }
if (comboBoxVideoEncoding.Text == "prores_ks")
{
return fileName.Replace(".", "_") + ".mov";
}
return fileName.Replace(".", "_") + ".mp4"; return fileName.Replace(".", "_") + ".mp4";
} }
@ -830,6 +844,10 @@ namespace Nikse.SubtitleEdit.Forms
{ {
UiUtil.OpenUrl("https://trac.ffmpeg.org/wiki/HWAccelIntro"); UiUtil.OpenUrl("https://trac.ffmpeg.org/wiki/HWAccelIntro");
} }
else if (comboBoxVideoEncoding.Text == "prores_ks")
{
UiUtil.OpenUrl("https://ottverse.com/ffmpeg-convert-to-apple-prores-422-4444-hq");
}
else else
{ {
UiUtil.OpenUrl("http://trac.ffmpeg.org/wiki/Encode/H.264"); UiUtil.OpenUrl("http://trac.ffmpeg.org/wiki/Encode/H.264");
@ -869,7 +887,10 @@ namespace Nikse.SubtitleEdit.Forms
comboBoxCrf.Items.Add(string.Empty); comboBoxCrf.Items.Add(string.Empty);
labelTune.Visible = true; labelTune.Visible = true;
comboBoxTune.Visible = true; comboBoxTune.Visible = true;
labelCRF.Text = "CRF"; labelCRF.Visible = true;
comboBoxCrf.Visible = true;
labelPreset.Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.Preset;
labelCRF.Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.Crf;
labelCrfHint.Text = string.Empty; labelCrfHint.Text = string.Empty;
FillPresets(comboBoxVideoEncoding.Text); FillPresets(comboBoxVideoEncoding.Text);
@ -921,6 +942,19 @@ namespace Nikse.SubtitleEdit.Forms
labelCrfHint.Text = "0=best quality, 10=best speed"; labelCrfHint.Text = "0=best quality, 10=best speed";
comboBoxCrf.Text = string.Empty; comboBoxCrf.Text = string.Empty;
} }
else if (comboBoxVideoEncoding.Text == "prores_ks")
{
labelPreset.Text = "Profile";
comboBoxPreset.SelectedItem = 2;
// https://ottverse.com/ffmpeg-convert-to-apple-prores-422-4444-hq/
labelCRF.Visible = false;
comboBoxCrf.Visible = false;
labelTune.Visible = false;
comboBoxTune.Visible = false;
}
else else
{ {
for (var i = 17; i <= 28; i++) for (var i = 17; i <= 28; i++)
@ -931,7 +965,6 @@ namespace Nikse.SubtitleEdit.Forms
comboBoxCrf.Text = "23"; comboBoxCrf.Text = "23";
} }
comboBoxCrf.EndUpdate(); comboBoxCrf.EndUpdate();
} }
private void FillTuneIn(string videoCodec) private void FillTuneIn(string videoCodec)
@ -1006,10 +1039,7 @@ namespace Nikse.SubtitleEdit.Forms
} }
else if (videoCodec == "hevc_amf") else if (videoCodec == "hevc_amf")
{ {
items = new List<string> items = new List<string> { string.Empty };
{
string.Empty,
};
} }
else if (videoCodec == "libvpx-vp9") else if (videoCodec == "libvpx-vp9")
{ {
@ -1018,6 +1048,13 @@ namespace Nikse.SubtitleEdit.Forms
comboBoxTune.Visible = false; comboBoxTune.Visible = false;
comboBoxTune.Text = string.Empty; comboBoxTune.Text = string.Empty;
} }
else if (videoCodec == "prores_ks")
{
items = new List<string> { string.Empty };
labelTune.Visible = false;
comboBoxTune.Visible = false;
comboBoxTune.Text = string.Empty;
}
comboBoxTune.Items.Clear(); comboBoxTune.Items.Clear();
foreach (var item in items) foreach (var item in items)
@ -1111,6 +1148,18 @@ namespace Nikse.SubtitleEdit.Forms
{ {
items = new List<string> { string.Empty }; items = new List<string> { string.Empty };
} }
else if (videoCodec == "prores_ks")
{
items = new List<string>
{
"proxy",
"lt",
"standard",
"hq",
"4444",
"4444xq",
};
}
comboBoxPreset.Items.Clear(); comboBoxPreset.Items.Clear();
foreach (var item in items) foreach (var item in items)

View File

@ -104,7 +104,46 @@ namespace Nikse.SubtitleEdit.Logic
var presetSettings = string.Empty; var presetSettings = string.Empty;
if (!string.IsNullOrEmpty(preset)) if (!string.IsNullOrEmpty(preset))
{ {
presetSettings = $" -preset {preset}"; if (videoEncoding == "prores_ks")
{
if (preset == "proxy")
{
preset = "0";
}
else if (preset == "lt")
{
preset = "1";
}
else if (preset == "standard")
{
preset = "2";
}
else if (preset == "hq")
{
preset = "3";
}
else if (preset == "4444")
{
preset = "4";
}
else if (preset == "4444xq")
{
preset = "5";
}
else
{
preset = string.Empty;
}
if (!string.IsNullOrEmpty(preset))
{
presetSettings = $" -profile:v {preset}";
}
}
else
{
presetSettings = $" -preset {preset}";
}
} }
var crfSettings = string.Empty; var crfSettings = string.Empty;