Kokoro-FastAPI icon indicating copy to clipboard operation
Kokoro-FastAPI copied to clipboard

Opus output format issue: the last a few seconds is missing.

Open fondoger opened this issue 10 months ago • 2 comments

Test text:

This is the first paragraph. And this is the second sentence.
This is the second paragraph. And this is the forth sentence.

Tested format:

  • wav ✅
  • mp3 ✅
  • flac ✅
  • aac ✅
  • opus ❌ -> The last part d this is the forth sentence is missing in the opus output.

I believe the bug is in the StreamingAudioWriter (api/src/services/streaming_audio_writer.py). Opus caches a few frames in the buffer to do compression, but somehow the finalize=true does not flush the audio buffer.

Currently, I think we can simply disable opus output. Because ususally people use opus when they want minimal file size. I can use ffmpeg locally to convert lossless wav to opus.

fondoger avatar Apr 01 '25 16:04 fondoger

Has it ever worked?

You're not suggesting removing Opus support from the API are you?

It's used for streaming to Voice Assistants.

mbailey avatar Apr 18 '25 11:04 mbailey

same problem

prd-tuong-nguyen avatar Apr 25 '25 06:04 prd-tuong-nguyen