From 5881fda044765e2a979c9243a71a724285bc4933 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Mon, 31 Dec 2012 13:08:45 +0100 Subject: [PATCH] Rewrite screen capture to use FFmpeg instead of recordMyDesktop, fixes many issues like: http://kdenlive.org/mantis/view.php?id=2643 --- data/encodingprofiles.rc | 4 + src/encodingprofilesdialog.cpp | 8 +- src/kdenlivesettings.kcfg | 103 +++------ src/kdenlivesettingsdialog.cpp | 119 +++++----- src/kdenlivesettingsdialog.h | 3 +- src/mainwindow.cpp | 11 + src/projecttree/abstractclipjob.cpp | 2 +- src/recmonitor.cpp | 77 ++++--- src/widgets/configcapture_ui.ui | 323 +++++++--------------------- src/wizard.cpp | 8 +- 10 files changed, 233 insertions(+), 425 deletions(-) diff --git a/data/encodingprofiles.rc b/data/encodingprofiles.rc index f7d8618c..a690b796 100644 --- a/data/encodingprofiles.rc +++ b/data/encodingprofiles.rc @@ -5,6 +5,10 @@ Normal MPEG=vcodec=mpeg2video qscale=10 acodec=mp2 ac=2 ab=128k ar=48000 threads [proxy] Normal MPEG=-f mpegts -acodec libmp3lame -ac 2 -ab 128k -ar 48000 -vcodec mpeg2video -g 5 -deinterlace -s 480x270 -vb 400k;ts +[screengrab] +X246 mute=-vcodec libx264 -preset fast -threads 0;mkv +X246 with audio=-f alsa -i pulse -acodec pcm_s16le -vcodec libx264 -preset fast -threads 0;mkv + [video4linux] Normal MPEG=f=mpeg acodec=mp2 ab=128k ar=48000 vcodec=mpeg2video minrate=0 vb=4000k;mpg diff --git a/src/encodingprofilesdialog.cpp b/src/encodingprofilesdialog.cpp index 59116f74..3b14a176 100644 --- a/src/encodingprofilesdialog.cpp +++ b/src/encodingprofilesdialog.cpp @@ -39,7 +39,8 @@ EncodingProfilesDialog::EncodingProfilesDialog(int profileType, QWidget * parent setWindowTitle(i18n("Manage Encoding Profiles")); profile_type->addItem(i18n("Proxy clips"), 0); profile_type->addItem(i18n("Video4Linux capture"), 1); - profile_type->addItem(i18n("Decklink capture"), 2); + profile_type->addItem(i18n("Screen capture"), 2); + profile_type->addItem(i18n("Decklink capture"), 3); button_add->setIcon(KIcon("list-add")); button_edit->setIcon(KIcon("document-edit")); @@ -75,8 +76,11 @@ void EncodingProfilesDialog::slotLoadProfiles() case 1: group = "video4linux"; break; + case 2: + group = "screengrab"; + break; default: - case 2: + case 3: group = "decklink"; break; } diff --git a/src/kdenlivesettings.kcfg b/src/kdenlivesettings.kcfg index 2df1a816..c532b515 100644 --- a/src/kdenlivesettings.kcfg +++ b/src/kdenlivesettings.kcfg @@ -396,118 +396,63 @@ 0 - - - - true + + + + 0 - - - - false + + + + - - - - system:capture_1 + + + + - + 0 - + false - + - 1 + 0 - + - 1 + 0 - + 1280 - + 720 - - - 1 - - - + 15.0 - - - - 2000000 - - - - - 63 - - - - false - - - - - - - - - - - - - - - - - - - - 0 - - - - - 48000 - - - - - 0 - - - - - 0.0 - - - + - false + true - + false diff --git a/src/kdenlivesettingsdialog.cpp b/src/kdenlivesettingsdialog.cpp index c213043f..89901ed9 100644 --- a/src/kdenlivesettingsdialog.cpp +++ b/src/kdenlivesettingsdialog.cpp @@ -216,10 +216,6 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap& map m_configTranscode.profile_parameters->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 5); - connect(m_configCapture.kcfg_rmd_capture_audio, SIGNAL(clicked(bool)), m_configCapture.audio_group, SLOT(setVisible(bool))); - - m_configCapture.audio_group->setVisible(KdenliveSettings::rmd_capture_audio()); - connect(m_configEnv.kp_image, SIGNAL(clicked()), this, SLOT(slotEditImageApplication())); connect(m_configEnv.kp_audio, SIGNAL(clicked()), this, SLOT(slotEditAudioApplication())); connect(m_configEnv.kp_player, SIGNAL(clicked()), this, SLOT(slotEditVideoApplication())); @@ -232,9 +228,9 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap& map connect(m_configSdl.kcfg_audio_driver, SIGNAL(currentIndexChanged(int)), this, SLOT(slotCheckAlsaDriver())); initDevices(); connect(m_configProject.kcfg_profiles_list, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDisplay())); - connect(m_configCapture.kcfg_rmd_capture_type, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateRmdRegionStatus())); + connect(m_configCapture.kcfg_grab_capture_type, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateGrabRegionStatus())); - slotUpdateRmdRegionStatus(); + slotUpdateGrabRegionStatus(); loadTranscodeProfiles(); @@ -256,7 +252,7 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap& map connect(m_configCapture.kcfg_decklink_profile, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDecklinkProfile())); connect(m_configCapture.decklink_showprofileinfo, SIGNAL(clicked(bool)), m_configCapture.decklink_parameters, SLOT(setVisible(bool))); - // v4l profile + // ffmpeg profile m_configCapture.v4l_showprofileinfo->setIcon(KIcon("help-about")); m_configCapture.v4l_manageprofile->setIcon(KIcon("configure")); m_configCapture.v4l_parameters->setVisible(false); @@ -265,6 +261,16 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap& map connect(m_configCapture.v4l_manageprofile, SIGNAL(clicked(bool)), this, SLOT(slotManageEncodingProfile())); connect(m_configCapture.kcfg_v4l_profile, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateV4lProfile())); connect(m_configCapture.v4l_showprofileinfo, SIGNAL(clicked(bool)), m_configCapture.v4l_parameters, SLOT(setVisible(bool))); + + // screen grab profile + m_configCapture.grab_showprofileinfo->setIcon(KIcon("help-about")); + m_configCapture.grab_manageprofile->setIcon(KIcon("configure")); + m_configCapture.grab_parameters->setVisible(false); + m_configCapture.grab_parameters->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 4); + m_configCapture.grab_parameters->setPlainText(KdenliveSettings::grab_parameters()); + connect(m_configCapture.grab_manageprofile, SIGNAL(clicked(bool)), this, SLOT(slotManageEncodingProfile())); + connect(m_configCapture.kcfg_grab_profile, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateGrabProfile())); + connect(m_configCapture.grab_showprofileinfo, SIGNAL(clicked(bool)), m_configCapture.grab_parameters, SLOT(setVisible(bool))); // proxy profile stuff m_configProject.proxy_showprofileinfo->setIcon(KIcon("help-about")); @@ -279,6 +285,7 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap& map slotUpdateProxyProfile(-1); slotUpdateV4lProfile(-1); + slotUpdateGrabProfile(-1); slotUpdateDecklinkProfile(-1); Render::getBlackMagicDeviceList(m_configCapture.kcfg_decklink_capturedevice); @@ -306,22 +313,13 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(const QMap& map } m_configCapture.dvgrab_info->setText(i18n("dvgrab version %1 at %2", dvgrabVersion, KdenliveSettings::dvgrab_path())); } else m_configCapture.dvgrab_info->setText(i18n("dvgrab utility not found, please install it for firewire capture")); - - if (KdenliveSettings::rmd_path().isEmpty() || !QFile::exists(KdenliveSettings::rmd_path())) { - QString rmdpath = KStandardDirs::findExe("recordmydesktop"); - KdenliveSettings::setRmd_path(rmdpath); - } - if (KdenliveSettings::rmd_path().isEmpty()) - m_configCapture.rmd_info->setText(i18n("Recordmydesktop utility not found, please install it for screen grabs")); - else - m_configCapture.rmd_info->setText(i18n("Recordmydesktop found at: %1", KdenliveSettings::rmd_path())); } KdenliveSettingsDialog::~KdenliveSettingsDialog() {} -void KdenliveSettingsDialog::slotUpdateRmdRegionStatus() +void KdenliveSettingsDialog::slotUpdateGrabRegionStatus() { - m_configCapture.region_group->setHidden(m_configCapture.kcfg_rmd_capture_type->currentIndex() != 1); + m_configCapture.region_group->setHidden(m_configCapture.kcfg_grab_capture_type->currentIndex() != 1); } void KdenliveSettingsDialog::slotEnableCaptureFolder() @@ -387,7 +385,6 @@ void KdenliveSettingsDialog::initDevices() // Fill the list of audio playback / recording devices m_configSdl.kcfg_audio_device->addItem(i18n("Default"), QString()); - m_configCapture.kcfg_rmd_alsa_device->addItem(i18n("Default"), QString()); m_configCapture.kcfg_v4l_alsadevice->addItem(i18n("Default"), "default"); if (!KStandardDirs::findExe("aplay").isEmpty()) { m_readProcess.setOutputChannelMode(KProcess::OnlyStdoutChannel); @@ -408,7 +405,6 @@ void KdenliveSettingsDialog::initDevices() } if (line.contains("capture")) { deviceId = line.section(':', 0, 0); - m_configCapture.kcfg_rmd_alsa_device->addItem(line.section(':', 1, 1).simplified(), "plughw:" + QString::number(deviceId.section('-', 0, 0).toInt()) + ',' + QString::number(deviceId.section('-', 1, 1).toInt())); m_configCapture.kcfg_v4l_alsadevice->addItem(line.section(':', 1, 1).simplified(), "hw:" + QString::number(deviceId.section('-', 0, 0).toInt()) + ',' + QString::number(deviceId.section('-', 1, 1).toInt())); } line = stream.readLine(); @@ -427,13 +423,6 @@ void KdenliveSettingsDialog::initDevices() KdenliveSettings::setAudio_device(ix); } - if (!KdenliveSettings::rmd_alsadevicename().isEmpty()) { - // Select correct alsa device - int ix = m_configCapture.kcfg_rmd_alsa_device->findData(KdenliveSettings::rmd_alsadevicename()); - m_configCapture.kcfg_rmd_alsa_device->setCurrentIndex(ix); - KdenliveSettings::setRmd_alsa_device(ix); - } - if (!KdenliveSettings::v4l_alsadevicename().isEmpty()) { // Select correct alsa device int ix = m_configCapture.kcfg_v4l_alsadevice->findData(KdenliveSettings::v4l_alsadevicename()); @@ -457,7 +446,6 @@ void KdenliveSettingsDialog::slotReadAudioDevices() QString card = data.section(':', 0, 0).section(' ', -1); QString device = data.section(':', 1, 1).section(' ', -1); m_configSdl.kcfg_audio_device->addItem(data.section(':', -1).simplified(), "plughw:" + card + ',' + device); - m_configCapture.kcfg_rmd_alsa_device->addItem(data.section(':', -1).simplified(), "plughw:" + card + ',' + device); m_configCapture.kcfg_v4l_alsadevice->addItem(data.section(':', -1).simplified(), "hw:" + card + ',' + device); } } @@ -649,16 +637,26 @@ void KdenliveSettingsDialog::updateSettings() } // Check encoding profiles + // FFmpeg QString data = m_configCapture.kcfg_v4l_profile->itemData(m_configCapture.kcfg_v4l_profile->currentIndex()).toString(); if (!data.isEmpty() && (data.section(';', 0, 0) != KdenliveSettings::v4l_parameters() || data.section(';', 1, 1) != KdenliveSettings::v4l_extension())) { KdenliveSettings::setV4l_parameters(data.section(';', 0, 0)); KdenliveSettings::setV4l_extension(data.section(';', 1, 1)); } + // screengrab + data = m_configCapture.kcfg_grab_profile->itemData(m_configCapture.kcfg_grab_profile->currentIndex()).toString(); + if (!data.isEmpty() && (data.section(';', 0, 0) != KdenliveSettings::grab_parameters() || data.section(';', 1, 1) != KdenliveSettings::grab_extension())) { + KdenliveSettings::setGrab_parameters(data.section(';', 0, 0)); + KdenliveSettings::setGrab_extension(data.section(';', 1, 1)); + } + + // decklink data = m_configCapture.kcfg_decklink_profile->itemData(m_configCapture.kcfg_decklink_profile->currentIndex()).toString(); if (!data.isEmpty() && (data.section(';', 0, 0) != KdenliveSettings::decklink_parameters() || data.section(';', 1, 1) != KdenliveSettings::decklink_extension())) { KdenliveSettings::setDecklink_parameters(data.section(';', 0, 0)); KdenliveSettings::setDecklink_extension(data.section(';', 1, 1)); } + // proxies data = m_configProject.kcfg_proxy_profile->itemData(m_configProject.kcfg_proxy_profile->currentIndex()).toString(); if (!data.isEmpty() && (data.section(';', 0, 0) != KdenliveSettings::proxyparams() || data.section(';', 1, 1) != KdenliveSettings::proxyextension())) { KdenliveSettings::setProxyparams(data.section(';', 0, 0)); @@ -668,23 +666,11 @@ void KdenliveSettingsDialog::updateSettings() if (updateCapturePath) emit updateCaptureFolder(); - QString value = m_configCapture.kcfg_rmd_alsa_device->itemData(m_configCapture.kcfg_rmd_alsa_device->currentIndex()).toString(); - if (value != KdenliveSettings::rmd_alsadevicename()) { - KdenliveSettings::setRmd_alsadevicename(value); - } - - value = m_configCapture.kcfg_v4l_alsadevice->itemData(m_configCapture.kcfg_v4l_alsadevice->currentIndex()).toString(); + QString value = m_configCapture.kcfg_v4l_alsadevice->itemData(m_configCapture.kcfg_v4l_alsadevice->currentIndex()).toString(); if (value != KdenliveSettings::v4l_alsadevicename()) { KdenliveSettings::setV4l_alsadevicename(value); } - value = m_configCapture.kcfg_rmd_audio_freq->itemText(m_configCapture.kcfg_rmd_audio_freq->currentIndex()); - kDebug() << "// AUDIO FREQ VALUE: " << value << ", CURRENT: " << KdenliveSettings::rmd_freq() << ", IX: " << m_configCapture.kcfg_rmd_audio_freq->currentIndex(); - if (value != KdenliveSettings::rmd_freq()) { - kDebug() << "// SETTING AUDIO FREQ TO: " << value; - KdenliveSettings::setRmd_freq(value); - } - if (m_configSdl.kcfg_external_display->isChecked() != KdenliveSettings::external_display()) { KdenliveSettings::setExternal_display(m_configSdl.kcfg_external_display->isChecked()); resetProfile = true; @@ -1013,8 +999,7 @@ void KdenliveSettingsDialog::slotManageEncodingProfile() { int type = 0; if (currentPage() == m_page4) { - if (m_configCapture.tabWidget->currentIndex() == 1) type = 1; - else if (m_configCapture.tabWidget->currentIndex() == 3) type = 2; + type = m_configCapture.tabWidget->currentIndex(); } QPointer d = new EncodingProfilesDialog(type); d->exec(); @@ -1039,17 +1024,31 @@ void KdenliveSettingsDialog::loadEncodingProfiles() } m_configCapture.kcfg_v4l_profile->blockSignals(false); if (!currentItem.isEmpty()) m_configCapture.kcfg_v4l_profile->setCurrentIndex(m_configCapture.kcfg_v4l_profile->findText(currentItem)); + + // Load Screen Grab profiles + m_configCapture.kcfg_grab_profile->blockSignals(true); + currentItem = m_configCapture.kcfg_grab_profile->currentText(); + m_configCapture.kcfg_grab_profile->clear(); + KConfigGroup group2(&conf, "screengrab"); + values = group2.entryMap(); + QMapIterator j(values); + while (j.hasNext()) { + j.next(); + if (!j.key().isEmpty()) m_configCapture.kcfg_grab_profile->addItem(j.key(), j.value()); + } + m_configCapture.kcfg_grab_profile->blockSignals(false); + if (!currentItem.isEmpty()) m_configCapture.kcfg_grab_profile->setCurrentIndex(m_configCapture.kcfg_grab_profile->findText(currentItem)); // Load Decklink profiles m_configCapture.kcfg_decklink_profile->blockSignals(true); currentItem = m_configCapture.kcfg_decklink_profile->currentText(); m_configCapture.kcfg_decklink_profile->clear(); - KConfigGroup group2(&conf, "decklink"); - values = group2.entryMap(); - QMapIterator j(values); - while (j.hasNext()) { - j.next(); - if (!j.key().isEmpty()) m_configCapture.kcfg_decklink_profile->addItem(j.key(), j.value()); + KConfigGroup group3(&conf, "decklink"); + values = group3.entryMap(); + QMapIterator k(values); + while (k.hasNext()) { + k.next(); + if (!k.key().isEmpty()) m_configCapture.kcfg_decklink_profile->addItem(k.key(), k.value()); } m_configCapture.kcfg_decklink_profile->blockSignals(false); if (!currentItem.isEmpty()) m_configCapture.kcfg_decklink_profile->setCurrentIndex(m_configCapture.kcfg_decklink_profile->findText(currentItem)); @@ -1058,12 +1057,12 @@ void KdenliveSettingsDialog::loadEncodingProfiles() m_configProject.kcfg_proxy_profile->blockSignals(true); currentItem = m_configProject.kcfg_proxy_profile->currentText(); m_configProject.kcfg_proxy_profile->clear(); - KConfigGroup group3(&conf, "proxy"); - values = group3.entryMap(); - QMapIterator k(values); - while (k.hasNext()) { - k.next(); - if (!k.key().isEmpty()) m_configProject.kcfg_proxy_profile->addItem(k.key(), k.value()); + KConfigGroup group4(&conf, "proxy"); + values = group4.entryMap(); + QMapIterator l(values); + while (l.hasNext()) { + l.next(); + if (!l.key().isEmpty()) m_configProject.kcfg_proxy_profile->addItem(l.key(), l.value()); } if (!currentItem.isEmpty()) m_configProject.kcfg_proxy_profile->setCurrentIndex(m_configProject.kcfg_proxy_profile->findText(currentItem)); m_configProject.kcfg_proxy_profile->blockSignals(false); @@ -1091,6 +1090,16 @@ void KdenliveSettingsDialog::slotUpdateV4lProfile(int ix) // } +void KdenliveSettingsDialog::slotUpdateGrabProfile(int ix) +{ + if (ix == -1) ix = KdenliveSettings::grab_profile(); + else ix = m_configCapture.kcfg_grab_profile->currentIndex(); + QString data = m_configCapture.kcfg_grab_profile->itemData(ix).toString(); + if (data.isEmpty()) return; + m_configCapture.grab_parameters->setPlainText(data.section(';', 0, 0)); + // +} + void KdenliveSettingsDialog::slotUpdateProxyProfile(int ix) { if (ix == -1) ix = KdenliveSettings::v4l_profile(); diff --git a/src/kdenlivesettingsdialog.h b/src/kdenlivesettingsdialog.h index e54df0c1..f43a0b3f 100644 --- a/src/kdenlivesettingsdialog.h +++ b/src/kdenlivesettingsdialog.h @@ -59,7 +59,7 @@ private slots: void slotEditAudioApplication(); void slotEditVideoApplication(); void slotReadAudioDevices(); - void slotUpdateRmdRegionStatus(); + void slotUpdateGrabRegionStatus(); void slotCheckAlsaDriver(); void slotAddTranscode(); void slotDeleteTranscode(); @@ -78,6 +78,7 @@ private slots: void slotUpdateDecklinkProfile(int ix = 0); void slotUpdateProxyProfile(int ix = 0); void slotUpdateV4lProfile(int ix = 0); + void slotUpdateGrabProfile(int ix = 0); void slotEditVideo4LinuxProfile(); void slotReloadBlackMagic(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index cdda0689..cecbe4bb 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -646,6 +646,17 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & KdenliveSettings::setV4l_extension(data.section(';', 1, 1)); } } + if (KdenliveSettings::grab_parameters().isEmpty() || KdenliveSettings::grab_extension().isEmpty()) { + KConfigGroup group(&conf, "screengrab"); + QMap< QString, QString > values = group.entryMap(); + QMapIterator i(values); + if (i.hasNext()) { + i.next(); + QString data = i.value(); + KdenliveSettings::setGrab_parameters(data.section(';', 0, 0)); + KdenliveSettings::setGrab_extension(data.section(';', 1, 1)); + } + } if (KdenliveSettings::decklink_parameters().isEmpty() || KdenliveSettings::decklink_extension().isEmpty()) { KConfigGroup group(&conf, "decklink"); QMap< QString, QString > values = group.entryMap(); diff --git a/src/projecttree/abstractclipjob.cpp b/src/projecttree/abstractclipjob.cpp index adf26a15..c39a12e6 100644 --- a/src/projecttree/abstractclipjob.cpp +++ b/src/projecttree/abstractclipjob.cpp @@ -30,8 +30,8 @@ AbstractClipJob::AbstractClipJob(JOBTYPE type, CLIPTYPE cType, const QString &id QObject(), clipType(cType), jobType(type), - m_jobStatus(NOJOB), replaceClip(false), + m_jobStatus(NOJOB), m_clipId(id), m_addClipToProject(false), m_jobProcess(NULL) diff --git a/src/recmonitor.cpp b/src/recmonitor.cpp index a7262fee..27ca6c2d 100644 --- a/src/recmonitor.cpp +++ b/src/recmonitor.cpp @@ -41,6 +41,7 @@ #include #include #include +#include RecMonitor::RecMonitor(Kdenlive::MONITORID name, MonitorManager *manager, QWidget *parent) : @@ -193,7 +194,7 @@ void RecMonitor::slotSwitchFullScreen() void RecMonitor::stop() { // Special case: when recording audio only, do not stop so that we can do voiceover. - if (device_selector->currentIndex() == VIDEO4LINUX && !rec_video->isChecked()) return; + if (device_selector->currentIndex() == SCREENGRAB || (device_selector->currentIndex() == VIDEO4LINUX && !rec_video->isChecked())) return; slotStopCapture(); } @@ -251,12 +252,16 @@ void RecMonitor::slotVideoDeviceChanged(int ix) m_fwdAction->setEnabled(false); m_stopAction->setEnabled(false); m_playAction->setEnabled(false); - if (KdenliveSettings::rmd_path().isEmpty()) { - QString rmdpath = KStandardDirs::findExe("recordmydesktop"); - if (rmdpath.isEmpty()) video_frame->setPixmap(mergeSideBySide(KIcon("dialog-warning").pixmap(QSize(50, 50)), i18n("Recordmydesktop utility not found,\n please install it for screen grabs"))); - else KdenliveSettings::setRmd_path(rmdpath); - } - if (!KdenliveSettings::rmd_path().isEmpty()) video_frame->setPixmap(mergeSideBySide(KIcon("video-display").pixmap(QSize(50, 50)), i18n("Press record button\nto start screen capture\nFiles will be saved in:\n%1", m_capturePath))); + if (KdenliveSettings::ffmpegpath().isEmpty()) { + QString exepath = KStandardDirs::findExe("ffmpeg"); + if (exepath.isEmpty()) { + // Check for libav version + exepath = KStandardDirs::findExe("avconv"); + } + if (exepath.isEmpty()) video_frame->setPixmap(mergeSideBySide(KIcon("dialog-warning").pixmap(QSize(50, 50)), i18n("ffmpeg or avconv not found,\n please install it for screen grabs"))); + else KdenliveSettings::setFfmpegpath(exepath); + } + if (!KdenliveSettings::ffmpegpath().isEmpty()) video_frame->setPixmap(mergeSideBySide(KIcon("video-display").pixmap(QSize(50, 50)), i18n("Press record button\nto start screen capture\nFiles will be saved in:\n%1", m_capturePath))); //video_frame->setText(i18n("Press record button\nto start screen capture")); break; case VIDEO4LINUX: @@ -397,8 +402,8 @@ void RecMonitor::slotStopCapture() break; case SCREENGRAB: m_captureProcess->write("q\n", 3); - m_captureProcess->terminate(); - video_frame->setText(i18n("Encoding captured video...")); + //m_captureProcess->terminate(); + //video_frame->setText(i18n("Encoding captured video...")); QTimer::singleShot(1000, m_captureProcess, SLOT(kill())); break; case VIDEO4LINUX: @@ -569,7 +574,9 @@ void RecMonitor::slotRecord() m_logger.clear(); m_recAction->setChecked(true); QString extension = "mpg"; - if (device_selector->currentIndex() == SCREENGRAB) extension = "ogv"; //KdenliveSettings::screengrabextension(); + if (device_selector->currentIndex() == SCREENGRAB) { + extension = KdenliveSettings::grab_extension(); + } else if (device_selector->currentIndex() == VIDEO4LINUX) { // TODO: when recording audio only, allow configuration? if (!rec_video->isChecked()) extension = "wav"; @@ -590,9 +597,12 @@ void RecMonitor::slotRecord() QString args; QString playlist; QString v4lparameters; + QStringList grabParameters; MltVideoProfile profile; bool showPreview; bool isXml; + QString captureSize; + QRect screenSize = QApplication::desktop()->screenGeometry(); QString capturename = KdenliveSettings::dvgrabfilename(); if (capturename.isEmpty()) capturename = "capture"; @@ -686,24 +696,28 @@ void RecMonitor::slotRecord() break; case SCREENGRAB: - switch (KdenliveSettings::rmd_capture_type()) { - case 0: - // Full screen capture, nothing special to do - break; - default: + m_captureArgs << "-f" << "x11grab"; + if (KdenliveSettings::grab_follow_mouse()) m_captureArgs << "-follow_mouse" << "centered"; + if (!KdenliveSettings::grab_hide_frame()) m_captureArgs << "-show_region" << "1"; + if (KdenliveSettings::grab_capture_type() == 0) { + // Full screen capture + captureSize = ":0.0"; + m_captureArgs << "-s" << QString::number(screenSize.width()) + "x" + QString::number(screenSize.height()); + } else { // Region capture - m_captureArgs << "--width" << QString::number(KdenliveSettings::rmd_width()) << "--height" << QString::number(KdenliveSettings::rmd_height()); - if (!KdenliveSettings::rmd_follow_mouse()) { - m_captureArgs << "-x" << QString::number(KdenliveSettings::rmd_offsetx()) << "-y" << QString::number(KdenliveSettings::rmd_offsety()); - } else { - m_captureArgs << "--follow-mouse"; - if (KdenliveSettings::rmd_hide_frame()) m_captureArgs << "--no-frame"; - } - break; + m_captureArgs << "-s" << QString::number(KdenliveSettings::grab_width()) + "x" + QString::number(KdenliveSettings::grab_height()); + captureSize = ":" + QString::number(KdenliveSettings::grab_offsetx()) + "." + QString::number(KdenliveSettings::grab_offsetx()); } - if (KdenliveSettings::rmd_hide_mouse()) m_captureArgs << "--no-cursor"; + // fps + m_captureArgs << "-r" << QString::number(KdenliveSettings::grab_fps()); + if (KdenliveSettings::grab_hide_mouse()) captureSize.append("+nomouse"); + m_captureArgs << "-i" << captureSize; + grabParameters = KdenliveSettings::grab_parameters().simplified().split(" "); + m_captureArgs << grabParameters; + m_captureArgs << path; + m_isCapturing = true; - if (KdenliveSettings::rmd_capture_audio()) { + /*if (KdenliveSettings::rmd_capture_audio()) { m_captureArgs << "--freq" << KdenliveSettings::rmd_freq(); m_captureArgs << "--channels" << QString::number(KdenliveSettings::rmd_audio_channels()); if (KdenliveSettings::rmd_use_jack()) { @@ -720,15 +734,10 @@ void RecMonitor::slotRecord() if (KdenliveSettings::rmd_alsa_buffer() > 0) m_captureArgs << "--buffer-size" << QString::number(KdenliveSettings::rmd_alsa_buffer()); } - } else m_captureArgs << "--no-sound"; - - if (KdenliveSettings::rmd_fullshots()) m_captureArgs << "--full-shots"; - m_captureArgs << "--v_bitrate" << QString::number(KdenliveSettings::rmd_bitrate()); - m_captureArgs << "--v_quality" << QString::number(KdenliveSettings::rmd_quality()); - m_captureArgs << "--workdir" << KdenliveSettings::currenttmpfolder(); - m_captureArgs << "--fps" << QString::number(KdenliveSettings::rmd_fps()) << "-o" << m_captureFile.path(); - m_captureProcess->start(KdenliveSettings::rmd_path(), m_captureArgs); - kDebug() << "// RecordMyDesktop params: " << m_captureArgs; + } else m_captureArgs << "--no-sound";*/ + + m_captureProcess->start(KdenliveSettings::ffmpegpath(), m_captureArgs); + //kDebug() << "// Screen grab params: " << m_captureArgs; break; default: break; diff --git a/src/widgets/configcapture_ui.ui b/src/widgets/configcapture_ui.ui index 294454c9..97daa4e5 100644 --- a/src/widgets/configcapture_ui.ui +++ b/src/widgets/configcapture_ui.ui @@ -6,7 +6,7 @@ 0 0 - 405 + 413 492 @@ -63,7 +63,7 @@ - 1 + 0 @@ -427,171 +427,42 @@ Screen Grab - - - - QFrame::StyledPanel - - - QFrame::Raised - + + - + ... - - + + - Capture audio + Frame rate - - - - QFrame::StyledPanel - - - QFrame::Raised + + + + 1.000000000000000 - - - - - - - Audio channels - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Audio frequency - - - - - - - - 48000 - - - - - 41000 - - - - - 32000 - - - - - 22500 - - - - - 11250 - - - - - - - - - - ALSA - - - true - - - - - - - - 0 - 0 - - - - - - - - Buffer - - - - - - - 999 - - - - - - - Jack - - - - - - - Ports: - - - - - - - - 0 - 0 - - - - - - - - Buffer - - - - - - - - - + + + + Qt::Vertical + + + + 383 + 160 + + + + + + Full screen capture @@ -604,7 +475,7 @@ - + QFrame::StyledPanel @@ -616,26 +487,19 @@ - + Follow mouse - + Hide frame - - - - Hide cursor - - - @@ -659,7 +523,7 @@ - + 0 @@ -675,7 +539,7 @@ - + 0 @@ -698,7 +562,7 @@ - + 1 @@ -711,7 +575,7 @@ - + 1 @@ -726,87 +590,66 @@ - - - - Frame rate + + + + true - - - - 1.000000000000000 + + + + + 0 + 0 + - - - - Qt::Horizontal - - - - 237 - 20 - - - - - - + + - Bit rate - - - - - - - 45000 - - - 2000000 + ... - - - - - - Quality + + true - - - - 0 - - - 63 + + + + + 0 + 0 + - - - - - Full shots + Encoding profile - - + + - Qt::Vertical + Qt::Horizontal - 383 - 160 + 237 + 20 + + + + Hide cursor + + + @@ -934,11 +777,6 @@ QSpinBox
knuminput.h
- - KIntNumInput - QWidget -
knuminput.h
-
kcfg_defaultcapture @@ -946,20 +784,13 @@ kcfg_firewireformat kcfg_firewireautosplit kcfg_firewiretimestamp - kcfg_rmd_capture_audio - radioButton_2 - kcfg_rmd_alsa_device - kcfg_rmd_alsa_buffer - kcfg_rmd_use_jack - kcfg_rmd_jackports - kcfg_rmd_capture_type - kcfg_rmd_follow_mouse - kcfg_rmd_hide_frame - kcfg_rmd_offsetx - kcfg_rmd_offsety - kcfg_rmd_width - kcfg_rmd_height - kcfg_rmd_fullshots + kcfg_grab_capture_type + kcfg_grab_follow_mouse + kcfg_grab_hide_frame + kcfg_grab_offsetx + kcfg_grab_offsety + kcfg_grab_width + kcfg_grab_height diff --git a/src/wizard.cpp b/src/wizard.cpp index 218cbace..410101b6 100644 --- a/src/wizard.cpp +++ b/src/wizard.cpp @@ -497,7 +497,7 @@ void Wizard::slotCheckPrograms() m_check.programList->setIconSize(QSize(24, 24)); QTreeWidgetItem *item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("FFmpeg & ffplay")); - item->setData(1, Qt::UserRole, i18n("Required for webcam capture")); + item->setData(1, Qt::UserRole, i18n("Required for proxy clips, transcoding and screen capture")); item->setSizeHint(0, itemSize); QString exepath = KStandardDirs::findExe("ffmpeg"); QString playpath = KStandardDirs::findExe("ffplay"); @@ -516,12 +516,6 @@ void Wizard::slotCheckPrograms() if (!playpath.isEmpty()) KdenliveSettings::setFfplaypath(playpath); #ifndef Q_WS_MAC - item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("recordmydesktop")); - item->setData(1, Qt::UserRole, i18n("Required for screen capture")); - item->setSizeHint(0, itemSize); - if (KStandardDirs::findExe("recordmydesktop").isEmpty()) item->setIcon(0, m_badIcon); - else item->setIcon(0, m_okIcon); - item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("dvgrab")); item->setData(1, Qt::UserRole, i18n("Required for firewire capture")); item->setSizeHint(0, itemSize); -- 2.39.2