Skip to content

Conversation

boolemancer
Copy link
Contributor

As written, the sample_to_timestamp function will overflow around 22 and a half minutes and it will start returning negative timestamps.

22m23s = 1343s
1343s * 16000 samples/s = 21488000 samples
Passing 21488000 to sample_to_timestamp would result in 100*21488000 (2148800000), which overflows to -2146167296 before that result is divided again by the sample rate.

By doing the multiplication with 64 bit precision, you avoid the overflow and you can now process audio clips longer than 22 minutes.

Co-authored-by: Georgi Gerganov <[email protected]>
@ggerganov ggerganov merged commit 08dc705 into ggml-org:master Jan 8, 2023
rock3125 pushed a commit to rock3125/whisper.cpp that referenced this pull request Feb 21, 2023
…o avoid overflow (ggml-org#388)

* Do calculation with 64 bit precision to avoid overflow

* Update whisper.cpp

Co-authored-by: Georgi Gerganov <[email protected]>

Co-authored-by: Georgi Gerganov <[email protected]>
anandijain pushed a commit to anandijain/whisper.cpp that referenced this pull request Apr 28, 2023
…o avoid overflow (ggml-org#388)

* Do calculation with 64 bit precision to avoid overflow

* Update whisper.cpp

Co-authored-by: Georgi Gerganov <[email protected]>

Co-authored-by: Georgi Gerganov <[email protected]>
jacobwu-b pushed a commit to jacobwu-b/Transcriptify-by-whisper.cpp that referenced this pull request Oct 24, 2023
…o avoid overflow (ggml-org#388)

* Do calculation with 64 bit precision to avoid overflow

* Update whisper.cpp

Co-authored-by: Georgi Gerganov <[email protected]>

Co-authored-by: Georgi Gerganov <[email protected]>
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.

2 participants