From b1fc8122cc756985f9cac20fb930444da1e03e6f Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Thu, 20 May 2010 16:24:16 +0000 Subject: [PATCH] Improve webcam capture parameters svn path=/trunk/kdenlive/; revision=4461 --- src/kdenlivesettings.kcfg | 20 +++ src/kdenlivesettingsdialog.cpp | 5 +- src/recmonitor.cpp | 15 +- src/widgets/configcapture_ui.ui | 306 +++++++++++++++++++------------- 4 files changed, 214 insertions(+), 132 deletions(-) diff --git a/src/kdenlivesettings.kcfg b/src/kdenlivesettings.kcfg index a2a6dcc5..4fdd18a2 100644 --- a/src/kdenlivesettings.kcfg +++ b/src/kdenlivesettings.kcfg @@ -213,6 +213,26 @@ /dev/video0 + + + mpeg4 + + + + + mp2 + + + + + mpegts + + + + + mp4 + + oss diff --git a/src/kdenlivesettingsdialog.cpp b/src/kdenlivesettingsdialog.cpp index 2ed31f0e..f6c14329 100644 --- a/src/kdenlivesettingsdialog.cpp +++ b/src/kdenlivesettingsdialog.cpp @@ -121,6 +121,7 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QWidget * parent) : connect(m_configCapture.kcfg_video4vdevice, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands())); connect(m_configCapture.kcfg_video4adevice, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands())); + connect(m_configCapture.kcfg_video4vcodec, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands())); connect(m_configCapture.kcfg_video4acodec, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands())); connect(m_configCapture.kcfg_video4vformat, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands())); connect(m_configCapture.kcfg_video4aformat, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands())); connect(m_configCapture.kcfg_video4size, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands())); @@ -405,9 +406,9 @@ void KdenliveSettingsDialog::slotUpdateShuttleDevice(int ix) void KdenliveSettingsDialog::rebuildVideo4Commands() { QString captureCommand; - if (!m_configCapture.kcfg_video4adevice->text().isEmpty()) captureCommand = "-f " + m_configCapture.kcfg_video4aformat->text() + " -i " + m_configCapture.kcfg_video4adevice->text(); + if (!m_configCapture.kcfg_video4adevice->text().isEmpty()) captureCommand = "-f " + m_configCapture.kcfg_video4aformat->text() + " -i " + m_configCapture.kcfg_video4adevice->text() + " -acodec " + m_configCapture.kcfg_video4acodec->text(); - captureCommand += " -f " + m_configCapture.kcfg_video4vformat->text() + " -s " + m_configCapture.kcfg_video4size->text() + " -r " + QString::number(m_configCapture.kcfg_video4rate->value()) + " -i " + m_configCapture.kcfg_video4vdevice->text(); + captureCommand += " -f " + m_configCapture.kcfg_video4vformat->text() + " -s " + m_configCapture.kcfg_video4size->text() + " -r " + QString::number(m_configCapture.kcfg_video4rate->value()) + " -i " + m_configCapture.kcfg_video4vdevice->text() + " -vcodec " + m_configCapture.kcfg_video4vcodec->text(); m_configCapture.kcfg_video4capture->setText(captureCommand); } diff --git a/src/recmonitor.cpp b/src/recmonitor.cpp index f94bd83b..6542c5fb 100644 --- a/src/recmonitor.cpp +++ b/src/recmonitor.cpp @@ -132,9 +132,9 @@ RecMonitor::RecMonitor(QString name, QWidget *parent) : if (KdenliveSettings::video4capture().isEmpty()) { QString captureCommand; - if (!KdenliveSettings::video4adevice().isEmpty()) captureCommand = "-f " + KdenliveSettings::video4aformat() + " -i " + KdenliveSettings::video4adevice(); + if (!KdenliveSettings::video4adevice().isEmpty()) captureCommand = "-f " + KdenliveSettings::video4aformat() + " -i " + KdenliveSettings::video4adevice() + " -acodec " + KdenliveSettings::video4acodec(); - captureCommand += " -f " + KdenliveSettings::video4vformat() + " -s " + KdenliveSettings::video4size() + " -r " + QString::number(KdenliveSettings::video4rate()) + " -i " + KdenliveSettings::video4vdevice(); + captureCommand += " -f " + KdenliveSettings::video4vformat() + " -s " + KdenliveSettings::video4size() + " -r " + QString::number(KdenliveSettings::video4rate()) + " -i " + KdenliveSettings::video4vdevice() + " -vcodec " + KdenliveSettings::video4vcodec();; KdenliveSettings::setVideo4capture(captureCommand); } @@ -368,7 +368,7 @@ void RecMonitor::slotStartCapture(bool play) case 3: // HDV CAPTURE m_captureArgs << "--format" << "hdv"; - m_displayArgs << "-f" << "mpegts"; + m_displayArgs << "-f" << KdenliveSettings::video4container(); break; } if (KdenliveSettings::firewireautosplit()) m_captureArgs << "--autosplit"; @@ -391,8 +391,8 @@ void RecMonitor::slotStartCapture(bool play) m_discAction->setEnabled(true); break; case VIDEO4LINUX: - m_captureArgs << KdenliveSettings::video4capture().simplified().split(' ') << KdenliveSettings::video4encoding().simplified().split(' ') << "-f" << "mpegts" << "-vcodec" << "mpeg4" << "-acodec" << "mp2" << "-"; - m_displayArgs << "-f" << "mpegts" << "-x" << QString::number(video_frame->width()) << "-y" << QString::number(video_frame->height()) << "-"; + m_captureArgs << KdenliveSettings::video4capture().simplified().split(' ') << KdenliveSettings::video4encoding().simplified().split(' ') << "-f" << KdenliveSettings::video4container() << "-"; + m_displayArgs << "-f" << KdenliveSettings::video4container() << "-x" << QString::number(video_frame->width()) << "-y" << QString::number(video_frame->height()) << "-"; m_captureProcess->setStandardOutputProcess(m_displayProcess); kDebug() << "Capture: Running ffmpeg " << m_captureArgs.join(" "); m_captureProcess->start("ffmpeg", m_captureArgs); @@ -452,6 +452,7 @@ void RecMonitor::slotRecord() m_recAction->setChecked(true); QString extension = "mp4"; if (device_selector->currentIndex() == SCREENGRAB) extension = "ogv"; //KdenliveSettings::screengrabextension(); + else if (device_selector->currentIndex() == VIDEO4LINUX) extension = KdenliveSettings::video4extension(); QString path = KdenliveSettings::capturefolder() + "/capture0000." + extension; int i = 1; while (QFile::exists(path)) { @@ -469,8 +470,8 @@ void RecMonitor::slotRecord() switch (device_selector->currentIndex()) { case VIDEO4LINUX: - m_captureArgs << KdenliveSettings::video4capture().simplified().split(' ') << KdenliveSettings::video4encoding().simplified().split(' ') << "-vcodec" << "mpeg4" << "-acodec" << "mp2" << "-y" << m_captureFile.path() << "-f" << "mpegts" << "-vcodec" << "mpeg4" << "-acodec" << "mp2" << "-"; - m_displayArgs << "-f" << "mpegts" << "-x" << QString::number(video_frame->width()) << "-y" << QString::number(video_frame->height()) << "-"; + m_captureArgs << KdenliveSettings::video4capture().simplified().split(' ') << KdenliveSettings::video4encoding().simplified().split(' ') << "-y" << m_captureFile.path() << "-f" << KdenliveSettings::video4container() << "-acodec" << KdenliveSettings::video4acodec() << "-vcodec" << KdenliveSettings::video4vcodec() << "-"; + m_displayArgs << "-f" << KdenliveSettings::video4container() << "-x" << QString::number(video_frame->width()) << "-y" << QString::number(video_frame->height()) << "-"; m_captureProcess->setStandardOutputProcess(m_displayProcess); kDebug() << "Capture: Running ffmpeg " << m_captureArgs.join(" "); m_captureProcess->start("ffmpeg", m_captureArgs); diff --git a/src/widgets/configcapture_ui.ui b/src/widgets/configcapture_ui.ui index f41f77c2..fc6b5046 100644 --- a/src/widgets/configcapture_ui.ui +++ b/src/widgets/configcapture_ui.ui @@ -6,11 +6,11 @@ 0 0 - 411 - 485 + 409 + 462 - + @@ -52,7 +52,7 @@ - 2 + 0 @@ -169,68 +169,177 @@ Video4Linux - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 0 - 0 - - - - Format - - - - - - - Video device - - - - - - - /dev/dsp - + + + + + Video + + + + + + Device + + + + + + + + + + + + + + + 0 + 0 + + + + Format + + + + + + + + + + + + + + + 0 + 0 + + + + Image size + + + + + + + + + + + + + + Frame rate + + + + + + + 15 + + + + + + + Codec + + + + + + + - - - - - 0 - 0 - - - - Format + + + + Audio + + + + + Audio device + + + + + + + + + + + + + + + 0 + 0 + + + + Format + + + + + + + + + + + + + + Audio codec + + + + + + + - - - - Audio device + + + + Container + + + + + Format + + + + + + + + + + Extension + + + + + + + - + @@ -243,44 +352,7 @@ - - - - - - - - 0 - 0 - - - - Encoding params - - - - - - - oss - - - - - - - video4linux2 - - - - - - - /dev/video0 - - - - + @@ -290,15 +362,8 @@ - - - - Qt::Horizontal - - - - - + + 0 @@ -306,30 +371,25 @@ - Image size + Encoding params - - - - 320x240 - - + + - - - - Frame rate + + + + Qt::Vertical - - - - - - 15 + + + 20 + 40 + - + -- 2.39.2