From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 4E42F487E7 for ; Fri, 15 Aug 2025 13:05:12 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 1C57F68C432; Fri, 15 Aug 2025 16:05:07 +0300 (EEST) Received: from 1e8b7847f7d1 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 1465C68D106 for ; Fri, 15 Aug 2025 16:05:05 +0300 (EEST) MIME-Version: 1.0 From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] =?utf-8?q?=5BPATCH=5D_avfilter/af=5Fwhisper=3A_fi?= =?utf-8?q?x_broken_output_for_multibyte_character_=28PR_=2320244=29?= X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Message-Id: <20250815130507.1C57F68C432@ffbox0-bg.ffmpeg.org> Date: Fri, 15 Aug 2025 16:05:07 +0300 (EEST) Archived-At: List-Archive: List-Post: PR #20244 opened by Zhao Zhili (quink) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20244 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20244.patch text + 1 can break a multibyte character, e.g., Chinese in UTF-8. There is no space at the beginning in this case. >From 7d007b6b7650baf4eaeb2f6833f1ba1fc40a03c0 Mon Sep 17 00:00:00 2001 From: Zhao Zhili Date: Fri, 15 Aug 2025 20:39:49 +0800 Subject: [PATCH] avfilter/af_whisper: fix broken output for multibyte character text + 1 can break a multibyte character, e.g., Chinese in UTF-8. There is no space at the beginning in this case. --- libavfilter/af_whisper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavfilter/af_whisper.c b/libavfilter/af_whisper.c index 186b624504..bd145d6d1d 100644 --- a/libavfilter/af_whisper.c +++ b/libavfilter/af_whisper.c @@ -215,7 +215,9 @@ static void run_transcription(AVFilterContext *ctx, AVFrame *frame, int samples) for (int i = 0; i < n_segments; ++i) { const char *text = whisper_full_get_segment_text(wctx->ctx_wsp, i); - char *text_cleaned = av_strireplace(text + 1, "[BLANK_AUDIO]", ""); + if (av_isspace(text[0])) + text++; + char *text_cleaned = av_strireplace(text, "[BLANK_AUDIO]", ""); if (av_strnlen(text_cleaned, 1) == 0) { av_freep(&text_cleaned); -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".