[PR #4775] [MERGED] Refactor localWhisper to use custom FFMPEGWrapper class #4765

Closed
opened 2026-02-22 18:36:29 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/4775
Author: @shatfield4
Created: 12/12/2025
Status: Merged
Merged: 12/18/2025
Merged by: @timothycarambat

Base: masterHead: 4774-feat-refactor-collector-to-remove-fluent-ffmpeg-package


📝 Commits (10+)

  • 3234632 refactor localWhisper to use new custom FFMPEGWrapper class
  • 0a44a6b stub tests in github actions
  • 5fa3f3a add back wavefile conversion to 16khz 32f to fix docker builds
  • bfa344d Merge branch 'master' into 4774-feat-refactor-collector-to-remove-fluent-ffmpeg-package
  • 49d396f use afterEach for cleanup in ffmpeg tests
  • b599462 remove unused FFMPEG_PATH env check
  • 9dbfc36 use spawnSync for ffmpeg to capture and log output
  • 67bc3ee lint
  • 40acea5 revert removal of try/catch around validateAudioFile for more helpful error msgs
  • 72afacd use readFileSync instead of createReadStream for less overhead

📊 Changes

6 files changed (+305 additions, -93 deletions)

View changed files

📝 .github/workflows/dev-build.yaml (+1 -1)
collector/__tests__/utils/WhisperProviders/ffmpeg/index.test.js (+76 -0)
📝 collector/package.json (+1 -1)
collector/utils/WhisperProviders/ffmpeg/index.js (+122 -0)
📝 collector/utils/WhisperProviders/localWhisper.js (+13 -41)
📝 collector/yarn.lock (+92 -50)

📄 Description

Pull Request Type

  • feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 🔨 chore
  • 📝 docs

Relevant Issues

resolves #4774

What is in this change?

  • Adds new FFMPEGWrapper class in order to remove deprecated fluent-ffmpeg package
  • FFMPEGWrapper class allows for simpler processing of audio files since ffmpeg can convert from any audio file type to WAV @ 16k hz, mono, 32bit float in a single CLI command
  • Remove check for if .wav file in localWhisper class
  • Add tests for FFMPEGWrapper class (disabled in github actions)
  • Remove waveFile package from doing any resampling since this is done in the single conversion CLI command from ffmpeg

Additional Information

  • NOTE: could not remove resampling done by the wavefile library since this breaks the docker build. The same ffmpeg CLI command does not produce consistent outputs so we keep the wavefile resampling to ensure consistency across different environments.

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated
  • I have tested my code functionality
  • Docker build succeeds locally

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Mintplex-Labs/anything-llm/pull/4775 **Author:** [@shatfield4](https://github.com/shatfield4) **Created:** 12/12/2025 **Status:** ✅ Merged **Merged:** 12/18/2025 **Merged by:** [@timothycarambat](https://github.com/timothycarambat) **Base:** `master` ← **Head:** `4774-feat-refactor-collector-to-remove-fluent-ffmpeg-package` --- ### 📝 Commits (10+) - [`3234632`](https://github.com/Mintplex-Labs/anything-llm/commit/323463297eadbfb321119cc2b06322602feef690) refactor localWhisper to use new custom FFMPEGWrapper class - [`0a44a6b`](https://github.com/Mintplex-Labs/anything-llm/commit/0a44a6b928685eeea88cff06deec5d2cd7c1122d) stub tests in github actions - [`5fa3f3a`](https://github.com/Mintplex-Labs/anything-llm/commit/5fa3f3acd81ccfcaae25aa0ddb18e17af88b90dc) add back wavefile conversion to 16khz 32f to fix docker builds - [`bfa344d`](https://github.com/Mintplex-Labs/anything-llm/commit/bfa344ddfb9904cad631a0c1807c9ea64e0e0fe0) Merge branch 'master' into 4774-feat-refactor-collector-to-remove-fluent-ffmpeg-package - [`49d396f`](https://github.com/Mintplex-Labs/anything-llm/commit/49d396f7101a03ca0fcc59e3abf22424b962ff23) use afterEach for cleanup in ffmpeg tests - [`b599462`](https://github.com/Mintplex-Labs/anything-llm/commit/b5994627485feb2b87126aab49ce6d86a475af65) remove unused FFMPEG_PATH env check - [`9dbfc36`](https://github.com/Mintplex-Labs/anything-llm/commit/9dbfc3609810f1a7ada6759017488037a3bde990) use spawnSync for ffmpeg to capture and log output - [`67bc3ee`](https://github.com/Mintplex-Labs/anything-llm/commit/67bc3eeaf876646caf292382998134619dc32cc1) lint - [`40acea5`](https://github.com/Mintplex-Labs/anything-llm/commit/40acea51c5fbf76c1cdc169bd2922850f8b67520) revert removal of try/catch around validateAudioFile for more helpful error msgs - [`72afacd`](https://github.com/Mintplex-Labs/anything-llm/commit/72afacd936bb04bdf1cdee266b1e539f44f1600e) use readFileSync instead of createReadStream for less overhead ### 📊 Changes **6 files changed** (+305 additions, -93 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/dev-build.yaml` (+1 -1) ➕ `collector/__tests__/utils/WhisperProviders/ffmpeg/index.test.js` (+76 -0) 📝 `collector/package.json` (+1 -1) ➕ `collector/utils/WhisperProviders/ffmpeg/index.js` (+122 -0) 📝 `collector/utils/WhisperProviders/localWhisper.js` (+13 -41) 📝 `collector/yarn.lock` (+92 -50) </details> ### 📄 Description ### Pull Request Type <!-- For change type, change [ ] to [x]. --> - [ ] ✨ feat - [ ] 🐛 fix - [x] ♻️ refactor - [ ] 💄 style - [ ] 🔨 chore - [ ] 📝 docs ### Relevant Issues <!-- Use "resolves #xxx" to auto resolve on merge. Otherwise, please use "connect #xxx" --> resolves #4774 ### What is in this change? <!-- Describe the changes in this PR that are impactful to the repo. --> - Adds new FFMPEGWrapper class in order to remove deprecated `fluent-ffmpeg` package - FFMPEGWrapper class allows for simpler processing of audio files since ffmpeg can convert from any audio file type to WAV @ 16k hz, mono, 32bit float in a single CLI command - Remove check for if `.wav` file in localWhisper class - Add tests for FFMPEGWrapper class (disabled in github actions) - Remove waveFile package from doing any resampling since this is done in the single conversion CLI command from ffmpeg ### Additional Information <!-- Add any other context about the Pull Request here that was not captured above. --> - NOTE: could not remove resampling done by the `wavefile` library since this breaks the docker build. The same ffmpeg CLI command does not produce consistent outputs so we keep the `wavefile` resampling to ensure consistency across different environments. ### Developer Validations <!-- All of the applicable items should be checked. --> - [x] I ran `yarn lint` from the root of the repo & committed changes - [x] Relevant documentation has been updated - [x] I have tested my code functionality - [x] Docker build succeeds locally --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-22 18:36:29 -05:00
yindo closed this issue 2026-02-22 18:36:29 -05:00
yindo changed title from [PR #4775] Refactor localWhisper to use custom FFMPEGWrapper class to [PR #4775] [MERGED] Refactor localWhisper to use custom FFMPEGWrapper class 2026-06-05 15:20:15 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#4765