round A/V offset to video-frames.

This commit is contained in:
Robin Gareus 2014-07-02 20:26:13 +02:00
parent 3c2c048f40
commit 77e716943f
3 changed files with 10 additions and 6 deletions

View file

@ -611,7 +611,8 @@ ExportVideoDialog::encode_pass (int pass)
ffs.clear(); ffs.clear();
if (fps_checkbox.get_active()) { if (fps_checkbox.get_active()) {
ffs["-r"] = fps_combo.get_active_text(); ffs["-r"] = fps_combo.get_active_text();
transcoder->set_fps(atof(fps_combo.get_active_text()));
} }
if (scale_checkbox.get_active()) { if (scale_checkbox.get_active()) {
@ -731,11 +732,7 @@ ExportVideoDialog::encode_pass (int pass)
std::ostringstream osstream; osstream << duration_s; std::ostringstream osstream; osstream << duration_s;
ffs["-t"] = osstream.str(); ffs["-t"] = osstream.str();
if (fps_checkbox.get_active()) { transcoder->set_duration(duration_s * transcoder->get_fps());
transcoder->set_duration(duration_s * atof(fps_combo.get_active_text()));
} else {
transcoder->set_duration(duration_s * transcoder->get_fps());
}
if (insnd_combo.get_active_row_number() == 0 || insnd_combo.get_active_row_number() == 2) { if (insnd_combo.get_active_row_number() == 0 || insnd_combo.get_active_row_number() == 2) {
framepos_t start, snend; framepos_t start, snend;

View file

@ -348,6 +348,12 @@ TranscodeFfmpeg::encode (std::string outfile, std::string inf_a, std::string inf
argp[a++] = strdup("-metadata"); argp[a++] = strdup("-metadata");
argp[a++] = format_metadata(it->first.c_str(), it->second.c_str()); argp[a++] = format_metadata(it->first.c_str(), it->second.c_str());
} }
if (m_fps > 0) {
m_lead_in = rint (m_lead_in * m_fps) / m_fps;
m_lead_out = rint (m_lead_out * m_fps) / m_fps;
}
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");

View file

@ -122,6 +122,7 @@ class TranscodeFfmpeg : public sigc::trackable
void set_avoffset(double av_offset) { m_avoffset = av_offset; } void set_avoffset(double av_offset) { m_avoffset = av_offset; }
void set_leadinout(double lead_in, double lead_out) { m_lead_in = lead_in; m_lead_out = lead_out; } void set_leadinout(double lead_in, double lead_out) { m_lead_in = lead_in; m_lead_out = lead_out; }
void set_fps(double fps) { m_fps = fps; } // on export, used for rounding only.
#if 1 /* tentative debug mode */ #if 1 /* tentative debug mode */
void set_debug (bool onoff) { debug_enable = onoff; } void set_debug (bool onoff) { debug_enable = onoff; }