mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-08-12 22:16:21 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user