Is there a way to optimize silence periods in Opus better than DTX does?
Asked Answered
N

1

12

I'm doing a little bit of research about the DTX option in Opus:

Discontinuous Transmission (DTX) reduces the bitrate during silence or background noise. When DTX is enabled, only one frame is encoded every 400 milliseconds.

I wonder if there's an easy way to make Opus encode exactly one frame for the whole duration of a silence period rather than encoding useless silence frames every 400 milliseconds?

I want to produce "absolute" silence during silent or non-speech activity and minimize the overhead of headers, so basically a quiet recording will produce an almost empty file.

If there are other codecs that can accomplish that, I'd be happy to hear about them.

Nonintervention answered 5/6, 2016 at 12:45 Comment(2)
I think it will benefit very few if you enlarge the DTX window, 400ms is already very large.Crate
Isn't the format compressed regardless? Meaning consecutive "blank" frames will take up no space.Shiftless
G
3

I did not test this, but I am very confident it can be done, however, you would be breaking the standards which state:

2.1.9. Discontinuous Transmission (DTX)

Discontinuous Transmission (DTX) reduces the bitrate during silence or background noise. When DTX is enabled, only one frame is encoded
every 400 milliseconds.

Download the source code, open file ./silk/define.h and change line 57 [source for Linux] from

#define MAX_CONSECUTIVE_DTX 20 /* eq 400 ms */

to something like

#define MAX_CONSECUTIVE_DTX 40 /* eq 800 ms */

or whatever you feel is adequate. Without changing the source code I don't think it's possible, because as stated here

Even though Opus is now standardized by the IETF, this Opus implementation will keep improving in the future. Of course, all future versions will still be fully compliant with the Opus IETF specification.

Greatnephew answered 2/12, 2020 at 21:26 Comment(3)
I should also note that Opus is unusual among protocol specifications in that it's defined in terms of a reference implementation rather than a prose standard. As of this writing, Opus's reference implementation is given in RFCs 6716 and 8251.Hortensiahorter
Isn't the format compressed regardless? Meaning consecutive "blank" frames will take up no space. It would be easy to test by changing this value and seeing if there is any size difference... which I strongly doubt there will be.Shiftless
From my own testing, that doesn't seem to be the case: synthesizing an extremely long track of nothing but silence and encoding it with Opus, even with a frame duration of 60 ms, produces a proportionately large file which is also incompressible by lossless compression tools.Aldous

© 2022 - 2024 — McMap. All rights reserved.