Opened 2 years ago

Last modified 2 years ago

#5759 new enhancement

libopusenc: make surround masking and LFE optimizations default, optional and independent of mapping family

Reported by: Peter.White Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: libopus
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Summary of the bug:

Currently there is no way, that I know of, to enable surround masking and LFE optimizations in the libopus encoder, other than enabling -mapping_family 1. These optimizations result in a significantly lower bitrate at virtually the same perceptual quality.

How to reproduce:

% ffmpeg -i surround_input -c:a libopus output
ffmpeg version N-81293-g81fcd91 Copyright (c) 2000-2016 the FFmpeg developers

This by default disables above mentioned optimizations, as stated by the docs for the mapping family option. To enable them one needs to set mapping family to 1, which does not make much sense for input with less than 3 channels.

The current release of opusenc

opusenc --version
opusenc opus-tools 0.1.9 (using libopus 1.1.3)
Copyright (C) 2008-2013 Xiph.Org Foundation

does enable those optimizations by default, easily observable by encoding the same input with opusenc:

opusenc surround_input output

I have seen differences in bitrate of up to 20% with this. Plus, I have found no way to even disable them with opusenc. So, if the opus developers think it safe to enable these settings and not even provide an option to disable them, I think it should be just as safe for ffmpeg to enable them and provide an option to disable.

Or, leave the defaults as is and provide an option to enable the optimizations separately from mapping family. That way one can still leverage the automatic mapping family setting with -mapping_family -1 but on top of that enable surround masking and LFE optimizations at will. Of course that should be a no-op if the number of channels is less than 3. Or, more precisely:
ffmpeg -i input -lfe_optimizations -surround_masking output.opus
should enable LFE optimizations only if there actually is an LFE channel and likewise for surround masking.

Change History (2)

comment:1 Changed 2 years ago by cehoyos

  • Keywords libopus added; mapping_family removed

comment:2 Changed 2 years ago by Peter.White

  • Priority changed from wish to normal

Having thought about this a bit more, I think "normal" is the right priority, since this is not purely cosmetic. I also think many people would want this, because it would be a great enhancement.

Last edited 2 years ago by Peter.White (previous) (diff)
Note: See TracTickets for help on using tickets.