xiph / libopusenc

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

Wishlist #8

Open commarmi76 opened 6 years ago

commarmi76 commented 6 years ago

Hello,

I'm using libopusenc with an ARM cortex-m4 device and there are some feature that could be useful:

I tried to do this changes in the libopusenc by myself, but granule position is a mess. Finally I have created a version of opusenc.c (from opus-tools) to test my system, but I think it would be fantastic if libopusenc could be used for small systems.

br.

Flix01 commented 6 years ago
  • Avoid resampling with rates supported by opus (8000, 12000, 16000, 24000, and 48000). Resampling in a powerfull CPU isn't a problem, but in a small MCU is a heavy proces.

I tried to do this changes in the libopusenc by myself, but granule position is a mess. Finally I have created a version of opusenc.c (from opus-tools) to test my system, but I think it would be fantastic if libopusenc could be used for small systems.

@commarmi76: Could you please elaborate a bit more on the difference between the program opusenc from opus-tools and libopusenc/examples/opusenc_example.c ?

I'm not using ARM devices, I just ask because I think the opus audio quality I'm getting from opusenc in opus-tools is better than the quality I'm getting from using bare libopusenc, and I'm trying to understand if it's just some option I'm missing or if opusenc is a better encoder...

jmvalin commented 6 years ago

The opusenc_example.c is just a minimalist opusenc-like tool that demonstrates how libopusenc works. It assumes the audio is raw (no header) PCM at 44.1 kHz and that you're using the default options.

Flix01 commented 6 years ago

The opusenc_example.c is just a minimalist opusenc-like tool that demonstrates how libopusenc works. It assumes the audio is raw (no header) PCM at 44.1 kHz and that you're using the default options.

@jmvalin: yes, I know. I've modified it to encode a mono raw PCM IStream "text to speech" output from the MS Speech Platform SDK (I can choose different sample rates to feed the opus encoder).

But I noticed that if I just output a .wav file and use opusenc manually (at the same bitrate), I get an .opus file that sounds better. That's why I was thinking it was caused by the unnecessary resampling that was mentioned by @commarmi76.

[UPDATE:] If I set the signal type to OPUS_SIGNAL_MUSIC with libopusenc I get better results (when using opusenc I'm not setting it... maybe I was using an older version). I'm still not sure if now it's really the same quality, but I think it's more acceptable now (before the voice sound was too 'metallic' and less natural).

P.S. Thank you for your quick answer.