From 1237a4f3bb37a6674a25229fcf1e6a27c122ad8c Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 15 Apr 2022 18:25:18 +0200 Subject: [PATCH] VTL: refine video-export UI (tooltips, error dialog, etc) --- gtk2_ardour/export_video_dialog.cc | 44 ++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/gtk2_ardour/export_video_dialog.cc b/gtk2_ardour/export_video_dialog.cc index f7ffd74ae5..6700f009f6 100644 --- a/gtk2_ardour/export_video_dialog.cc +++ b/gtk2_ardour/export_video_dialog.cc @@ -48,6 +48,7 @@ #include "ardour/session_metadata.h" #include "gtkmm2ext/utils.h" +#include "widgets/tooltips.h" #include "ardour_message.h" #include "export_video_dialog.h" @@ -59,6 +60,7 @@ using namespace Gtk; using namespace std; using namespace PBD; using namespace ARDOUR; +using namespace ArdourWidgets; using namespace VideoUtils; ExportVideoDialog::ExportVideoDialog () @@ -74,9 +76,9 @@ ExportVideoDialog::ExportVideoDialog () , transcode_button (_("Export")) , abort_button (_("Abort")) , progress_box (0) - , normalize_checkbox (_("Normalize Audio")) - , copy_video_codec_checkbox (_("Copy Video Codec")) - , meta_checkbox (_("Include Session Metadata")) + , normalize_checkbox (_("Normalize audio")) + , copy_video_codec_checkbox (_("Mux only - copy video codec")) + , meta_checkbox (_("Include session metadata")) , debug_checkbox (_("Debug Mode: Print ffmpeg command and output to stdout.")) { set_name ("ExportVideoDialog"); @@ -159,7 +161,7 @@ ExportVideoDialog::ExportVideoDialog () t->attach (insnd_combo, 1, 2, ty, ty + 1); ty++; - l = manage (new Label (_("Audio Rate:"), ALIGN_START, ALIGN_CENTER, false)); + l = manage (new Label (_("Sample rate:"), ALIGN_START, ALIGN_CENTER, false)); t->attach (*l, 0, 1, ty, ty + 1); t->attach (audio_sample_rate_combo, 1, 2, ty, ty + 1); ty++; @@ -189,6 +191,12 @@ ExportVideoDialog::ExportVideoDialog () progress_box->pack_start (abort_button, false, false); get_vbox ()->pack_start (*progress_box, false, false); + set_tooltip (normalize_checkbox, _("When enabled, the audio is normalized to 0dBFS during export.")); + set_tooltip (copy_video_codec_checkbox, _("When enabled, the video is not re-encoded, but the original video codec is reused. In some cases this can lead to audio/video synchronization issues. This also only works if the exported range is not longer than the video. Adding black space at the start or end requires encoding.\nWhen disabled, the video is re-encoded, this may lead to quality loss, but this is the safer option and generally preferable.")); + set_tooltip (meta_checkbox, _("When enabled, information from Menu > Session > Metadata is included in the video file.")); + set_tooltip (audio_sample_rate_combo, _("Select the sample rate of the audio track. Prefer 48kHz.")); + set_tooltip (audio_sample_rate_combo, _("Select the bitrate of the audio track in kbit/sec. Higher values result in better quality.")); + outfn_browse_button.signal_clicked ().connect (sigc::mem_fun (*this, &ExportVideoDialog::open_outfn_dialog)); invid_browse_button.signal_clicked ().connect (sigc::mem_fun (*this, &ExportVideoDialog::open_invid_dialog)); transcode_button.signal_clicked ().connect (sigc::mem_fun (*this, &ExportVideoDialog::launch_export)); @@ -484,6 +492,7 @@ ExportVideoDialog::launch_export () break; } + /* clang-format off */ tree.read_buffer (std::string ( "" "" @@ -516,6 +525,7 @@ ExportVideoDialog::launch_export () " " "") .c_str ()); + /* clang-format on */ boost::shared_ptr fmp = _session->get_export_handler ()->add_format (*tree.root ()); @@ -559,13 +569,35 @@ ExportVideoDialog::launch_export () const sampleoffset_t vend = vstart + ARDOUR_UI::instance ()->video_timeline->get_duration (); if ((start >= end) || (end < vstart) || (start > vend)) { - warning << _("Export Video: export-range does not include video.") << endmsg; delete _transcoder; _transcoder = 0; + ArdourMessageDialog msg (_("Export Video: The export-range does not include video.")); + msg.run (); Gtk::Dialog::response (RESPONSE_CANCEL); return; } + if ((start < vstart || end > vend) && copy_video_codec_checkbox.get_active ()) { + ArdourMessageDialog msg ( + _("The export-range is longer than the video file. " + "To add black frames the video has to be encoded. " + "Copying the codec may fail or not produce the intended result.\n" + "Continue anyway?"), + false, + Gtk::MESSAGE_INFO, + Gtk::BUTTONS_YES_NO, + true + ); + msg.set_default_response (Gtk::RESPONSE_YES); + + if (msg.run() != Gtk::RESPONSE_YES) { + delete _transcoder; + _transcoder = 0; + Gtk::Dialog::response (RESPONSE_CANCEL); + return; + } + } + tsp->set_range (start, end); tsp->set_name ("mysession"); tsp->set_range_id ("session"); @@ -734,7 +766,7 @@ ExportVideoDialog::encode_video () ffs["-codec:v"] = "copy"; } - if (audio_bitrate_combo.get_active_text () != _("(default)")) { + if (audio_bitrate_combo.get_active_row_number () > 0) { ffs["-b:a"] = audio_bitrate_combo.get_active_text (); }