Export FCP + image: fix out duration + add format + frame rate customizable - thx Markus :)

This commit is contained in:
niksedk 2015-07-29 11:39:21 +02:00
parent 93a50bd0a9
commit d5b1b33f98

View File

@ -662,16 +662,28 @@ namespace Nikse.SubtitleEdit.Forms
<displayformat>NDF</displayformat> <displayformat>NDF</displayformat>
</timecode> </timecode>
<in>0</in> <in>0</in>
<out>36066</out> <out>[OUT]</out>
<media> <media>
<video> <video>
<format>
<samplecharacteristics>
<rate>
<timebase>25</timebase>
</rate>
<width>1920</width>
<height>1080</height>
<anamorphic>FALSE</anamorphic>
<pixelaspectratio>square</pixelaspectratio>
<fielddominance>none</fielddominance>
<colordepth>32</colordepth>
</samplecharacteristics>
</format>
<track> <track>
<enabled>TRUE</enabled> <enabled>TRUE</enabled>
<locked>FALSE</locked> <locked>FALSE</locked>
</track> </track>
<track> <track>
" + sb + " + sb + @" <enabled>TRUE</enabled>
@" <enabled>TRUE</enabled>
<locked>FALSE</locked> <locked>FALSE</locked>
</track> </track>
</video> </video>
@ -701,6 +713,24 @@ namespace Nikse.SubtitleEdit.Forms
<ismasterclip>FALSE</ismasterclip> <ismasterclip>FALSE</ismasterclip>
</sequence> </sequence>
</xmeml>"; </xmeml>";
s = s.Replace("<timebase>25</timebase>", "<timebase>" + comboBoxFrameRate.Text + "</timebase>");
if (_subtitle.Paragraphs.Count > 0)
{
var end = (int)Math.Round(_subtitle.Paragraphs[_subtitle.Paragraphs.Count - 1].EndTime.TotalSeconds * FrameRate);
end ++;
s = s.Replace("[OUT]", end.ToString(CultureInfo.InvariantCulture));
}
if (comboBoxLanguage.Text == "NTSC")
s = s.Replace("<ntsc>FALSE</ntsc>", "<ntsc>TRUE</ntsc>");
s = s.Replace("<width>1920</width>", "<width>" + width.ToString(CultureInfo.InvariantCulture) + "</width>");
s = s.Replace("<height>1080</height>", "<height>" + height.ToString(CultureInfo.InvariantCulture) + "</height>");
if (comboBoxImageFormat.Text.Contains("8-bit"))
s = s.Replace("<colordepth>32</colordepth>", "<colordepth>8</colordepth>");
File.WriteAllText(Path.Combine(folderBrowserDialog1.SelectedPath, saveFileDialog1.FileName), s); File.WriteAllText(Path.Combine(folderBrowserDialog1.SelectedPath, saveFileDialog1.FileName), s);
MessageBox.Show(string.Format(Configuration.Settings.Language.ExportPngXml.XImagesSavedInY, imagesSavedCount, Path.GetDirectoryName(saveFileDialog1.FileName))); MessageBox.Show(string.Format(Configuration.Settings.Language.ExportPngXml.XImagesSavedInY, imagesSavedCount, Path.GetDirectoryName(saveFileDialog1.FileName)));
} }
@ -1182,14 +1212,10 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
} }
imagesSavedCount++; imagesSavedCount++;
int duration = (int)Math.Round(param.P.Duration.TotalSeconds * 25.0); int duration = (int)Math.Round(param.P.Duration.TotalSeconds * param.FramesPerSeconds);
int start = (int)Math.Round(param.P.StartTime.TotalSeconds * 25.0); int start = (int)Math.Round(param.P.StartTime.TotalSeconds * param.FramesPerSeconds);
int end = (int)Math.Round(param.P.EndTime.TotalSeconds * 25.0); int end = (int)Math.Round(param.P.EndTime.TotalSeconds * param.FramesPerSeconds);
if (param.VideoResolution.StartsWith("NTSC"))
{
template = template.Replace("<ntsc>FALSE</ntsc>", "<ntsc>TRUE</ntsc>");
}
template = template.Replace("[DURATION]", duration.ToString(CultureInfo.InvariantCulture)); template = template.Replace("[DURATION]", duration.ToString(CultureInfo.InvariantCulture));
template = template.Replace("[IN]", start.ToString(CultureInfo.InvariantCulture)); template = template.Replace("[IN]", start.ToString(CultureInfo.InvariantCulture));
template = template.Replace("[OUT]", end.ToString(CultureInfo.InvariantCulture)); template = template.Replace("[OUT]", end.ToString(CultureInfo.InvariantCulture));
@ -2055,7 +2081,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
var lastLine = lines[lines.Length - 1]; var lastLine = lines[lines.Length - 1];
if (lastLine.Contains(new[] { 'g', 'j', 'p', 'q', 'y', ',', 'ý', 'ę', 'ç', 'Ç' })) if (lastLine.Contains(new[] { 'g', 'j', 'p', 'q', 'y', ',', 'ý', 'ę', 'ç', 'Ç' }))
{ {
var textNoBelow = lastLine.Replace('g', 'a').Replace('j', 'a').Replace('p', 'a').Replace('q', 'a').Replace('y', 'a').Replace(',', 'a').Replace('ý', 'a').Replace('ę', 'a').Replace('ç' , 'a').Replace('Ç' , 'a'); var textNoBelow = lastLine.Replace('g', 'a').Replace('j', 'a').Replace('p', 'a').Replace('q', 'a').Replace('y', 'a').Replace(',', 'a').Replace('ý', 'a').Replace('ę', 'a').Replace('ç', 'a').Replace('Ç', 'a');
baseLinePadding -= (int)Math.Round((TextDraw.MeasureTextHeight(font, lastLine, parameter.SubtitleFontBold) - TextDraw.MeasureTextHeight(font, textNoBelow, parameter.SubtitleFontBold))); baseLinePadding -= (int)Math.Round((TextDraw.MeasureTextHeight(font, lastLine, parameter.SubtitleFontBold) - TextDraw.MeasureTextHeight(font, textNoBelow, parameter.SubtitleFontBold)));
} }
else else
@ -2811,7 +2837,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
comboBoxImageFormat.Visible = showImageFormat; comboBoxImageFormat.Visible = showImageFormat;
labelImageFormat.Visible = showImageFormat; labelImageFormat.Visible = showImageFormat;
labelFrameRate.Visible = exportType == "BDNXML" || exportType == "BLURAYSUP" || exportType == "DOST" || exportType == "IMAGE/FRAME"; labelFrameRate.Visible = exportType == "BDNXML" || exportType == "BLURAYSUP" || exportType == "DOST" || exportType == "IMAGE/FRAME";
comboBoxFrameRate.Visible = exportType == "BDNXML" || exportType == "BLURAYSUP" || exportType == "DOST" || exportType == "IMAGE/FRAME" || exportType == "FAB"; comboBoxFrameRate.Visible = exportType == "BDNXML" || exportType == "BLURAYSUP" || exportType == "DOST" || exportType == "IMAGE/FRAME" || exportType == "FAB" || exportType == "FCP";
checkBoxTransAntiAliase.Visible = exportType == "VOBSUB"; checkBoxTransAntiAliase.Visible = exportType == "VOBSUB";
if (exportType == "BDNXML") if (exportType == "BDNXML")
{ {
@ -2888,6 +2914,19 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
comboBoxFrameRate.SelectedIndex = 1; comboBoxFrameRate.SelectedIndex = 1;
comboBoxFrameRate.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxFrameRate.DropDownStyle = ComboBoxStyle.DropDownList;
} }
else if (exportType == "FCP")
{
labelFrameRate.Visible = true;
comboBoxFrameRate.Items.Add("23.976");
comboBoxFrameRate.Items.Add("24");
comboBoxFrameRate.Items.Add("25");
comboBoxFrameRate.Items.Add("29.97");
comboBoxFrameRate.Items.Add("50");
comboBoxFrameRate.Items.Add("59.94");
comboBoxFrameRate.Items.Add("60");
comboBoxFrameRate.SelectedIndex = 2;
comboBoxFrameRate.DropDownStyle = ComboBoxStyle.DropDownList;
}
if (comboBoxFrameRate.Items.Count >= 2) if (comboBoxFrameRate.Items.Count >= 2)
{ {
SetLastFrameRate(Configuration.Settings.Tools.ExportLastFrameRate); SetLastFrameRate(Configuration.Settings.Tools.ExportLastFrameRate);
@ -2988,6 +3027,14 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
comboBoxResolution.Items.Add("HD-(1440x1080)"); comboBoxResolution.Items.Add("HD-(1440x1080)");
comboBoxResolution.SelectedIndex = 3; // 720p comboBoxResolution.SelectedIndex = 3; // 720p
buttonCustomResolution.Visible = true; // we still allow for custom resolutions buttonCustomResolution.Visible = true; // we still allow for custom resolutions
labelLanguage.Text = "NTSC/PAL";
comboBoxLanguage.Items.Clear();
comboBoxLanguage.Items.Add("PAL");
comboBoxLanguage.Items.Add("NTSC");
comboBoxLanguage.SelectedIndex = 0;
comboBoxLanguage.Visible = true;
labelLanguage.Visible = true;
} }
comboBoxShadowWidth.SelectedIndex = 0; comboBoxShadowWidth.SelectedIndex = 0;
@ -3147,15 +3194,18 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine +
} }
if (comboBoxHAlign.Visible) if (comboBoxHAlign.Visible)
{
if (comboBoxLeftRightMargin.Visible)
{ {
if (alignment == ContentAlignment.BottomLeft || alignment == ContentAlignment.MiddleLeft || alignment == ContentAlignment.TopLeft) if (alignment == ContentAlignment.BottomLeft || alignment == ContentAlignment.MiddleLeft || alignment == ContentAlignment.TopLeft)
pictureBox1.Left = int.Parse(comboBoxLeftRightMargin.Text); pictureBox1.Left = int.Parse(comboBoxLeftRightMargin.Text);
else if (alignment == ContentAlignment.BottomRight || alignment == ContentAlignment.MiddleRight || alignment == ContentAlignment.TopRight) else if (alignment == ContentAlignment.BottomRight || alignment == ContentAlignment.MiddleRight || alignment == ContentAlignment.TopRight)
pictureBox1.Left = w - bmp.Width - int.Parse(comboBoxLeftRightMargin.Text); pictureBox1.Left = w - bmp.Width - int.Parse(comboBoxLeftRightMargin.Text);
}
if (alignment == ContentAlignment.MiddleLeft || alignment == ContentAlignment.MiddleCenter || alignment == ContentAlignment.MiddleRight) if (alignment == ContentAlignment.MiddleLeft || alignment == ContentAlignment.MiddleCenter || alignment == ContentAlignment.MiddleRight)
pictureBox1.Top = (groupBoxExportImage.Height - 4 - bmp.Height) / 2; pictureBox1.Top = (groupBoxExportImage.Height - 4 - bmp.Height) / 2;
else if (alignment == ContentAlignment.TopLeft || alignment == ContentAlignment.TopCenter || alignment == ContentAlignment.TopRight) else if (comboBoxBottomMargin.Visible && alignment == ContentAlignment.TopLeft || alignment == ContentAlignment.TopCenter || alignment == ContentAlignment.TopRight)
pictureBox1.Top = int.Parse(comboBoxBottomMargin.Text); pictureBox1.Top = int.Parse(comboBoxBottomMargin.Text);
} }
if (bmp.Width > groupBoxExportImage.Width + 20 || bmp.Height > groupBoxExportImage.Height + 20) if (bmp.Width > groupBoxExportImage.Width + 20 || bmp.Height > groupBoxExportImage.Height + 20)