Fix proxy decoding path and add proxy generation diagnostics
- RenderWorkerPool::DecodeInputFrame now uses the proxy filename/decoder/stream from FootageJob when a proxy is attached, so generated proxies are actually used during render. - Add qDebug/qWarning logging to TimelineWidget::GenerateProxiesForSelectedClips and ProxyTask::Run to diagnose why Generate Proxy appears to do nothing.
This commit is contained in:
@@ -145,6 +145,17 @@ FramePtr DecodeInputFrame(DecoderCache *decoder_cache,
|
|||||||
{
|
{
|
||||||
VideoParams stream_data = input.job.video_params();
|
VideoParams stream_data = input.job.video_params();
|
||||||
QString filename = input.job.filename();
|
QString filename = input.job.filename();
|
||||||
|
QString decoder_id = input.job.decoder();
|
||||||
|
int stream_index = stream_data.stream_index();
|
||||||
|
|
||||||
|
// Use generated proxy if one is attached to the job. The Footage node only
|
||||||
|
// attaches a proxy when it is enabled, ready, and matches this stream.
|
||||||
|
if (input.job.has_proxy()) {
|
||||||
|
filename = input.job.proxy_filename();
|
||||||
|
decoder_id = input.job.proxy_decoder();
|
||||||
|
stream_index = input.job.proxy_stream_index();
|
||||||
|
}
|
||||||
|
|
||||||
DecoderPtr decoder;
|
DecoderPtr decoder;
|
||||||
|
|
||||||
switch (stream_data.video_type()) {
|
switch (stream_data.video_type()) {
|
||||||
@@ -152,17 +163,17 @@ FramePtr DecodeInputFrame(DecoderCache *decoder_cache,
|
|||||||
case VideoParams::kVideoTypeStill:
|
case VideoParams::kVideoTypeStill:
|
||||||
decoder = ResolveDecoderFromCache(
|
decoder = ResolveDecoderFromCache(
|
||||||
decoder_cache,
|
decoder_cache,
|
||||||
input.job.decoder(),
|
decoder_id,
|
||||||
Decoder::CodecStream(filename, stream_data.stream_index(), nullptr));
|
Decoder::CodecStream(filename, stream_index, nullptr));
|
||||||
break;
|
break;
|
||||||
case VideoParams::kVideoTypeImageSequence: {
|
case VideoParams::kVideoTypeImageSequence: {
|
||||||
const int64_t frame_number =
|
const int64_t frame_number =
|
||||||
stream_data.get_time_in_timebase_units(input.time);
|
stream_data.get_time_in_timebase_units(input.time);
|
||||||
filename = Decoder::TransformImageSequenceFileName(filename, frame_number);
|
filename = Decoder::TransformImageSequenceFileName(filename, frame_number);
|
||||||
decoder = Decoder::CreateFromID(input.job.decoder());
|
decoder = Decoder::CreateFromID(decoder_id);
|
||||||
if (decoder &&
|
if (decoder &&
|
||||||
!decoder->Open(Decoder::CodecStream(filename,
|
!decoder->Open(Decoder::CodecStream(filename,
|
||||||
stream_data.stream_index(),
|
stream_index,
|
||||||
nullptr))) {
|
nullptr))) {
|
||||||
decoder = nullptr;
|
decoder = nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
+33
-19
@@ -1,20 +1,22 @@
|
|||||||
/*
|
/***
|
||||||
* Oak Video Editor - Non-Linear Video Editor
|
|
||||||
* Copyright (C) 2026 Oak Team
|
Oak - Non-Linear Video Editor
|
||||||
*
|
Copyright (C) 2026 Oak Team
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
This program is free software: you can redistribute it and/or modify
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
it under the terms of the GNU General Public License as published by
|
||||||
* (at your option) any later version.
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
*
|
(at your option) any later version.
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
This program is distributed in the hope that it will be useful,
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* GNU General Public License for more details.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
*
|
GNU General Public License for more details.
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
You should have received a copy of the GNU General Public License
|
||||||
*/
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
***/
|
||||||
|
|
||||||
#include "proxy.h"
|
#include "proxy.h"
|
||||||
|
|
||||||
@@ -45,21 +47,27 @@ bool ProxyTask::Run()
|
|||||||
const QString ffmpeg = QStandardPaths::findExecutable(QStringLiteral("ffmpeg"));
|
const QString ffmpeg = QStandardPaths::findExecutable(QStringLiteral("ffmpeg"));
|
||||||
if (ffmpeg.isEmpty()) {
|
if (ffmpeg.isEmpty()) {
|
||||||
SetError(tr("Failed to generate proxy: ffmpeg executable was not found"));
|
SetError(tr("Failed to generate proxy: ffmpeg executable was not found"));
|
||||||
|
qWarning() << "ProxyTask: ffmpeg executable not found";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDir output_dir = QFileInfo(output_filename_).dir();
|
QDir output_dir = QFileInfo(output_filename_).dir();
|
||||||
if (!output_dir.exists() && !output_dir.mkpath(QStringLiteral("."))) {
|
if (!output_dir.exists() && !output_dir.mkpath(QStringLiteral("."))) {
|
||||||
SetError(tr("Failed to create proxy output directory"));
|
SetError(tr("Failed to create proxy output directory"));
|
||||||
|
qWarning() << "ProxyTask: failed to create output directory"
|
||||||
|
<< output_dir.absolutePath();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qDebug() << "ProxyTask: starting ffmpeg proxy generation:"
|
||||||
|
<< source_filename_ << "->" << output_filename_;
|
||||||
|
|
||||||
QFile::remove(output_filename_);
|
QFile::remove(output_filename_);
|
||||||
|
|
||||||
const QString scale_filter = QStringLiteral(
|
const QString scale_filter = QStringLiteral(
|
||||||
"scale=w=%1:h=%2:force_original_aspect_ratio=decrease")
|
"scale=w=%1:h=%2:force_original_aspect_ratio=decrease")
|
||||||
.arg(QString::number(params_.width),
|
.arg(QString::number(params_.width),
|
||||||
QString::number(params_.height));
|
QString::number(params_.height));
|
||||||
|
|
||||||
QStringList args;
|
QStringList args;
|
||||||
args << QStringLiteral("-y")
|
args << QStringLiteral("-y")
|
||||||
@@ -82,6 +90,7 @@ bool ProxyTask::Run()
|
|||||||
|
|
||||||
if (!process.waitForStarted()) {
|
if (!process.waitForStarted()) {
|
||||||
SetError(tr("Failed to start ffmpeg for proxy generation"));
|
SetError(tr("Failed to start ffmpeg for proxy generation"));
|
||||||
|
qWarning() << "ProxyTask: failed to start ffmpeg" << process.errorString();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,14 +108,19 @@ bool ProxyTask::Run()
|
|||||||
const QString output = QString::fromUtf8(process.readAll()).trimmed();
|
const QString output = QString::fromUtf8(process.readAll()).trimmed();
|
||||||
QFile::remove(output_filename_);
|
QFile::remove(output_filename_);
|
||||||
SetError(tr("ffmpeg failed to generate proxy: %1").arg(output));
|
SetError(tr("ffmpeg failed to generate proxy: %1").arg(output));
|
||||||
|
qWarning() << "ProxyTask: ffmpeg failed with exit code" << process.exitCode()
|
||||||
|
<< "output:" << output;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!QFileInfo::exists(output_filename_)) {
|
if (!QFileInfo::exists(output_filename_)) {
|
||||||
SetError(tr("ffmpeg finished but proxy file was not created"));
|
SetError(tr("ffmpeg finished but proxy file was not created"));
|
||||||
|
qWarning() << "ProxyTask: ffmpeg finished but output file missing"
|
||||||
|
<< output_filename_;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qDebug() << "ProxyTask: proxy generation succeeded:" << output_filename_;
|
||||||
emit ProgressChanged(1.0);
|
emit ProgressChanged(1.0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1182,13 +1182,16 @@ void TimelineWidget::SynchronizeSelectedClipsByWaveform()
|
|||||||
void TimelineWidget::GenerateProxiesForSelectedClips()
|
void TimelineWidget::GenerateProxiesForSelectedClips()
|
||||||
{
|
{
|
||||||
if (!ProxyManager::instance() || !sequence()) {
|
if (!ProxyManager::instance() || !sequence()) {
|
||||||
|
qWarning() << "GenerateProxiesForSelectedClips: ProxyManager or sequence unavailable";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QVector<Footage *> footage = GetSelectedProxyFootage(selected_blocks_);
|
const QVector<Footage *> footage = GetSelectedProxyFootage(selected_blocks_);
|
||||||
|
qDebug() << "GenerateProxiesForSelectedClips: starting proxy generation for" << footage.size() << "footage item(s)";
|
||||||
for (Footage *item : footage) {
|
for (Footage *item : footage) {
|
||||||
const VideoParams video = item->GetFirstEnabledVideoStream();
|
const VideoParams video = item->GetFirstEnabledVideoStream();
|
||||||
if (!video.is_valid()) {
|
if (!video.is_valid()) {
|
||||||
|
qWarning() << "GenerateProxiesForSelectedClips: skipping item with no valid video stream" << item->filename();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1197,6 +1200,9 @@ void TimelineWidget::GenerateProxiesForSelectedClips()
|
|||||||
ProxyManager::instance()->GetOrStartProxy(
|
ProxyManager::instance()->GetOrStartProxy(
|
||||||
item->project()->cache_path(), item->filename(),
|
item->project()->cache_path(), item->filename(),
|
||||||
video.stream_index(), params);
|
video.stream_index(), params);
|
||||||
|
qDebug() << "GenerateProxiesForSelectedClips: proxy state=" << ProxyManager::ProxyStateToString(proxy.state)
|
||||||
|
<< "file=" << proxy.filename
|
||||||
|
<< "cache=" << item->project()->cache_path();
|
||||||
item->SetProxy(proxy.filename, proxy.state, video.stream_index(),
|
item->SetProxy(proxy.filename, proxy.state, video.stream_index(),
|
||||||
params.version, true);
|
params.version, true);
|
||||||
item->InvalidateAll(Footage::kFilenameInput);
|
item->InvalidateAll(Footage::kFilenameInput);
|
||||||
|
|||||||
Reference in New Issue
Block a user