2 Copyright (C) 2010 Paul Davis
3 Author: Robin Gareus <robin@gareus.org>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #include <sys/types.h>
30 #include <sigc++/bind.h>
32 #include <gtkmm/filechooserdialog.h>
33 #include <gtkmm/stock.h>
34 #include <gtkmm/table.h>
36 #include "pbd/gstdio_compat.h"
38 #include "pbd/error.h"
39 #include "pbd/convert.h"
40 #include "gtkmm2ext/keyboard.h"
41 #include "gtkmm2ext/utils.h"
42 #include "ardour/session_directory.h"
43 #include "ardour/profile.h"
44 #include "ardour/template_utils.h"
45 #include "ardour/session.h"
46 #include "ardour_ui.h"
47 #include "gui_thread.h"
49 #include "ardour/export_handler.h"
50 #include "ardour/export_status.h"
51 #include "ardour/export_timespan.h"
52 #include "ardour/export_channel_configuration.h"
53 #include "ardour/export_format_specification.h"
54 #include "ardour/export_filename.h"
55 #include "ardour/route.h"
56 #include "ardour/session_metadata.h"
57 #include "ardour/broadcast_info.h"
60 #include "export_video_dialog.h"
61 #include "utils_videotl.h"
67 using namespace ARDOUR;
68 using namespace VideoUtils;
70 ExportVideoDialog::ExportVideoDialog ()
71 : ArdourDialog (_("Export Video File "))
76 , _previous_progress(0)
78 , _video_source_aspect_ratio(-1)
79 , _suspend_signals(false)
80 , outfn_path_label (_("File:"), Gtk::ALIGN_LEFT)
81 , outfn_browse_button (_("Browse"))
82 , invid_path_label (_("Video:"), Gtk::ALIGN_LEFT)
83 , invid_browse_button (_("Browse"))
84 , transcode_button (_("Export"))
85 , abort_button (_("Abort"))
87 , scale_checkbox (_("Scale Video (W x H):"))
88 , scale_aspect (_("Retain Aspect"))
89 , width_adjustment (768, 128, 1920, 1, 16, 0)
90 , width_spinner (width_adjustment)
91 , height_adjustment (576, 128, 1920, 1, 16, 0)
92 , height_spinner (height_adjustment)
93 , aspect_checkbox (_("Set Aspect Ratio:"))
94 , normalize_checkbox (_("Normalize Audio"))
95 , twopass_checkbox (_("2 Pass Encoding"))
96 , optimizations_checkbox (_("Codec Optimizations:"))
97 , optimizations_label ("-")
98 , deinterlace_checkbox (_("Deinterlace"))
99 , bframes_checkbox (_("Use [2] B-frames (MPEG 2 or 4 only)"))
100 , fps_checkbox (_("Override FPS (Default is to retain FPS from the input video file):"))
101 , meta_checkbox (_("Include Session Metadata"))
102 #if 1 /* tentative debug mode */
103 , debug_checkbox (_("Debug Mode: Print ffmpeg command and output to stdout."))
106 set_name ("ExportVideoDialog");
108 set_skip_taskbar_hint (true);
109 set_resizable (false);
112 vbox = manage (new VBox);
113 VBox* options_box = manage (new VBox);
116 /* check if ffmpeg can be found */
117 _transcoder = new TranscodeFfmpeg(X_(""));
118 if (!_transcoder->ffexec_ok()) {
119 l = manage (new Label (_("ffmpeg installation was not found. Video Export is not possible. See the Log window for more information."), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
121 vbox->pack_start (*l, false, false, 8);
122 get_vbox()->pack_start (*vbox, false, false);
123 add_button (Stock::OK, RESPONSE_CANCEL);
124 show_all_children ();
125 delete _transcoder; _transcoder = 0;
128 delete _transcoder; _transcoder = 0;
130 l = manage (new Label (_("<b>Output:</b> (file extension defines format)"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
131 l->set_use_markup ();
132 vbox->pack_start (*l, false, false, 4);
134 path_hbox = manage (new HBox);
135 path_hbox->pack_start (outfn_path_label, false, false, 3);
136 path_hbox->pack_start (outfn_path_entry, true, true, 3);
137 path_hbox->pack_start (outfn_browse_button, false, false, 3);
138 vbox->pack_start (*path_hbox, false, false, 2);
140 l = manage (new Label (_("<b>Input Video:</b>"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
141 l->set_use_markup ();
142 vbox->pack_start (*l, false, false, 4);
144 path_hbox = manage (new HBox);
145 path_hbox->pack_start (invid_path_label, false, false, 3);
146 path_hbox->pack_start (invid_path_entry, true, true, 3);
147 path_hbox->pack_start (invid_browse_button, false, false, 3);
148 vbox->pack_start (*path_hbox, false, false, 2);
150 path_hbox = manage (new HBox);
151 l = manage (new Label (_("Audio:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
152 path_hbox->pack_start (*l, false, false, 3);
153 l = manage (new Label (_("Master Bus"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
154 path_hbox->pack_start (*l, false, false, 2);
155 vbox->pack_start (*path_hbox, false, false, 2);
157 insnd_combo.append_text (string_compose (_("from session start marker to session end marker"), PROGRAM_NAME));
158 outfn_path_entry.set_width_chars(38);
160 l = manage (new Label (_("<b>Settings:</b>"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
161 l->set_use_markup ();
162 options_box->pack_start (*l, false, true, 4);
164 Table* t = manage (new Table (4, 12));
167 options_box->pack_start (*t, true, true, 4);
168 l = manage (new Label (_("Range:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
169 t->attach (*l, 0, 1, ty, ty+1);
170 t->attach (insnd_combo, 1, 4, ty, ty+1); ty++;
171 l = manage (new Label (_("Preset:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
172 t->attach (*l, 0, 1, ty, ty+1);
173 t->attach (preset_combo, 1, 4, ty, ty+1); ty++;
174 l = manage (new Label (_("Video Codec:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
175 t->attach (*l, 0, 1, ty, ty+1);
176 t->attach (video_codec_combo, 1, 2, ty, ty+1);
177 l = manage (new Label (_("Video KBit/s:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
178 t->attach (*l, 2, 3, ty, ty+1);
179 t->attach (video_bitrate_combo, 3, 4, ty, ty+1); ty++;
180 l = manage (new Label (_("Audio Codec:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
181 t->attach (*l, 0, 1, ty, ty+1);
182 t->attach (audio_codec_combo, 1, 2, ty, ty+1);
183 l = manage (new Label (_("Audio KBit/s:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
184 t->attach (*l, 2, 3, ty, ty+1);
185 t->attach (audio_bitrate_combo, 3, 4, ty, ty+1); ty++;
186 l = manage (new Label (_("Audio Samplerate:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false));
187 t->attach (*l, 0, 1, ty, ty+1);
188 t->attach (audio_samplerate_combo, 1, 2, ty, ty+1);
189 t->attach (normalize_checkbox, 2, 4, ty, ty+1); ty++;
190 t->attach (scale_checkbox, 0, 1, ty, ty+1);
191 t->attach (scale_aspect, 1, 2, ty, ty+1);
192 t->attach (width_spinner, 2, 3, ty, ty+1);
193 t->attach (height_spinner, 3, 4, ty, ty+1); ty++;
194 t->attach (fps_checkbox, 0, 3, ty, ty+1);
195 t->attach (fps_combo, 3, 4, ty, ty+1); ty++;
196 t->attach (twopass_checkbox, 0, 2, ty, ty+1);
197 t->attach (aspect_checkbox, 2, 3, ty, ty+1);
198 t->attach (aspect_combo, 3, 4, ty, ty+1); ty++;
199 t->attach (bframes_checkbox, 0, 2, ty, ty+1);
200 t->attach (deinterlace_checkbox, 2, 4, ty, ty+1); ty++;
201 t->attach (meta_checkbox, 2, 4, ty, ty+1); ty++;
202 t->attach (optimizations_checkbox, 0, 1, ty, ty+1);
203 t->attach (optimizations_label, 1, 4, ty, ty+1); ty++;
204 #if 1 /* tentative debug mode */
205 t->attach (debug_checkbox, 0, 4, ty, ty+1); ty++;
208 preset_combo.append_text("none");
209 preset_combo.append_text("dvd-mp2");
210 preset_combo.append_text("dvd-NTSC");
211 preset_combo.append_text("dvd-PAL");
212 preset_combo.append_text("flv");
213 preset_combo.append_text("mpeg4");
214 preset_combo.append_text("mp4/h264/aac");
215 preset_combo.append_text("ogg");
216 preset_combo.append_text("webm");
217 preset_combo.append_text("you-tube");
219 audio_codec_combo.append_text(_("(default for format)"));
220 audio_codec_combo.append_text("ac3");
221 audio_codec_combo.append_text("aac");
222 audio_codec_combo.append_text("libmp3lame");
223 audio_codec_combo.append_text("libvorbis");
224 audio_codec_combo.append_text("mp2");
225 audio_codec_combo.append_text("pcm_s16le");
227 video_codec_combo.append_text(_("(default for format)"));
228 video_codec_combo.append_text("flv");
229 video_codec_combo.append_text("libtheora");
230 video_codec_combo.append_text("mjpeg");
231 video_codec_combo.append_text("mpeg2video");
232 video_codec_combo.append_text("mpeg4");
233 video_codec_combo.append_text("h264");
234 video_codec_combo.append_text("vpx (webm)");
235 video_codec_combo.append_text("copy");
237 audio_bitrate_combo.append_text(_("(default)"));
238 audio_bitrate_combo.append_text("64k");
239 audio_bitrate_combo.append_text("128k");
240 audio_bitrate_combo.append_text("192k");
241 audio_bitrate_combo.append_text("256k");
242 audio_bitrate_combo.append_text("320k");
244 audio_samplerate_combo.append_text("22050");
245 audio_samplerate_combo.append_text("44100");
246 audio_samplerate_combo.append_text("48000");
248 video_bitrate_combo.append_text(_("(default)"));
249 video_bitrate_combo.append_text(_("(retain)"));
250 video_bitrate_combo.append_text("200k");
251 video_bitrate_combo.append_text("800k");
252 video_bitrate_combo.append_text("2000k");
253 video_bitrate_combo.append_text("5000k");
254 video_bitrate_combo.append_text("8000k");
256 fps_combo.append_text("23.976");
257 fps_combo.append_text("24");
258 fps_combo.append_text("24.976");
259 fps_combo.append_text("25");
260 fps_combo.append_text("29.97");
261 fps_combo.append_text("30");
262 fps_combo.append_text("59.94");
263 fps_combo.append_text("60");
265 aspect_combo.append_text("4:3");
266 aspect_combo.append_text("16:9");
268 vbox->pack_start (*options_box, false, true, 4);
269 get_vbox()->set_spacing (4);
270 get_vbox()->pack_start (*vbox, false, false);
272 progress_box = manage (new VBox);
273 progress_box->pack_start (pbar, false, false);
274 progress_box->pack_start (abort_button, false, false);
275 get_vbox()->pack_start (*progress_box, false, false);
277 scale_checkbox.signal_toggled().connect (sigc::mem_fun (*this, &ExportVideoDialog::scale_checkbox_toggled));
278 aspect_checkbox.signal_toggled().connect (sigc::mem_fun (*this, &ExportVideoDialog::aspect_checkbox_toggled));
279 fps_checkbox.signal_toggled().connect (sigc::mem_fun (*this, &ExportVideoDialog::fps_checkbox_toggled));
280 preset_combo.signal_changed().connect (sigc::mem_fun (*this, &ExportVideoDialog::preset_combo_changed));
281 video_codec_combo.signal_changed().connect (sigc::mem_fun (*this, &ExportVideoDialog::video_codec_combo_changed));
282 outfn_browse_button.signal_clicked().connect (sigc::mem_fun (*this, &ExportVideoDialog::open_outfn_dialog));
283 invid_browse_button.signal_clicked().connect (sigc::mem_fun (*this, &ExportVideoDialog::open_invid_dialog));
284 transcode_button.signal_clicked().connect (sigc::mem_fun (*this, &ExportVideoDialog::launch_export));
285 abort_button.signal_clicked().connect (sigc::mem_fun (*this, &ExportVideoDialog::abort_clicked));
287 invid_path_entry.signal_changed().connect (sigc::mem_fun (*this, &ExportVideoDialog::set_original_file_information));
288 width_spinner.signal_value_changed().connect (sigc::mem_fun (*this, &ExportVideoDialog::width_value_changed));
289 height_spinner.signal_value_changed().connect (sigc::mem_fun (*this, &ExportVideoDialog::height_value_changed));
291 cancel_button = add_button (Stock::CANCEL, RESPONSE_CANCEL);
292 get_action_area()->pack_start (transcode_button, false, false);
293 show_all_children ();
294 progress_box->hide();
297 ExportVideoDialog::~ExportVideoDialog ()
299 if (_transcoder) { delete _transcoder; _transcoder = 0;}
303 ExportVideoDialog::set_original_file_information()
305 assert(_transcoder == 0);
306 std::string infile = invid_path_entry.get_text();
308 if (scale_checkbox.get_active()) {
309 // user may have set custom values already, don't touch.
312 if (infile == "" || !Glib::file_test(infile, Glib::FILE_TEST_EXISTS)) {
316 _transcoder = new TranscodeFfmpeg(infile);
317 if (_transcoder->probe_ok()) {
318 _video_source_aspect_ratio = -1;
319 width_spinner.set_value(_transcoder->get_width());
320 height_spinner.set_value(_transcoder->get_height());
321 _video_source_aspect_ratio = _transcoder->get_aspect();
324 delete _transcoder; _transcoder = 0;
327 ExportVideoDialog::apply_state (TimeSelection &tme, bool range)
329 _suspend_dirty = true; // TODO really just queue 'dirty' and mark session dirty on "Export"
332 _video_source_aspect_ratio = -1;
334 outfn_path_entry.set_text (_session->session_directory().export_path() + G_DIR_SEPARATOR +"export.avi");
336 // TODO remember setting for export-range.. somehow, (let explicit range override)
337 sampleoffset_t av_offset = ARDOUR_UI::instance()->video_timeline->get_offset();
338 if (av_offset < 0 ) {
339 insnd_combo.append_text (_("from 00:00:00:00 to the video end"));
341 insnd_combo.append_text (_("from video start to video end"));
343 if (!export_range.empty()) {
344 insnd_combo.append_text (_("Selected range")); // TODO show export_range.start() -> export_range.end_sample()
347 insnd_combo.set_active(2);
349 insnd_combo.set_active(0);
352 preset_combo.set_active(0);
353 audio_codec_combo.set_active(0);
354 video_codec_combo.set_active(0);
355 audio_bitrate_combo.set_active(0);
356 audio_samplerate_combo.set_active(2);
357 video_bitrate_combo.set_active(0);
358 aspect_combo.set_active(1);
360 scale_checkbox.set_active(false);
361 scale_aspect.set_active(true);
362 aspect_checkbox.set_active(false);
363 normalize_checkbox.set_active(false);
364 twopass_checkbox.set_active(false);
365 optimizations_checkbox.set_active(false);
366 deinterlace_checkbox.set_active(false);
367 bframes_checkbox.set_active(false);
368 fps_checkbox.set_active(false);
369 meta_checkbox.set_active(false);
371 float tcfps = _session->timecode_frames_per_second();
373 XMLNode* node = _session->extra_xml (X_("Videotimeline"));
374 bool filenameset = false;
376 std::string filename;
377 if (node->get_property(X_("OriginalVideoFile"), filename)) {
378 if (Glib::file_test(filename, Glib::FILE_TEST_EXISTS)) {
379 invid_path_entry.set_text (filename);
386 if (!filenameset && node->get_property (X_("Filename"), filename) &&
387 node->get_property (X_("LocalFile"), local_file) && local_file) {
388 if (filename.at(0) != G_DIR_SEPARATOR)
390 filename = Glib::build_filename (_session->session_directory().video_path(), filename);
392 if (Glib::file_test(filename, Glib::FILE_TEST_EXISTS))
394 invid_path_entry.set_text (filename);
400 invid_path_entry.set_text (X_(""));
403 node = _session->extra_xml (X_("Videoexport"));
406 if (node->get_property (X_("ChangeGeometry"), yn)) {
407 scale_checkbox.set_active (yn);
409 if (node->get_property (X_("KeepAspect"), yn)) {
410 scale_aspect.set_active (yn);
412 if (node->get_property (X_("ChangeAspect"), yn)) {
413 aspect_checkbox.set_active (yn);
415 if (node->get_property (X_("NormalizeAudio"), yn)) {
416 normalize_checkbox.set_active (yn);
418 if (node->get_property (X_("TwoPassEncode"), yn)) {
419 twopass_checkbox.set_active (yn);
421 if (node->get_property (X_("CodecOptimzations"), yn)) {
422 optimizations_checkbox.set_active (yn);
424 if (node->get_property (X_("Deinterlace"), yn)) {
425 deinterlace_checkbox.set_active (yn);
427 if (node->get_property (X_("BSamples"), yn)) {
428 bframes_checkbox.set_active (yn);
430 if (node->get_property (X_("ChangeFPS"), yn)) {
431 fps_checkbox.set_active (yn);
433 if (node->get_property (X_("Metadata"), yn)) {
434 meta_checkbox.set_active (yn);
438 if (node->get_property (X_("Format"), str) && !str.empty()) {
439 change_file_extension ("." + str);
442 _suspend_signals = true;
444 if (node->get_property (X_("Width"), val)) {
445 width_spinner.set_value (val);
447 if (node->get_property (X_("Height"), val)) {
448 height_spinner.set_value (val);
450 _suspend_signals = false;
452 if (fps_checkbox.get_active () && node->get_property (X_("FPS"), val)) {
456 if (node->get_property (X_("Preset"), str)) {
457 preset_combo.set_active_text (str);
459 if (node->get_property (X_("VCodec"), str)) {
460 video_codec_combo.set_active_text (str);
462 if (node->get_property (X_("ACodec"), str)) {
463 audio_codec_combo.set_active_text (str);
465 if (node->get_property (X_("VBitrate"), str)) {
466 video_bitrate_combo.set_active_text (str);
468 if (node->get_property (X_("ABitrate"), str)) {
469 audio_bitrate_combo.set_active_text (str);
471 if (node->get_property (X_("AspectRatio"), str)) {
472 aspect_combo.set_active_text (str);
474 if (node->get_property (X_("SampleRate"), str)) {
475 audio_samplerate_combo.set_active_text (str);
479 if (fabs(tcfps - 23.976) < 0.01) { fps_combo.set_active(0); }
480 else if (fabs(tcfps - 24.0 ) < 0.01) { fps_combo.set_active(1); }
481 else if (fabs(tcfps - 24.976) < 0.01) { fps_combo.set_active(2); }
482 else if (fabs(tcfps - 25.0 ) < 0.01) { fps_combo.set_active(3); }
483 else if (fabs(tcfps - 29.97 ) < 0.01) { fps_combo.set_active(4); }
484 else if (fabs(tcfps - 30.0 ) < 0.01) { fps_combo.set_active(5); }
485 else if (fabs(tcfps - 59.94 ) < 0.01) { fps_combo.set_active(6); }
486 else if (fabs(tcfps - 60.0 ) < 0.01) { fps_combo.set_active(7); }
487 else { fps_combo.set_active(5); }
489 set_original_file_information();
491 /* update sensitivity */
492 scale_checkbox_toggled();
493 aspect_checkbox_toggled();
494 fps_checkbox_toggled();
495 video_codec_combo_changed();
497 _suspend_dirty = false;
499 show_all_children ();
501 progress_box->hide();
506 ExportVideoDialog::get_state ()
508 XMLNode* node = new XMLNode (X_("Videoexport"));
509 node->set_property (X_("ChangeGeometry"), scale_checkbox.get_active());
510 node->set_property (X_("KeepAspect"), scale_aspect.get_active());
511 node->set_property (X_("ChangeAspect"), aspect_checkbox.get_active());
512 node->set_property (X_("NormalizeAudio"), normalize_checkbox.get_active());
513 node->set_property (X_("TwoPassEncode"), twopass_checkbox.get_active());
514 node->set_property (X_("CodecOptimzations"), optimizations_checkbox.get_active());
515 node->set_property (X_("Deinterlace"), deinterlace_checkbox.get_active());
516 node->set_property (X_("BSamples"), bframes_checkbox.get_active());
517 node->set_property (X_("ChangeFPS"), fps_checkbox.get_active());
518 node->set_property (X_("Metadata"), meta_checkbox.get_active());
520 node->set_property (X_("Format"), get_file_extension(outfn_path_entry.get_text()));
522 node->set_property (X_("Width"), width_spinner.get_value());
523 node->set_property (X_("Height"), height_spinner.get_value());
525 node->set_property (X_("Preset"), preset_combo.get_active_text());
526 node->set_property (X_("VCodec"), video_codec_combo.get_active_text());
527 node->set_property (X_("ACodec"), audio_codec_combo.get_active_text());
528 node->set_property (X_("VBitrate"), video_bitrate_combo.get_active_text());
529 node->set_property (X_("ABitrate"), audio_bitrate_combo.get_active_text());
530 node->set_property (X_("AspectRatio"), aspect_combo.get_active_text());
531 node->set_property (X_("SampleRate"), audio_samplerate_combo.get_active_text());
532 node->set_property (X_("FPS"), fps_combo.get_active_text());
538 ExportVideoDialog::set_state (const XMLNode &)
543 ExportVideoDialog::on_show ()
549 ExportVideoDialog::abort_clicked ()
553 _transcoder->cancel();
558 ExportVideoDialog::update_progress (samplecnt_t c, samplecnt_t a)
560 if (a == 0 || c > a) {
561 pbar.set_pulse_step(.1);
564 double progress = (double)c / (double) a;
565 progress = progress / ((_twopass ? 2.0 : 1.0) + (_normalize ? 2.0 : 1.0));
566 if (_normalize && _twopass) progress += (_firstpass ? .5 : .75);
567 else if (_normalize) progress += 2.0/3.0;
568 else if (_twopass) progress += (_firstpass ? 1.0/3.0 : 2.0/3.0);
571 pbar.set_fraction (progress);
577 ExportVideoDialog::audio_progress_display ()
579 std::string status_text;
580 double progress = -1.0;
581 switch (status->active_job) {
582 case ExportStatus::Normalizing:
583 pbar.set_text (_("Normalizing audio"));
584 progress = ((float) status->current_postprocessing_cycle) / status->total_postprocessing_cycles;
585 progress = progress / (_twopass ? 4.0 : 3.0) + (_twopass ? .25 : 1.0 / 3.0);
587 case ExportStatus::Exporting:
588 pbar.set_text (_("Exporting audio"));
589 progress = ((float) status->processed_samples_current_timespan) / status->total_samples_current_timespan;
590 progress = progress / ((_twopass ? 2.0 : 1.0) + (_normalize ? 2.0 : 1.0));
593 pbar.set_text (_("Exporting audio"));
597 if (progress < _previous_progress) {
598 // Work around gtk bug
602 _previous_progress = progress;
605 pbar.set_fraction (progress);
607 pbar.set_pulse_step(.1);
614 ExportVideoDialog::finished ()
617 ::g_unlink(outfn_path_entry.get_text().c_str());
618 ::g_unlink (_insnd.c_str());
619 delete _transcoder; _transcoder = 0;
620 Gtk::Dialog::response(RESPONSE_CANCEL);
621 } else if (_twopass && _firstpass) {
623 if (_transcoder) { delete _transcoder; _transcoder = 0;}
626 if (twopass_checkbox.get_active()) {
627 std::string outfn = outfn_path_entry.get_text();
628 std::string p2log = Glib::path_get_dirname (outfn) + G_DIR_SEPARATOR + "ffmpeg2pass";
629 ::g_unlink (p2log.c_str());
631 ::g_unlink (_insnd.c_str());
632 delete _transcoder; _transcoder = 0;
633 Gtk::Dialog::response(RESPONSE_ACCEPT);
638 ExportVideoDialog::launch_export ()
640 /* remember current settings.
641 * needed because apply_state() acts on both:
642 * "Videotimeline" and "Video Export" extra XML
643 * as well as current _session settings
645 _session->add_extra_xml (get_state());
647 std::string outfn = outfn_path_entry.get_text();
648 if (!confirm_video_outfn(*this, outfn)) { return; }
651 cancel_button->hide();
652 transcode_button.hide();
653 pbar.set_size_request(300,-1);
654 pbar.set_text(_("Exporting Audio..."));
655 progress_box->show();
657 _twopass = twopass_checkbox.get_active();
659 _normalize = normalize_checkbox.get_active();
661 /* export audio track */
662 ExportTimespanPtr tsp = _session->get_export_handler()->add_timespan();
663 boost::shared_ptr<ExportChannelConfiguration> ccp = _session->get_export_handler()->add_channel_config();
664 boost::shared_ptr<ARDOUR::ExportFilename> fnp = _session->get_export_handler()->add_filename();
665 boost::shared_ptr<AudioGrapher::BroadcastInfo> b;
667 std::string vtl_samplerate = audio_samplerate_combo.get_active_text();
668 std::string vtl_normalize = _normalize ? "true" : "false";
669 tree.read_buffer(std::string(
670 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
671 "<ExportFormatSpecification name=\"VTL-WAV-16\" id=\"3094591e-ccb9-4385-a93f-c9955ffeb1f0\">"
672 " <Encoding id=\"F_WAV\" type=\"T_Sndfile\" extension=\"wav\" name=\"WAV\" has-sample-format=\"true\" channel-limit=\"256\"/>"
673 " <SampleRate rate=\""+ vtl_samplerate +"\"/>"
674 " <SRCQuality quality=\"SRC_SincBest\"/>"
676 " <Option name=\"sample-format\" value=\"SF_16\"/>"
677 " <Option name=\"dithering\" value=\"D_None\"/>"
678 " <Option name=\"tag-metadata\" value=\"true\"/>"
679 " <Option name=\"tag-support\" value=\"false\"/>"
680 " <Option name=\"broadcast-info\" value=\"false\"/>"
681 " </EncodingOptions>"
683 " <Normalize enabled=\""+ vtl_normalize +"\" target=\"0\"/>"
686 " <Trim enabled=\"false\"/>"
687 " <Add enabled=\"false\">"
688 " <Duration format=\"Timecode\" hours=\"0\" minutes=\"0\" seconds=\"0\" frames=\"0\"/>"
692 " <Trim enabled=\"false\"/>"
693 " <Add enabled=\"false\">"
694 " <Duration format=\"Timecode\" hours=\"0\" minutes=\"0\" seconds=\"0\" frames=\"0\"/>"
699 "</ExportFormatSpecification>"
701 boost::shared_ptr<ExportFormatSpecification> fmp = _session->get_export_handler()->add_format(*tree.root());
704 samplepos_t start, end;
706 if (insnd_combo.get_active_row_number() == 1) {
707 _transcoder = new TranscodeFfmpeg(invid_path_entry.get_text());
708 if (_transcoder->probe_ok() && _transcoder->get_fps() > 0) {
709 end = _transcoder->get_duration() * _session->nominal_sample_rate() / _transcoder->get_fps();
711 warning << _("Export Video: Cannot query duration of video-file, using duration from timeline instead.") << endmsg;
712 end = ARDOUR_UI::instance()->video_timeline->get_duration();
714 if (_transcoder) {delete _transcoder; _transcoder = 0;}
716 sampleoffset_t av_offset = ARDOUR_UI::instance()->video_timeline->get_offset();
718 printf("audio-range -- AV offset: %lld\n", av_offset);
725 else if (insnd_combo.get_active_row_number() == 2) {
726 start = ARDOUR_UI::instance()->video_timeline->quantify_samples_to_apv(export_range.start());
727 end = ARDOUR_UI::instance()->video_timeline->quantify_samples_to_apv(export_range.end_sample());
730 start = _session->current_start_sample();
731 end = _session->current_end_sample();
734 printf("audio export-range %lld -> %lld\n", start, end);
737 const sampleoffset_t vstart = ARDOUR_UI::instance()->video_timeline->get_offset();
738 const sampleoffset_t vend = vstart + ARDOUR_UI::instance()->video_timeline->get_duration();
740 if ( (start >= end) || (end < vstart) || (start > vend)) {
741 warning << _("Export Video: export-range does not include video.") << endmsg;
742 delete _transcoder; _transcoder = 0;
743 Gtk::Dialog::response(RESPONSE_CANCEL);
747 tsp->set_range (start, end);
748 tsp->set_name ("mysession");
749 tsp->set_range_id ("session");
751 /* add master outs as default */
752 IO* master_out = _session->master_out()->output().get();
754 warning << _("Export Video: No Master Out Ports to Connect for Audio Export") << endmsg;
755 delete _transcoder; _transcoder = 0;
756 Gtk::Dialog::response(RESPONSE_CANCEL);
759 for (uint32_t n = 0; n < master_out->n_ports().n_audio(); ++n) {
760 PortExportChannel * channel = new PortExportChannel ();
761 channel->add_port (master_out->audio (n));
762 ExportChannelPtr chan_ptr (channel);
763 ccp->register_channel (chan_ptr);
767 fnp->set_timespan(tsp);
768 fnp->set_label("vtl");
769 fnp->include_label = true;
770 _insnd = fnp->get_path(fmp);
772 /* do sound export */
773 fmp->set_soundcloud_upload(false);
774 _session->get_export_handler()->reset ();
775 _session->get_export_handler()->add_export_config (tsp, ccp, fmp, fnp, b);
776 _session->get_export_handler()->do_export();
777 status = _session->get_export_status ();
779 audio_progress_connection = Glib::signal_timeout().connect (sigc::mem_fun(*this, &ExportVideoDialog::audio_progress_display), 100);
780 _previous_progress = 0.0;
781 while (status->running ()) {
782 if (_aborted) { status->abort(); }
783 if (gtk_events_pending()) {
784 gtk_main_iteration ();
786 Glib::usleep (10000);
789 audio_progress_connection.disconnect();
791 if (status->aborted()) {
792 ::g_unlink (_insnd.c_str());
793 delete _transcoder; _transcoder = 0;
794 Gtk::Dialog::response(RESPONSE_CANCEL);
797 pbar.set_text (_("Encoding Video..."));
802 ExportVideoDialog::encode_pass (int pass)
804 std::string outfn = outfn_path_entry.get_text();
805 std::string invid = invid_path_entry.get_text();
807 _transcoder = new TranscodeFfmpeg(invid);
808 if (!_transcoder->ffexec_ok()) {
809 /* ffmpeg binary was not found. TranscodeFfmpeg prints a warning */
810 ::g_unlink (_insnd.c_str());
811 delete _transcoder; _transcoder = 0;
812 Gtk::Dialog::response(RESPONSE_CANCEL);
815 if (!_transcoder->probe_ok()) {
816 /* video input file can not be read */
817 warning << _("Export Video: Video input file cannot be read.") << endmsg;
818 ::g_unlink (_insnd.c_str());
819 delete _transcoder; _transcoder = 0;
820 Gtk::Dialog::response(RESPONSE_CANCEL);
824 std::string preset = preset_combo.get_active_text();
825 TranscodeFfmpeg::FFSettings ffs ; /* = transcoder->default_encoder_settings(); */
828 if (fps_checkbox.get_active()) {
829 ffs["-r"] = fps_combo.get_active_text();
830 _transcoder->set_fps(atof(fps_combo.get_active_text()));
833 if (scale_checkbox.get_active()) {
834 ffs["-s"] = string_compose("%1x%2", width_spinner.get_value(), height_spinner.get_value());
837 if (video_codec_combo.get_active_text() != _("(default for format)")) {
838 ffs["-vcodec"] = video_codec_combo.get_active_text();
840 if (audio_codec_combo.get_active_text() != _("(default for format)")) {
841 ffs["-acodec"] = audio_codec_combo.get_active_text();
844 if (video_bitrate_combo.get_active_text() == _("(default)") ) {
847 else if (video_bitrate_combo.get_active_text() == _("(retain)") ) {
848 ffs["-qscale"] = "0";
850 ffs["-b:v"] = video_bitrate_combo.get_active_text();
853 if (audio_bitrate_combo.get_active_text() != _("(default)") ) {
854 ffs["-b:a"] = audio_bitrate_combo.get_active_text();
857 if (audio_codec_combo.get_active_text() == "aac" ) {
858 ffs["-strict"] = "-2";
861 if (video_codec_combo.get_active_text() == "h264" ) {
862 ffs["-vcodec"] = "libx264";
864 else if (video_codec_combo.get_active_text() == "vpx (webm)" ) {
865 ffs["-vcodec"] = "libvpx";
871 if (optimizations_checkbox.get_active()) {
872 if (video_codec_combo.get_active_text() == "mpeg2video") {
874 ffs["-trellis"] = "2";
876 ffs["-subcmp"] = "2";
878 else if (video_codec_combo.get_active_text() == "mpeg4") {
880 ffs["-flags"] = "+mv4+aic";
881 ffs["-trellis"] = "2";
883 ffs["-subcmp"] = "2";
886 else if (video_codec_combo.get_active_text() == "flv") {
889 ffs["-subcmp"] = "2";
890 ffs["-trellis"] = "2";
891 ffs["-flags"] = "+aic+mv0+mv4";
896 if (bframes_checkbox.get_active() && (
897 video_codec_combo.get_active_text() == "mpeg2video"
898 || video_codec_combo.get_active_text() == "mpeg4"
903 if (preset == "dvd-PAL") {
904 ffs.clear(); /* ignore all prev settings */
905 ffs["-target"] = "pal-dvd";
906 ffs["-aspect"] = "4:3"; /* required for DVD - may be overridden below */
908 else if (preset == "dvd-NTSC") {
909 ffs.clear(); /* ignore all prev settings */
910 ffs["-target"] = "ntsc-dvd";
911 ffs["-aspect"] = "4:3"; /* required for DVD - may be overridden below */
914 if (aspect_checkbox.get_active()) {
915 ffs["-aspect"] = aspect_combo.get_active_text();
917 if (deinterlace_checkbox.get_active()) {
918 ffs["-deinterlace"] = "-y"; // we use '-y' as dummy parameter for non key/value options
922 if (pass == 1 && _twopass) {
923 pbar.set_text (_("Encoding Video.. Pass 1/2"));
927 ffs["-passlogfile"] = Glib::path_get_dirname (outfn) + G_DIR_SEPARATOR + "ffmpeg2pass";
928 ffs["-f"] = get_file_extension(invid).empty()?"mov":get_file_extension(invid);
929 #ifdef PLATFORM_WINDOWS
934 } else if (pass == 2) {
935 pbar.set_text (_("Encoding Video.. Pass 2/2"));
937 ffs["-passlogfile"] = Glib::path_get_dirname (outfn) + G_DIR_SEPARATOR + "ffmpeg2pass";
940 sampleoffset_t av_offset = ARDOUR_UI::instance()->video_timeline->get_offset();
941 double duration_s = 0;
943 if (insnd_combo.get_active_row_number() == 0) {
944 /* session start to session end */
945 samplecnt_t duration_f = _session->current_end_sample() - _session->current_start_sample();
946 duration_s = (double)duration_f / (double)_session->nominal_sample_rate();
947 } else if (insnd_combo.get_active_row_number() == 2) {
949 duration_s = export_range.length() / (double)_session->nominal_sample_rate();
951 /* video start to end */
952 samplecnt_t duration_f = ARDOUR_UI::instance()->video_timeline->get_duration();
953 if (av_offset < 0 ) {
954 duration_f += av_offset;
956 duration_s = (double)duration_f / (double)_session->nominal_sample_rate();
959 std::ostringstream osstream; osstream << duration_s;
960 ffs["-t"] = osstream.str();
961 _transcoder->set_duration(duration_s * _transcoder->get_fps());
963 if (insnd_combo.get_active_row_number() == 0 || insnd_combo.get_active_row_number() == 2) {
964 samplepos_t start, snend;
965 const sampleoffset_t vid_duration = ARDOUR_UI::instance()->video_timeline->get_duration();
966 if (insnd_combo.get_active_row_number() == 0) {
967 start = _session->current_start_sample();
968 snend = _session->current_end_sample();
970 start = export_range.start();
971 snend = export_range.end_sample();
975 printf("AV offset: %lld Vid-len: %lld Vid-end: %lld || start:%lld || end:%lld\n",
976 av_offset, vid_duration, av_offset+vid_duration, start, snend); // XXX
979 if (av_offset > start && av_offset + vid_duration < snend) {
980 _transcoder->set_leadinout((av_offset - start) / (double)_session->nominal_sample_rate(),
981 (snend - (av_offset + vid_duration)) / (double)_session->nominal_sample_rate());
982 } else if (av_offset > start) {
983 _transcoder->set_leadinout((av_offset - start) / (double)_session->nominal_sample_rate(), 0);
984 } else if (av_offset + vid_duration < snend) {
985 _transcoder->set_leadinout(0, (snend - (av_offset + vid_duration)) / (double)_session->nominal_sample_rate());
986 _transcoder->set_avoffset((av_offset - start) / (double)_session->nominal_sample_rate());
989 else if (start > av_offset) {
990 std::ostringstream osstream; osstream << ((start - av_offset) / (double)_session->nominal_sample_rate());
991 ffs["-ss"] = osstream.str();
995 _transcoder->set_avoffset((av_offset - start) / (double)_session->nominal_sample_rate());
998 } else if (av_offset < 0) {
999 /* from 00:00:00:00 to video-end */
1000 _transcoder->set_avoffset(av_offset / (double)_session->nominal_sample_rate());
1003 /* NOTE: type (MetaDataMap) == type (FFSettings) == map<string, string> */
1004 ARDOUR::SessionMetadata::MetaDataMap meta = _transcoder->default_meta_data();
1005 if (meta_checkbox.get_active()) {
1006 ARDOUR::SessionMetadata * session_data = ARDOUR::SessionMetadata::Metadata();
1007 session_data->av_export_tag (meta);
1010 #if 1 /* tentative debug mode */
1011 if (debug_checkbox.get_active()) {
1012 _transcoder->set_debug(true);
1016 _transcoder->Progress.connect(*this, invalidator (*this), boost::bind (&ExportVideoDialog::update_progress , this, _1, _2), gui_context());
1017 _transcoder->Finished.connect(*this, invalidator (*this), boost::bind (&ExportVideoDialog::finished, this), gui_context());
1018 if (!_transcoder->encode(outfn, _insnd, invid, ffs, meta, map)) {
1019 ARDOUR_UI::instance()->popup_error(_("Transcoding failed."));
1020 delete _transcoder; _transcoder = 0;
1021 Gtk::Dialog::response(RESPONSE_CANCEL);
1027 ExportVideoDialog::change_file_extension (std::string ext)
1029 if (ext == "") return;
1030 outfn_path_entry.set_text (
1031 strip_file_extension(outfn_path_entry.get_text()) + ext
1036 ExportVideoDialog::width_value_changed ()
1038 if (_suspend_signals) {
1041 if (_session && !_suspend_dirty) _session->set_dirty ();
1042 if (!scale_checkbox.get_active() || !scale_aspect.get_active()) {
1045 if (_video_source_aspect_ratio <= 0) {
1048 _suspend_signals = true;
1049 height_spinner.set_value(rintf(width_spinner.get_value() / _video_source_aspect_ratio));
1050 _suspend_signals = false;
1054 ExportVideoDialog::height_value_changed ()
1056 if (_suspend_signals) {
1059 if (_session && !_suspend_dirty) _session->set_dirty ();
1060 if (!scale_checkbox.get_active() || !scale_aspect.get_active()) {
1063 if (_video_source_aspect_ratio <= 0) {
1066 _suspend_signals = true;
1067 width_spinner.set_value(rintf(height_spinner.get_value() * _video_source_aspect_ratio));
1068 _suspend_signals = false;
1072 ExportVideoDialog::scale_checkbox_toggled ()
1074 scale_aspect.set_sensitive(scale_checkbox.get_active());
1075 width_spinner.set_sensitive(scale_checkbox.get_active());
1076 height_spinner.set_sensitive(scale_checkbox.get_active());
1077 if (_session && !_suspend_dirty) _session->set_dirty ();
1081 ExportVideoDialog::fps_checkbox_toggled ()
1083 fps_combo.set_sensitive(fps_checkbox.get_active());
1084 if (_session && !_suspend_dirty) _session->set_dirty ();
1088 ExportVideoDialog::aspect_checkbox_toggled ()
1090 aspect_combo.set_sensitive(aspect_checkbox.get_active());
1091 if (_session && !_suspend_dirty) _session->set_dirty ();
1095 ExportVideoDialog::video_codec_combo_changed ()
1097 if (( video_codec_combo.get_active_text() == "mpeg4"
1098 ||video_codec_combo.get_active_text() == "mpeg2video"
1100 preset_combo.get_active_text() == "dvd-PAL"
1101 ||preset_combo.get_active_text() == "dvd-NTSC"
1103 bframes_checkbox.set_sensitive(true);
1104 optimizations_checkbox.set_sensitive(true);
1105 if (video_codec_combo.get_active_text() == "mpeg2video") {
1106 optimizations_label.set_text("-mbd rd -trellis 2 -cmp 2 -subcmp 2"); // mpeg2
1107 } else if (video_codec_combo.get_active_text() == "mpeg4") {
1108 optimizations_label.set_text("-mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300"); // mpeg4
1110 optimizations_label.set_text("-mbd 2 -cmp 2 -subcmp 2 -trellis 2 -flags +aic+mv0+mv4 -g 160"); // flv
1113 bframes_checkbox.set_sensitive(false);
1114 bframes_checkbox.set_active(false);
1115 optimizations_checkbox.set_sensitive(false);
1116 optimizations_checkbox.set_active(false);
1117 optimizations_label.set_text("-");
1119 if (_session && !_suspend_dirty) _session->set_dirty ();
1123 ExportVideoDialog::preset_combo_changed ()
1125 std::string p = preset_combo.get_active_text();
1126 scale_checkbox.set_sensitive(true);
1129 change_file_extension(".flv");
1130 audio_codec_combo.set_active(2);
1131 video_codec_combo.set_active(1);
1132 audio_bitrate_combo.set_active(2);
1133 video_bitrate_combo.set_active(3);
1134 audio_samplerate_combo.set_active(1);
1136 else if (p == "you-tube") {
1137 change_file_extension(".avi");
1138 audio_codec_combo.set_active(3);
1139 video_codec_combo.set_active(6);
1140 audio_bitrate_combo.set_active(2);
1141 video_bitrate_combo.set_active(4);
1142 if (_session->nominal_sample_rate() == 48000 || _session->nominal_sample_rate() == 96000) {
1143 audio_samplerate_combo.set_active(2);
1145 audio_samplerate_combo.set_active(1);
1148 else if (p == "ogg") {
1149 change_file_extension(".ogv");
1150 audio_codec_combo.set_active(4);
1151 video_codec_combo.set_active(2);
1152 audio_bitrate_combo.set_active(3);
1153 video_bitrate_combo.set_active(4);
1154 if (_session->nominal_sample_rate() == 48000 || _session->nominal_sample_rate() == 96000) {
1155 audio_samplerate_combo.set_active(2);
1157 audio_samplerate_combo.set_active(1);
1160 else if (p == "webm") {
1161 change_file_extension(".webm");
1162 audio_codec_combo.set_active(4);
1163 video_codec_combo.set_active(7);
1164 audio_bitrate_combo.set_active(3);
1165 video_bitrate_combo.set_active(4);
1166 if (_session->nominal_sample_rate() == 48000 || _session->nominal_sample_rate() == 96000) {
1167 audio_samplerate_combo.set_active(2);
1169 audio_samplerate_combo.set_active(1);
1172 else if (p == "dvd-mp2") {
1173 change_file_extension(".mpg");
1174 audio_codec_combo.set_active(5);
1175 video_codec_combo.set_active(4);
1176 audio_bitrate_combo.set_active(4);
1177 video_bitrate_combo.set_active(5);
1178 audio_samplerate_combo.set_active(2);
1180 else if (p == "dvd-NTSC" || p == "dvd-PAL") {
1181 change_file_extension(".mpg");
1182 audio_codec_combo.set_active(6);
1183 video_codec_combo.set_active(4);
1184 audio_bitrate_combo.set_active(4);
1185 video_bitrate_combo.set_active(5);
1186 audio_samplerate_combo.set_active(2);
1188 scale_checkbox.set_active(false);
1189 scale_checkbox.set_sensitive(false);
1191 else if (p == "mpeg4") {
1192 change_file_extension(".mp4");
1193 audio_codec_combo.set_active(1);
1194 video_codec_combo.set_active(5);
1195 audio_bitrate_combo.set_active(4);
1196 video_bitrate_combo.set_active(5);
1197 if (_session->nominal_sample_rate() == 48000 || _session->nominal_sample_rate() == 96000) {
1198 audio_samplerate_combo.set_active(2);
1200 audio_samplerate_combo.set_active(1);
1203 else if (p == "mp4/h264/aac") {
1204 change_file_extension(".mp4");
1205 audio_codec_combo.set_active(2);
1206 video_codec_combo.set_active(6);
1207 audio_bitrate_combo.set_active(0);
1208 video_bitrate_combo.set_active(0);
1209 if (_session->nominal_sample_rate() == 48000 || _session->nominal_sample_rate() == 96000) {
1210 audio_samplerate_combo.set_active(2);
1212 audio_samplerate_combo.set_active(1);
1217 audio_codec_combo.set_sensitive(true);
1218 video_codec_combo.set_sensitive(true);
1219 audio_bitrate_combo.set_sensitive(true);
1220 video_bitrate_combo.set_sensitive(true);
1221 audio_samplerate_combo.set_sensitive(true);
1223 audio_codec_combo.set_sensitive(false);
1224 video_codec_combo.set_sensitive(false);
1225 audio_bitrate_combo.set_sensitive(false);
1226 video_bitrate_combo.set_sensitive(false);
1227 audio_samplerate_combo.set_sensitive(false);
1230 Gtk::Table *t = (Gtk::Table*) preset_combo.get_parent();
1231 Gtk::Table_Helpers::TableList c = t->children();
1232 Gtk::Table_Helpers::TableList::iterator it;
1233 if (p == "dvd-PAL" || p == "dvd-NTSC") {
1234 for (it = c.begin(); it != c.end(); ++it) {
1235 int row = it->get_top_attach();
1236 if (row == 2 || row == 3 || row== 5 || row== 6 || row == 9) {
1237 it->get_widget()->hide();
1241 for (it = c.begin(); it != c.end(); ++it) {
1242 int row = it->get_top_attach();
1243 if (row == 2 || row == 3 || row== 5 || row== 6 || row == 9) {
1244 it->get_widget()->show();
1249 video_codec_combo_changed();
1253 ExportVideoDialog::open_outfn_dialog ()
1255 Gtk::FileChooserDialog dialog(_("Save Exported Video File"), Gtk::FILE_CHOOSER_ACTION_SAVE);
1256 dialog.set_filename (outfn_path_entry.get_text());
1258 dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
1259 dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
1261 int result = dialog.run();
1263 if (result == Gtk::RESPONSE_OK) {
1264 std::string filename = dialog.get_filename();
1266 if (filename.length()) {
1267 outfn_path_entry.set_text (filename);
1273 ExportVideoDialog::open_invid_dialog ()
1275 Gtk::FileChooserDialog dialog(_("Save Exported Video File"), Gtk::FILE_CHOOSER_ACTION_SAVE);
1276 dialog.set_filename (invid_path_entry.get_text());
1278 dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
1279 dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
1281 int result = dialog.run();
1283 if (result == Gtk::RESPONSE_OK) {
1284 std::string filename = dialog.get_filename();
1286 if (filename.length()) {
1287 invid_path_entry.set_text (filename);