- 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(ui.video_frame->width()) << "-y" << QString::number(ui.video_frame->height()) << "-";
- captureProcess->setStandardOutputProcess(displayProcess);
- kDebug() << "Capture: Running ffmpeg " << m_captureArgs.join(" ");
- captureProcess->start("ffmpeg", m_captureArgs);
+ 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);
+
+ v4lparameters = KdenliveSettings::v4l_parameters();
+
+ // Add alsa audio capture
+ if (!KdenliveSettings::v4l_captureaudio()) {
+ // 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();
+ }
+ }
+
+ if (m_captureDevice->slotStartCapture(v4lparameters, m_captureFile.path(), playlist, recording_preview->currentIndex())) {
+ m_videoBox->setHidden(false);
+ m_isCapturing = true;
+ m_recAction->setEnabled(false);
+ m_stopAction->setEnabled(true);
+ recording_preview->setEnabled(false);
+ }
+ else {
+ video_frame->setText(i18n("Failed to start Video4Linux,\ncheck your parameters..."));
+ m_videoBox->setHidden(true);
+ m_isCapturing = false;
+ }