PR #22450 opened by WyattBlue URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22450 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22450.patch
>From 141fa7403308e817cb702ea9def2d93795d42e54 Mon Sep 17 00:00:00 2001 From: WyattBlue <[email protected]> Date: Mon, 9 Mar 2026 00:23:36 -0400 Subject: [PATCH] avfilter/af_whisper: Add translate parameter --- doc/filters.texi | 4 ++++ libavfilter/af_whisper.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/doc/filters.texi b/doc/filters.texi index 5d222c6b96..f0be01e3f7 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -7743,6 +7743,10 @@ The file path of the downloaded whisper.cpp model (mandatory). The language to use for transcription ('auto' for auto-detect). Default value: @code{"auto"} +@item translate +If enabled, translate the transcription from the source language to English. +Default value: @code{"false"} + @item queue The maximum size that will be queued into the filter before processing the audio with whisper. Using a small value the audio stream will be processed more often, diff --git a/libavfilter/af_whisper.c b/libavfilter/af_whisper.c index 299a8bca7a..56324db603 100644 --- a/libavfilter/af_whisper.c +++ b/libavfilter/af_whisper.c @@ -42,6 +42,7 @@ typedef struct WhisperContext { const AVClass *class; char *model_path; char *language; + bool translate; bool use_gpu; int gpu_device; char *vad_model_path; @@ -200,6 +201,7 @@ static void run_transcription(AVFilterContext *ctx, AVFrame *frame, int samples) struct whisper_full_params params = whisper_full_default_params(WHISPER_SAMPLING_GREEDY); params.language = wctx->language; + params.translate = wctx->translate; params.n_threads = ff_filter_get_nb_threads(ctx); params.print_special = 0; params.print_progress = 0; @@ -443,6 +445,7 @@ static int query_formats(const AVFilterContext *ctx, static const AVOption whisper_options[] = { { "model", "Path to the whisper.cpp model file", OFFSET(model_path), AV_OPT_TYPE_STRING,.flags = FLAGS }, { "language", "Language for transcription ('auto' for auto-detect)", OFFSET(language), AV_OPT_TYPE_STRING, {.str = "auto"}, .flags = FLAGS }, + { "translate", "Translate from source language to English", OFFSET(translate), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, .flags = FLAGS }, { "queue", "Audio queue size", OFFSET(queue), AV_OPT_TYPE_DURATION, {.i64 = 3000000}, 20000, HOURS, .flags = FLAGS }, { "use_gpu", "Use GPU for processing", OFFSET(use_gpu), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, .flags = FLAGS }, { "gpu_device", "GPU device to use", OFFSET(gpu_device), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, .flags = FLAGS }, -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
