xiph / opus-tools

A set of tools to encode, inspect, and decode audio in the Opus format.
https://opus-codec.org/
Other
218 stars 79 forks source link

Enabling Ambisonic Encoding #74

Open MandyJCho opened 1 year ago

MandyJCho commented 1 year ago

Hi there,

I was following this thread about the --enable-ambisonic flag. Are there instructions to enable the ambisonic API with the opusenc cli? The documentation for 1.3 mentions support for channel mapping families 2 and 3, but it's unclear where I can configure this.

Right now the layout is being set to quad rather than 'ambisonic 1'

Input #0, ogg, from '.\ambisonic_opusenc.opus':
  Duration: 00:00:29.04, start: 0.000000, bitrate: 185 kb/s
  Stream #0:0: Audio: opus, 48000 Hz, quad, fltp
    Metadata:
      ENCODER         : opusenc from opus-tools 0.2-3-gf5f571b

Here's an output using ffmpeg to transcode audio:

Input #0, ogg, from '.\ambisonic_ffmpeg_2.opus':
  Duration: 00:00:29.04, start: 0.000000, bitrate: 113 kb/s
  Stream #0:0: Audio: opus, 48000 Hz, ambisonic 1, fltp
    Metadata:
      encoder         : Lavc59.51.100 libopus
Artoria2e5 commented 1 year ago

Could be --channels ambix per https://github.com/xiph/opus-tools/blob/ecd50e531fbf378499a3f71cdca05ad969c2e29f/man/opusenc.1#L317

family 2 (matrix) is the default and I am not seeing any place to change it. well, multi-mono is probably much worse anyways. https://github.com/xiph/opus-tools/blob/ecd50e531fbf378499a3f71cdca05ad969c2e29f/src/opusenc.c#L901-L906