Commit f864233a authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Check FFmpeg's executable in same folder as MLT first.

Display informative error if a clip job fails because FFmpeg not found
CCBUG: 373889
parent 69220ab2
......@@ -509,9 +509,21 @@ void Wizard::checkMissingCodecs()
void Wizard::slotCheckPrograms()
{
bool allIsOk = true;
QString exepath = QStandardPaths::findExecutable(QStringLiteral("ffmpeg%1").arg(FFMPEG_SUFFIX));
QString playpath = QStandardPaths::findExecutable(QStringLiteral("ffplay%1").arg(FFMPEG_SUFFIX));
QString probepath = QStandardPaths::findExecutable(QStringLiteral("ffprobe%1").arg(FFMPEG_SUFFIX));
// Check first in same folder as melt exec
const QStringList mltpath = QStringList() << QFileInfo(KdenliveSettings::rendererpath()).canonicalPath();
QString exepath = QStandardPaths::findExecutable(QStringLiteral("ffmpeg%1").arg(FFMPEG_SUFFIX), mltpath);
if (exepath.isEmpty()) {
exepath = QStandardPaths::findExecutable(QStringLiteral("ffmpeg%1").arg(FFMPEG_SUFFIX));
}
QString playpath = QStandardPaths::findExecutable(QStringLiteral("ffplay%1").arg(FFMPEG_SUFFIX), mltpath);
if (playpath.isEmpty()) {
playpath = QStandardPaths::findExecutable(QStringLiteral("ffplay%1").arg(FFMPEG_SUFFIX));
}
QString probepath = QStandardPaths::findExecutable(QStringLiteral("ffprobe%1").arg(FFMPEG_SUFFIX), mltpath);
if (probepath.isEmpty()) {
probepath = QStandardPaths::findExecutable(QStringLiteral("ffprobe%1").arg(FFMPEG_SUFFIX));
}
if (exepath.isEmpty()) {
// Check for libav version
exepath = QStandardPaths::findExecutable(QStringLiteral("avconv"));
......
......@@ -96,7 +96,7 @@ ClipTranscode::ClipTranscode(const QStringList &urls, const QString &params, con
m_transcodeProcess.setProcessChannelMode(QProcess::MergedChannels);
connect(&m_transcodeProcess, &QProcess::readyReadStandardOutput, this, &ClipTranscode::slotShowTranscodeInfo);
connect(&m_transcodeProcess, static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), this, &ClipTranscode::slotTranscodeFinished);
ffmpeg_params->setMaximumHeight(QFontMetrics(font()).lineSpacing() * 5);
adjustSize();
......@@ -116,6 +116,12 @@ void ClipTranscode::slotStartTransCode()
if (m_transcodeProcess.state() != QProcess::NotRunning) {
return;
}
if (KdenliveSettings::ffmpegpath().isEmpty()) {
//FFmpeg not detected, cannot process the Job
log_text->setPlainText(i18n("FFmpeg not found, please set path in Kdenlive's settings Environment"));
slotTranscodeFinished(1, QProcess::CrashExit);
return;
}
m_duration = 0;
m_destination.clear();
m_infoMessage->animatedHide();
......@@ -246,7 +252,7 @@ void ClipTranscode::slotTranscodeFinished(int exitCode, QProcess::ExitStatus exi
log_text->setVisible(true);
}
m_transcodeProcess.close();
//Refill url list in case user wants to transcode to another format
if (urls_list->count() > 0) {
m_urls.clear();
......
......@@ -70,6 +70,12 @@ void CutClipJob::startJob()
{
// Special case: playlist clips (.mlt or .kdenlive project files)
if (clipType == AV || clipType == Audio || clipType == Video) {
if (KdenliveSettings::ffmpegpath().isEmpty()) {
//FFmpeg not detected, cannot process the Job
m_errorMessage = i18n("Cannot process job. FFmpeg not found, please set path in Kdenlive's settings Environment");
setStatus(JobCrashed);
return;
}
QStringList parameters;
QString exec;
if (jobType == AbstractClipJob::ANALYSECLIPJOB) {
......
......@@ -152,6 +152,12 @@ void ProxyJob::startJob()
return;
} else {
m_isFfmpegJob = true;
if (KdenliveSettings::ffmpegpath().isEmpty()) {
//FFmpeg not detected, cannot process the Job
m_errorMessage.prepend(i18n("Failed to create proxy. FFmpeg not found, please set path in Kdenlive's settings Environment"));
setStatus(JobCrashed);
return;
}
QStringList parameters;
if (m_proxyParams.contains(QStringLiteral("-noautorotate"))) {
// The noautorotate flag must be passed before input source
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment