- case VIDEO4LINUX:
- 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);
+ case Video4Linux:
+ if (rec_video->isChecked()) slotActivateMonitor();
+ path = KStandardDirs::locateLocal("appdata", "profiles/video4linux");
+ profile = ProfilesDialog::getVideoProfile(path);
+ //m_videoBox->setRatio((double) profile.display_aspect_num / profile.display_aspect_den);
+ buildMltDevice(path);
+ playlist = getV4lXmlPlaylist(profile, &isXml);
+
+ v4lparameters = KdenliveSettings::v4l_parameters();
+
+ // TODO: when recording audio only, allow param configuration?
+ if (!rec_video->isChecked()) v4lparameters.clear();
+
+ // Add alsa audio capture
+ if (!rec_audio->isChecked()) {
+ // if we do not want audio, make sure that we don't have audio encoding parameters
+ // this is required otherwise the MLT avformat consumer will not close properly
+ if (v4lparameters.contains("acodec")) {
+ QString endParam = v4lparameters.section("acodec", 1);
+ int vcodec = endParam.indexOf(" vcodec");
+ int format = endParam.indexOf(" f=");
+ int cutPosition = -1;
+ if (vcodec > -1) {
+ if (format > -1) {
+ cutPosition = qMin(vcodec, format);
+ }
+ else cutPosition = vcodec;
+ }
+ else if (format > -1) {
+ cutPosition = format;
+ }
+ else {
+ // nothing interesting in end params
+ endParam.clear();
+ }
+ if (cutPosition > -1) {
+ endParam.remove(0, cutPosition);
+ }
+ v4lparameters = QString(v4lparameters.section("acodec", 0, 0) + "an=1 " + endParam).simplified();
+ }
+ }
+
+ showPreview = m_previewSettings->isChecked();
+ if (!rec_video->isChecked()) showPreview = false;
+
+ if (m_captureDevice->slotStartCapture(v4lparameters, m_captureFile.path(), playlist, showPreview, isXml)) {
+ videoBox->setHidden(false);
+ m_isCapturing = true;
+ m_recAction->setEnabled(false);
+ m_stopAction->setEnabled(true);
+ m_previewSettings->setEnabled(false);
+ control_frame->setEnabled(false);
+ }
+ else {
+ video_frame->setText(i18n("Failed to start Video4Linux,\ncheck your parameters..."));
+ videoBox->setHidden(true);
+ m_recAction->blockSignals(true);
+ m_recAction->setChecked(false);
+ m_recAction->blockSignals(false);
+ m_isCapturing = false;
+ }