xiph / libopusenc

Library for encoding .opus audio files and live streams.
BSD 3-Clause "New" or "Revised" License
108 stars 39 forks source link

Missing last second of audio #32

Closed lwahonen closed 5 months ago

lwahonen commented 5 months ago

Single-file reproducer, not sure if I'm using libopusenc incorrectly or if this is a bug.

Steps to reproduce:

1) Put raw audio into c:\temp\input.raw, 2 bytes per sample, 48khz, mono 2) Run the reproducer ( https://gist.github.com/lwahonen/6b0b0e311750703a0ae7deb164b82405 ) 3) Notice that the last word or two from the test recording are missing from c:\temp\output.opus

I'm using libopusenc, libogg, libopus etc from their respective HEADs

jmvalin commented 5 months ago

That's expected if you don't drain the encoder first.

lwahonen commented 5 months ago

I do call ope_encoder_drain(opusEncoderPointer);

Is there a different drain I need to call too?

lwahonen commented 5 months ago

Running the same raw data via opusenc.exe --raw input.raw test.opus results in audio data not being lost.

lwahonen commented 5 months ago

I rebuilt all components and the issue disappeared.