whisperfile server: convert files without ffmpeg#568
Merged
jart merged 2 commits intomozilla-ai:mainfrom Sep 28, 2024
Merged
Conversation
jart
approved these changes
Sep 28, 2024
Collaborator
jart
left a comment
There was a problem hiding this comment.
Thanks for doing this. Several people have requested this feature. read_wav() isn't ready to be used in this manner, but I can make it ready after merging this. I anticipate that it won't work if concurrent requests are sent to the server until I get rid of the global variable in common.cpp. This will obviously be fixed before the next release. So please don't publish any whisperfiles until we've had a chance to fix that.
jart
added a commit
that referenced
this pull request
Sep 28, 2024
We now have a new function slurp_audio_file() which replaces read_wav(). This function has simpler code, and allows us to avoid a temporary file. See #568
jart
reviewed
Sep 28, 2024
| } | ||
| } | ||
| // remove temp file | ||
| std::remove(temp_filename.c_str()); |
Collaborator
There was a problem hiding this comment.
The function you want here is unlink().
jart
added a commit
that referenced
this pull request
Sep 28, 2024
We now have a new function slurp_audio_file() which replaces read_wav(). This function has simpler code, and allows us to avoid a temporary file. See #568
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR allows the
whisperfileserver to convert.wav,.mp3,.flac, and.ogginto the appropriate .wav file for whisper (16-bit 16000Hz) without any dependency on ffmpeg.The ffmpeg support still remains under the
--convertflag.The main change here is giving
read_wava file instead of a buffer. Before it was given a buffer when run through the server, and a filename when run through the cli. Now it is unified to always use a filename.In addition
is_wav_bufferwas removed, as the codepath is dead with the changes to use a filename throughout. This function was always expecting a buffer, but was receiving both filenames and buffers.