SubtitleEdit/subtitleedit · error · ForcedAlignerException
Could not cut the audio window with ffmpeg.
Error message
Could not cut the audio window with ffmpeg.
What it means
Thrown by FfmpegWindowAudioSource.ExtractWindowAsync when OpenAiSttChunker.ExtractChunkAsync returned false or the target WAV was not created. ffmpeg is the cutting tool, so this means the slice of the source audio could not be produced for the aligner to read.
Source
Thrown at src/ui/Features/Files/ImportPlainText/CrispAsrAlignOnlyRunner.cs:170
public Task<IReadOnlyList<OpenAiSttChunker.SilenceInterval>> DetectSilenceAsync(CancellationToken cancellationToken)
=> OpenAiSttChunker.DetectSilenceIntervalsAsync(_ffmpegPath, _audioFileName, cancellationToken: cancellationToken);
public async Task<string> ExtractWindowAsync(double startSeconds, double durationSeconds, CancellationToken cancellationToken)
{
var target = Path.Combine(
_workFolder,
"se-align-" + _windowIndex.ToString(CultureInfo.InvariantCulture) + ".wav");
_windowIndex++;
_windowFiles.Add(target);
var ok = await OpenAiSttChunker
.ExtractChunkAsync(_ffmpegPath, _audioFileName, target, startSeconds, durationSeconds, cancellationToken)
.ConfigureAwait(false);
if (!ok || !File.Exists(target))
{
throw new ForcedAlignerException("Could not cut the audio window with ffmpeg.");
}
return target;
}
public void Dispose()
{
foreach (var file in _windowFiles)
{
TryDelete(file);
TryDelete(Path.ChangeExtension(file, ".txt"));
TryDelete(Path.ChangeExtension(file, ".aligned.srt"));
}
_windowFiles.Clear();
}
private static void TryDelete(string fileName)View on GitHub (pinned to 17a9f07487)
Solutions
- Verify ffmpeg is installed and _ffmpegPath is correct: run `ffmpeg -version` in the same environment.
- Confirm the source audio file still exists and is readable.
- Ensure the work folder is writable and has free space.
- Validate startSeconds/durationSeconds are within TotalSeconds before slicing.
- Capture ffmpeg's stderr (ExtractChunkAsync logs it) for the exact failure.
Example fix
// guard the slice bounds
var dur = Math.Min(durationSeconds, source.TotalSeconds - startSeconds);
if (dur <= 0) throw new InvalidOperationException("window out of range");
var ok = await OpenAiSttChunker.ExtractChunkAsync(_ffmpegPath, _audioFileName, target, startSeconds, dur, ct); Defensive patterns
Strategy: validation
Validate before calling
if (string.IsNullOrEmpty(_ffmpegPath) || !File.Exists(_ffmpegPath))
throw new ForcedAlignerException("ffmpeg not found at: " + _ffmpegPath);
if (startSeconds < 0 || startSeconds >= source.TotalSeconds)
throw new ForcedAlignerException("window start out of range"); Type guard
static bool FfmpegAvailable(string p) => !string.IsNullOrEmpty(p) && File.Exists(p);
Try / catch
try { return await source.ExtractWindowAsync(start, dur, ct); }
catch (ForcedAlignerException ex) when (ex.Message.Contains("ffmpeg")) {
logger.Error("ffmpeg slice failed; check ffmpeg path/permissions."); throw; } Prevention
- Resolve and verify the ffmpeg path at app startup.
- Confirm the work folder is writable with free disk space.
- Clamp window bounds to TotalSeconds before slicing.
When it happens
Trigger: ExtractChunkAsync(ffmpegPath, audioFileName, target, startSeconds, durationSeconds) returns false, OR returns true but File.Exists(target) is false.
Common situations: ffmpeg not installed or not on PATH; _ffmpegPath points to a wrong binary; source audio deleted or unreadable; disk full in the work folder; startSeconds/durationSeconds out of range (e.g. beyond the stream end); ffmpeg lacks the decoder for the source codec.
Related errors
- The forced aligner ran out of memory on this window. Try a s
- The forced aligner failed (exit code {process.ExitCode}).
- No llama.cpp OCR model found in {LlamaCppServerManager.GetAn
- Tesseract not found on PATH. Install it from https://tessera
- API key invalid (or perhaps billing/API is not enabled)?
AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13).
Data as JSON: /api/errors/5ab44672e78a017e.
Report an issue: GitHub.