-
Notifications
You must be signed in to change notification settings - Fork 20
Description
Hello,
I noticed that the Ogg Opus files generated by the Concentus library trigger several warnings when verified with the opusinfo tool. This happens even when using the standard OggTest sample code provided in the repository (or slightly modified to ensure valid input).
Although the files play correctly in most players (VLC, Chrome), opusinfo reports structure violations regarding Ogg Opus RFC compliance.
The warnings from opusinfo:
Plaintext
复制代码
Processing file "output.opus"...
New logical stream (#1, serial: ...): type opus
WARNING: Implausibly low preskip in Opus stream (1)
Encoded with libopus unknown
WARNING: Invalid zero byte packet in stream 1
Opus stream 1:
WARNING: stream 1 has more than one packet of end trimming
Pre-skip: 0
Original sample rate: 48000 Hz
...
Reproduction Steps:
I used a logic very similar to the OggTest project.
- Create an IOpusEncoder (48kHz, Stereo).
- Wrap it in OpusOggWriteStream .
- Feed it with raw PCM data (48kHz, 16-bit, Stereo).
- Call oggOut.Finish() .
Code Snippet (based on OggTest):
C#
复制代码
using (FileStream fileOut = new FileStream("output.opus" , FileMode.Create))
{
// Standard setup
IOpusEncoder encoder = OpusCodecFactory.CreateEncoder(48000, 2 , OpusApplication.OPUS_APPLICATION_AUDIO);
encoder.Bitrate =
96000 ;
OpusTags tags =
new OpusTags();
OpusOggWriteStream oggOut =
new OpusOggWriteStream(encoder, fileOut, tags, inputSampleRate: 48000 );
// Reading raw PCM (48kHz, Stereo, 16bit)
byte[] allInput = File.ReadAllBytes("input.raw" );
short [] samples = BytesToShorts(allInput);
// Write all samples
oggOut.WriteSamples(samples, 0 , samples.Length);
// Finish stream
oggOut.Finish();
}
The Issues:
- Low Preskip / Pre-skip: 0: It seems OpusOggWriteStream is not writing the correct pre-skip value (lookahead) into the Ogg header ID header, defaulting to 0.
- Invalid zero byte packet: Calling .Finish() seems to flush an empty packet at the end of the stream, which opusinfo flags as invalid.
Is there a recommended way to initialize the OpusOggWriteStream or a specific order of operations to ensure compliant headers?
Thanks!