Skip to content

Fixed VAD to work when using whisper_full_with_state - #3423

Closed
mdestagnol wants to merge 2 commits into
ggml-org:masterfrom
mdestagnol:vad-with-state-fix
Closed

mdestagnol wants to merge 2 commits into
ggml-org:masterfrom
mdestagnol:vad-with-state-fix

Conversation

@mdestagnol

@mdestagnol mdestagnol commented Sep 17, 2025 •

Copy link
Copy Markdown
Contributor

Currently whisper_full_with_state doesn't work with VAD.

The main inference method is whisper_full_with_state. This method takes a whisper_context and a whisper_state. On top of this method are built 2 convenience methods, whisper_full and whisper_full_parallel.

The VAD logic is currently only implemented in those convenience methods, but not in whisper_full_with_state itself. This is an issue whenever we need to deal with more than one state (when processing multiple real time streams for example).

This pull request moves the logic into whisper_full_with_state and fix a few incorrect calls to ctx->state instead of state directly.

Comment thread src/whisper.cpp Resolved
@danbev

danbev commented Sep 21, 2025

Copy link
Copy Markdown
Member

@mdestagnol Thanks for the pull request.

I've been thinking about this and if I recall correctly, the original pr for VAD actually did something like this. I recall getting feedback about the state should be passed in and not be updated inside of this function (I've not been able to find the comment though I'm afraid).

So I think exposing whisper_vad might be a better option here.

@mdestagnol

Copy link
Copy Markdown
Contributor Author

@mdestagnol Thanks for the pull request.

I've been thinking about this and if I recall correctly, the original pr for VAD actually did something like this. I recall getting feedback about the state should be passed in and not be updated inside of this function (I've not been able to find the comment though I'm afraid).

So I think exposing whisper_vad might be a better option here.

Isn't state's purpose to persist the context of whisper_full? State is how the whisper_full_with_state method maintains its own context between different runs. It is actively modified by whisper_full_with_state at each run (even outside of VAD). What do you think?

@tazz4843

Copy link
Copy Markdown
Contributor

Whatever route is taken, this should be documented anyways since it was extremely confusing wondering why VAD wasn't working despite having the switch on.

@danbev

danbev commented Sep 27, 2025

Copy link
Copy Markdown
Member

What do you think?

Sorry, I make a mistake (recalled incorrectly) about the reason for moving the VAD processing out of whisper_full_with_state. Looking at it closer I found this was moved in 7497754 and related to when parallel processing in use (-p/--processors). We would have to take the parallel processing into account before moving this back into whisper_full_with_state or that parallel processing will not work correctly.

rmorse added a commit to operator-kit/whisper-cpp-plus-rs that referenced this pull request Sep 24, 2026
whisper.cpp's built-in whisper_full VAD does not run for whisper_full_with_state, which the crate uses for all transcription (ggml-org/whisper.cpp#3423). Point users at WhisperVadProcessor, EnhancedWhisperVadProcessor and WhisperStreamPcm::with_vad instead.
rmorse added a commit to operator-kit/whisper-cpp-plus-rs that referenced this pull request Sep 24, 2026
* chore: update whisper.cpp pin to 1.9.4-dev (stream-pcm de8fb5fd)

Moves the pinned rmorse/whisper.cpp stream-pcm fork from ddfe1196
(v1.8.6) to de8fb5fd (tag v1.9.4-dev-stream-pcm), based on upstream
master after v1.9.3. whisper.h changes in this range are additive only,
so no binding or API changes are needed. Parakeet and the new VAD
timestamp/segment accessors are left for a follow-up feature branch.

Picks up the upstream whisper_full_parallel timestamp overflow fix
(ggml-org/whisper.cpp#4044).

* docs: correct changelog for whisper.cpp 1.9 pin

Drop the whisper_full_parallel fix entry: WhisperState::full_parallel reads results from its own state while upstream writes them to the context's default state, so the upstream fix never reached crate users (to be fixed separately). Document user-visible upstream behaviour changes in the pinned range and why the new VAD accessors are not exposed.

* docs: recommend the crate's VAD over whisper.cpp's built-in VAD

whisper.cpp's built-in whisper_full VAD does not run for whisper_full_with_state, which the crate uses for all transcription (ggml-org/whisper.cpp#3423). Point users at WhisperVadProcessor, EnhancedWhisperVadProcessor and WhisperStreamPcm::with_vad instead.
@mdestagnol mdestagnol closed this Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants