X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fexport_video_dialog.cc;h=7e84cab1227472c4399805ee4fb5e5c558ff2b4f;hb=556802638724a5d5f5ff5d8a773b813f4b36feee;hp=09283d4c8dc98aef61728f3d13049f8a434aecbd;hpb=8c5cff60912c7e0a7256f635641399500d8d00d9;p=ardour.git diff --git a/gtk2_ardour/export_video_dialog.cc b/gtk2_ardour/export_video_dialog.cc index 09283d4c8d..7e84cab122 100644 --- a/gtk2_ardour/export_video_dialog.cc +++ b/gtk2_ardour/export_video_dialog.cc @@ -28,7 +28,6 @@ #include #include -#include #include @@ -64,9 +63,9 @@ using namespace PBD; using namespace ARDOUR; using namespace VideoUtils; -ExportVideoDialog::ExportVideoDialog (PublicEditor& ed, Session* s) +ExportVideoDialog::ExportVideoDialog (Session* s, TimeSelection &tme) : ArdourDialog (_("Export Video File ")) - , editor (ed) + , export_range (tme) , outfn_path_label (_("File:"), Gtk::ALIGN_LEFT) , outfn_browse_button (_("Browse")) , invid_path_label (_("Video:"), Gtk::ALIGN_LEFT) @@ -152,6 +151,9 @@ ExportVideoDialog::ExportVideoDialog (PublicEditor& ed, Session* s) } else { insnd_combo.append_text (_("from the video's start to the video's end")); } + if (!export_range.empty()) { + insnd_combo.append_text (_("Selected range")); // TODO show export_range.start() -> export_range.end_frame() + } insnd_combo.set_active(0); outfn_path_entry.set_width_chars(38); @@ -259,8 +261,7 @@ ExportVideoDialog::ExportVideoDialog (PublicEditor& ed, Session* s) video_codec_combo.append_text("mjpeg"); video_codec_combo.append_text("mpeg2video"); video_codec_combo.append_text("mpeg4"); - video_codec_combo.append_text("x264 (baseline)"); - video_codec_combo.append_text("x264 (hq)"); + video_codec_combo.append_text("h264"); video_codec_combo.append_text("vpx (webm)"); video_codec_combo.append_text("copy"); video_codec_combo.set_active(4); @@ -510,6 +511,11 @@ ExportVideoDialog::launch_export () } end += av_offset; } + else if (insnd_combo.get_active_row_number() == 2) { + // TODO quantize to video-frame ?! + start = export_range.start(); + end = export_range.end_frame(); + } if (end <= 0) { start = _session->current_start_frame(); end = _session->current_end_frame(); @@ -554,7 +560,7 @@ ExportVideoDialog::launch_export () if (gtk_events_pending()) { gtk_main_iteration (); } else { - usleep (10000); + Glib::usleep (10000); } } audio_progress_connection.disconnect(); @@ -614,13 +620,8 @@ ExportVideoDialog::encode_pass (int pass) ffs["-strict"] = "-2"; } - if (video_codec_combo.get_active_text() == "x264 (hq)" ) { - ffs["-vcodec"] = "libx264"; - ffs["-vprofile"] = "high"; - } - else if (video_codec_combo.get_active_text() == "x264 (baseline)" ) { + if (video_codec_combo.get_active_text() == "h264" ) { ffs["-vcodec"] = "libx264"; - ffs["-vpre"] = "baseline"; } else if (video_codec_combo.get_active_text() == "vpx (webm)" ) { ffs["-vcodec"] = "libvpx"; @@ -687,7 +688,7 @@ ExportVideoDialog::encode_pass (int pass) ffs["-an"] = "-y"; ffs["-passlogfile"] = Glib::path_get_dirname (outfn) + G_DIR_SEPARATOR + "ffmpeg2pass"; ffs["-f"] = get_file_extension(invid).empty()?"mov":get_file_extension(invid); -#ifdef _OS_WIN32 +#ifdef PLATFORM_WINDOWS outfn = "NUL"; #else outfn = "/dev/null"; @@ -702,9 +703,14 @@ ExportVideoDialog::encode_pass (int pass) double duration_s = 0; if (insnd_combo.get_active_row_number() == 0) { + /* session start to session end */ framecnt_t duration_f = _session->current_end_frame() - _session->current_start_frame(); duration_s = (double)duration_f / (double)_session->nominal_frame_rate(); + } else if (insnd_combo.get_active_row_number() == 2) { + /* selected range */ + duration_s = export_range.length() / (double)_session->nominal_frame_rate(); } else { + /* video start to end */ framecnt_t duration_f = ARDOUR_UI::instance()->video_timeline->get_duration(); if (av_offset < 0 ) { duration_f += av_offset; @@ -720,10 +726,16 @@ ExportVideoDialog::encode_pass (int pass) transcoder->set_duration(duration_s * transcoder->get_fps()); } - if (insnd_combo.get_active_row_number() == 0) { - const framepos_t start = _session->current_start_frame(); - const framepos_t snend = _session->current_end_frame(); + if (insnd_combo.get_active_row_number() == 0 || insnd_combo.get_active_row_number() == 2) { + framepos_t start, snend; const frameoffset_t vid_duration = ARDOUR_UI::instance()->video_timeline->get_duration(); + if (insnd_combo.get_active_row_number() == 0) { + start = _session->current_start_frame(); + snend = _session->current_end_frame(); + } else { + start = export_range.start(); + snend = export_range.end_frame(); + } #if 0 /* DEBUG */ printf("AV offset: %lld Vid-len: %lld Vid-end: %lld || start:%lld || end:%lld\n", @@ -738,9 +750,17 @@ ExportVideoDialog::encode_pass (int pass) } else if (av_offset + vid_duration < snend) { transcoder->set_leadinout(0, (snend - (av_offset + vid_duration)) / (double)_session->nominal_frame_rate()); transcoder->set_avoffset((av_offset - start) / (double)_session->nominal_frame_rate()); - } else { + } +#if 0 + else if (start > av_offset) { + std::ostringstream osstream; osstream << ((start - av_offset) / (double)_session->nominal_frame_rate()); + ffs["-ss"] = osstream.str(); + } +#endif + else { transcoder->set_avoffset((av_offset - start) / (double)_session->nominal_frame_rate()); } + } else if (av_offset < 0) { /* from 00:00:00:00 to video-end */ transcoder->set_avoffset(av_offset / (double)_session->nominal_frame_rate());