avfilter/af_whisper.c: Set split_on_word

This prevents `max_len` splitting via tokens, which splits words
like "don't" and proper nouns inappropriately.
This commit is contained in:
WyattBlue
2026-03-19 18:01:45 -04:00
committed by Marton Balint
parent 107a309f3c
commit 33f837a9e9
2 changed files with 3 additions and 2 deletions

View File

@@ -7780,8 +7780,8 @@ Default value: @code{"text"}
@item max_len
Maximum segment length in characters. When set to a value greater than 0,
transcription segments will be split to not exceed this length. This is useful
for generating subtitles with shorter lines.
transcription segments will be split by word to not exceed this length. This is
useful for generating subtitles with shorter lines.
Default value: @code{"0"}
@item vad_model

View File

@@ -221,6 +221,7 @@ static void run_transcription(AVFilterContext *ctx, AVFrame *frame, int samples)
params.print_timestamps = 0;
params.max_len = wctx->max_len;
params.token_timestamps = (wctx->max_len > 0);
params.split_on_word = (wctx->max_len > 0);
if (whisper_full(wctx->ctx_wsp, params, wctx->audio_buffer, samples) != 0) {
av_log(ctx, AV_LOG_ERROR, "Failed to process audio with whisper.cpp\n");