mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 07:45:00 +01:00
videotimeline: fix black-frame generation (sample aspect ratio) on export
This commit is contained in:
parent
7022456b4f
commit
01c6266909
2 changed files with 22 additions and 4 deletions
|
|
@ -46,6 +46,7 @@ TranscodeFfmpeg::TranscodeFfmpeg (std::string f)
|
||||||
m_avoffset = m_lead_in = m_lead_out = 0;
|
m_avoffset = m_lead_in = m_lead_out = 0;
|
||||||
m_width = m_height = 0;
|
m_width = m_height = 0;
|
||||||
m_aspect = m_fps = 0;
|
m_aspect = m_fps = 0;
|
||||||
|
m_sar = "";
|
||||||
#if 1 /* tentative debug mode */
|
#if 1 /* tentative debug mode */
|
||||||
debug_enable = false;
|
debug_enable = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -138,6 +139,7 @@ TranscodeFfmpeg::probe ()
|
||||||
m_width = m_height = 0;
|
m_width = m_height = 0;
|
||||||
m_fps = m_aspect = 0;
|
m_fps = m_aspect = 0;
|
||||||
m_duration = 0;
|
m_duration = 0;
|
||||||
|
m_sar.clear();
|
||||||
m_codec.clear();
|
m_codec.clear();
|
||||||
m_audio.clear();
|
m_audio.clear();
|
||||||
|
|
||||||
|
|
@ -199,6 +201,13 @@ TranscodeFfmpeg::probe ()
|
||||||
m_duration = atof(value) * m_fps * timebase;
|
m_duration = atof(value) * m_fps * timebase;
|
||||||
} else if (key == X_("duration") && m_fps != 0 && m_duration == 0) {
|
} else if (key == X_("duration") && m_fps != 0 && m_duration == 0) {
|
||||||
m_duration = atof(value) * m_fps;
|
m_duration = atof(value) * m_fps;
|
||||||
|
} else if (key == X_("sample_aspect_ratio")) {
|
||||||
|
std::string::size_type pos;
|
||||||
|
pos = value.find_first_of(':');
|
||||||
|
if (pos != std::string::npos && atof(value.substr(pos+1)) != 0) {
|
||||||
|
m_sar = value;
|
||||||
|
m_sar.replace(pos, 1, "/");
|
||||||
|
}
|
||||||
} else if (key == X_("display_aspect_ratio")) {
|
} else if (key == X_("display_aspect_ratio")) {
|
||||||
std::string::size_type pos;
|
std::string::size_type pos;
|
||||||
pos = value.find_first_of(':');
|
pos = value.find_first_of(':');
|
||||||
|
|
@ -340,20 +349,28 @@ TranscodeFfmpeg::encode (std::string outfile, std::string inf_a, std::string inf
|
||||||
if (m_lead_in != 0 && m_lead_out != 0) {
|
if (m_lead_in != 0 && m_lead_out != 0) {
|
||||||
std::ostringstream osstream;
|
std::ostringstream osstream;
|
||||||
argp[a++] = strdup("-vf");
|
argp[a++] = strdup("-vf");
|
||||||
osstream << X_("color=c=black:s=") << m_width << X_("x") << m_height << X_(":d=") << m_lead_in << X_(" [pre]; ");
|
osstream << X_("color=c=black:s=") << m_width << X_("x") << m_height << X_(":d=") << m_lead_in;
|
||||||
osstream << X_("color=c=black:s=") << m_width << X_("x") << m_height << X_(":d=") << m_lead_out << X_(" [post]; ");
|
if (!m_sar.empty()) osstream << X_(":sar=") << m_sar;
|
||||||
|
osstream << X_(" [pre]; ");
|
||||||
|
osstream << X_("color=c=black:s=") << m_width << X_("x") << m_height << X_(":d=") << m_lead_out;
|
||||||
|
if (!m_sar.empty()) osstream << X_(":sar=") << m_sar;
|
||||||
|
osstream << X_(" [post]; ");
|
||||||
osstream << X_("[pre] [in] [post] concat=n=3");
|
osstream << X_("[pre] [in] [post] concat=n=3");
|
||||||
argp[a++] = strdup(osstream.str().c_str());
|
argp[a++] = strdup(osstream.str().c_str());
|
||||||
} else if (m_lead_in != 0) {
|
} else if (m_lead_in != 0) {
|
||||||
std::ostringstream osstream;
|
std::ostringstream osstream;
|
||||||
argp[a++] = strdup("-vf");
|
argp[a++] = strdup("-vf");
|
||||||
osstream << X_("color=c=black:s=") << m_width << X_("x") << m_height << X_(":d=") << m_lead_in << X_(" [pre]; ");
|
osstream << X_("color=c=black:s=") << m_width << X_("x") << m_height << X_(":d=") << m_lead_in;
|
||||||
|
if (!m_sar.empty()) osstream << X_(":sar=") << m_sar;
|
||||||
|
osstream << X_(" [pre]; ");
|
||||||
osstream << X_("[pre] [in] concat=n=2");
|
osstream << X_("[pre] [in] concat=n=2");
|
||||||
argp[a++] = strdup(osstream.str().c_str());
|
argp[a++] = strdup(osstream.str().c_str());
|
||||||
} else if (m_lead_out != 0) {
|
} else if (m_lead_out != 0) {
|
||||||
std::ostringstream osstream;
|
std::ostringstream osstream;
|
||||||
argp[a++] = strdup("-vf");
|
argp[a++] = strdup("-vf");
|
||||||
osstream << X_("color=c=black:s=") << m_width << X_("x") << m_height << X_(":d=") << m_lead_out << X_(" [post]; ");
|
osstream << X_("color=c=black:s=") << m_width << X_("x") << m_height << X_(":d=") << m_lead_out;
|
||||||
|
if (!m_sar.empty()) osstream << X_(":sar=") << m_sar;
|
||||||
|
osstream << X_(" [post]; ");
|
||||||
osstream << X_("[in] [post] concat=n=2");
|
osstream << X_("[in] [post] concat=n=2");
|
||||||
argp[a++] = strdup(osstream.str().c_str());
|
argp[a++] = strdup(osstream.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,7 @@ class TranscodeFfmpeg : public sigc::trackable
|
||||||
|
|
||||||
double m_fps;
|
double m_fps;
|
||||||
double m_aspect;
|
double m_aspect;
|
||||||
|
std::string m_sar;
|
||||||
ARDOUR::framecnt_t m_duration;
|
ARDOUR::framecnt_t m_duration;
|
||||||
int m_width;
|
int m_width;
|
||||||
int m_height;
|
int m_height;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue