mirror of
https://github.com/bybrooklyn/alchemist.git
synced 2026-04-18 09:53:33 -04:00
Fix VideoToolbox fallback and encode error reporting
This commit is contained in:
@@ -20,6 +20,8 @@ pub fn append_args(
|
||||
"0".to_string(),
|
||||
"-q:v".to_string(),
|
||||
cq.to_string(),
|
||||
"-allow_sw".to_string(),
|
||||
"1".to_string(),
|
||||
]);
|
||||
}
|
||||
Encoder::HevcVideotoolbox => {
|
||||
@@ -32,6 +34,8 @@ pub fn append_args(
|
||||
cq.to_string(),
|
||||
"-tag:v".to_string(),
|
||||
"hvc1".to_string(),
|
||||
"-allow_sw".to_string(),
|
||||
"1".to_string(),
|
||||
]);
|
||||
}
|
||||
Encoder::H264Videotoolbox => {
|
||||
@@ -42,6 +46,8 @@ pub fn append_args(
|
||||
"0".to_string(),
|
||||
"-q:v".to_string(),
|
||||
cq.to_string(),
|
||||
"-allow_sw".to_string(),
|
||||
"1".to_string(),
|
||||
]);
|
||||
}
|
||||
_ => {}
|
||||
|
||||
@@ -993,7 +993,9 @@ impl Pipeline {
|
||||
.update_job_state(job.id, crate::db::JobState::Cancelled)
|
||||
.await;
|
||||
} else {
|
||||
tracing::error!("Job {}: Transcode failed: {}", job.id, e);
|
||||
let msg = format!("Transcode failed: {e}");
|
||||
tracing::error!("Job {}: {}", job.id, msg);
|
||||
let _ = self.db.add_log("error", Some(job.id), &msg).await;
|
||||
let _ = self
|
||||
.update_job_state(job.id, crate::db::JobState::Failed)
|
||||
.await;
|
||||
|
||||
@@ -1048,6 +1048,12 @@ fn plan_filters(
|
||||
filters.push(FilterStep::HwUpload);
|
||||
}
|
||||
|
||||
if encoder.backend() == crate::media::pipeline::EncoderBackend::Videotoolbox {
|
||||
filters.push(FilterStep::Format {
|
||||
pixel_format: "yuv420p".to_string(),
|
||||
});
|
||||
}
|
||||
|
||||
filters
|
||||
}
|
||||
|
||||
|
||||
@@ -234,6 +234,27 @@ function explainFailureSummary(summary: string): string {
|
||||
return "Encoding produced an empty output file. This usually means FFmpeg crashed silently. Check the logs below for FFmpeg output.";
|
||||
}
|
||||
|
||||
if (
|
||||
normalized.includes("videotoolbox") ||
|
||||
normalized.includes("vt_compression") ||
|
||||
normalized.includes("err=-12902") ||
|
||||
normalized.includes("mediaserverd") ||
|
||||
normalized.includes("no capable devices")
|
||||
) {
|
||||
return "The VideoToolbox hardware encoder failed. This can happen when the GPU is busy, the file uses an unsupported pixel format, or macOS Media Services are unavailable. Retry the job — if it keeps failing, CPU fallback is available in Settings → Hardware.";
|
||||
}
|
||||
|
||||
if (
|
||||
normalized.includes("encoder fallback") ||
|
||||
normalized.includes("fallback detected")
|
||||
) {
|
||||
return "The hardware encoder was unavailable and fell back to software encoding, which was not allowed by your settings. Enable CPU fallback in Settings → Hardware, or retry when the GPU is less busy.";
|
||||
}
|
||||
|
||||
if (normalized.includes("ffmpeg failed")) {
|
||||
return "FFmpeg failed during encoding. Check the logs below for the specific error. Common causes: unsupported pixel format, codec not available, or corrupt source file.";
|
||||
}
|
||||
|
||||
return summary;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user