Closed zhengzyyyy closed 3 years ago
I didn't try to reproduce, but it looks like you're reading two 2 16-bit integers per sample, but your example filename says it's mono, not stereo. If you ask for 1 encoded channel with ope_encoder_create_*
I'd expect that to just double to size of your input buffer. But if you ask for stereo and feed in mono data two samples at a time, that would explain the doubled playback speed. So maybe double-check that?
I didn't try to reproduce, but it looks like you're reading two 2 16-bit integers per sample, but your example filename says it's mono, not stereo. If you ask for 1 encoded channel with
ope_encoder_create_*
I'd expect that to just double to size of your input buffer. But if you ask for stereo and feed in mono data two samples at a time, that would explain the doubled playback speed. So maybe double-check that?
Thank you rillian, you are right!
After I made the above modification, the conversion was normal.
I try to use opusenc for converting a pcm to ogg file, so I modified the sampling rate and the number of channels in the opusenc_example code to the real value of the pcm. And use the opusenc_example to make convert.
But the duration of this ogg file is half of the output of the tool, and it sounds faster than normal, Can anyone help me?
The format of pcm file: sampling rate: 8000 channels: 1
(1) ----------opusenc_example------------------
./opusenc_example 8k16bits_1chan.pcm example_out.opus
(2) opusenc 8k16bits_1chan.pcm tool_out.opus --raw-rate 8000 --raw-chan 1 --raw
here is the pcm file. pcm.zip