[opus] Opus Tools -- low bitrates
Jan Stary
hans at stare.cz
Wed Aug 7 15:39:20 UTC 2024
Also see the spectrogram of the intermediate opus file.
On Aug 07 17:35:18, hans at stare.cz wrote:
> On Aug 07 08:30:31, hans at stare.cz wrote:
> > On Aug 07 00:41:52, petrparizek2000 at yahoo.com wrote:
> > > #1. To test encoding at low bitrates, I encoded a sine sweep at 12 kbps
> > > with Opusenc and then decoded the resulting file with Opusdec.
>
> > 1) Opusenc --bitrate 12 --downmix-mono Sweep50.wav Sweep50.opus
>
> Why are you using a stereo file
> containing the same sweep in both channels
> and then downmixing to mono?
>
> Also, why are you repeating the sweep twice in every channel?
>
> Also also, the file you linked to is Sweep50FlatMidSide.wav
> as opposed to Sweep50.wav - is it really the same file?
>
> > 2) Opusdec --float Sweep50.opus Sweep50out.wav
>
> Why are you using floats for the decoded file?
>
> > > The strange
> > > thing was that even though the output wave file was at 48 kHz, it showed
> > > clear marks of being resampled from 16 kHz
>
> The encoded opus file is 48kHz,
> so how would the output wav be resampled from 16kHz?
> What are those "clear signs" exactly?
>
> > and where my original frequency
> > > reached 16 kHz, the frequency in the output file practically fell down to
> > > zero.
>
> The intermediate opus file already contains
> only the first of the two repeating sweeps.
> After around 50s, there is silence.
> The resulting wav file too then, obviously.
>
> As far as I can tell (see the attached spectrograms),
> the sound dies out around the point the freq reaches 12kHz.
>
> Also see the transcript below.
>
> > > Unfortunately, it seems that the lowpass filtering is somehow a part of
> > > the actual resampling algorithm.
>
> What resampling?
>
> > > Why do I think so? Opus normally doesn't
> > > encode any frequencies above 20 kHz, which would suggest that 20 kHz should
> > > be aliased down to 4 kHz followed by silence.
>
> What makes you think a sampling frequency of 16 kHz
> is involved anywhere in the signal path?
>
> > However, right at the spot
> > > where my original sine sweep went all the way up to almost 24 kHz, the
> > > aliased frequency wen to almost 8 instead of being absent altogether.
> > > Now I can hear someone say that natural sounds are not composed solely
> > > of some very high frequencies. But I still think that aliasing is an
> > > undesirable effect. After all, when the final sample rate is supposed to be
> > > 48 kHz anyway, why should low bitrates make it necessary to first downsample
> > > the audio and then upsample again?
>
> What makes you think there is any downsampling involved?
>
> Jan
>
>
> $ soxi sweep.wav
>
> Input File : 'sweep.wav'
> Channels : 2
> Sample Rate : 48000
> Precision : 24-bit
> Duration : 00:01:51.32 = 5343360 samples ~ 8349 CDDA sectors
> File Size : 32.1M
> Bit Rate : 2.30M
> Sample Encoding: 24-bit Signed Integer PCM
>
> $ opusenc --bitrate 12 --downmix-mono sweep.wav sweep.opus
>
> Encoding0using_libopusi1.3.1m(audio)av1B20De_A12C8Dopus4me4mn24mc 24m--bitrate 12 --downmix-mono sweep.wav sweep.opus1B61Dn_A7C1C4mn4mc24m1B11Dc_A6C24me24mn24mc1B
> -----------------------------------------------------
> Input: 48 kHz, 1 channel
> Output: 1 channel (1 uncoupled)
> 20ms packets, 12 kbit/s VBR
> Preskip: 312
>
> Encoding0complete06 1440x realtime, 9.854 kbit/s
> -----------------------------------------------------
> Encoded: 1 minute and 51.34 seconds
> Runtime: 2 seconds
> (55.67x realtime)
> Wrote: 127667 bytes, 5567 packets, 114 pages
> Bitrate: 8.49542 kbit/s (without overhead)
> Instant rates: 3.2 to 23.2 kbit/s
> (8 to 58 bytes per packet)
> Overhead: 7.39% (container+metadata)
>
> $ opusdec sweep.opus out-pcm.wav
> $ opusdec --float sweep.opus out-float.wav
>
> Processing file "sweep.opus"...
>
> New logical stream (#1, serial: 2dc0e27f): type opus
> Encoded with libopus 1.3.1, libopusenc 0.2.1
> User comments section follows...
> ENCODER=opusenc from opus-tools 0.2
> ENCODER_OPTIONS=--bitrate 12 --downmix-mono
> Opus stream 1:
> Pre-skip: 312
> Playback gain: 0 dB
> Channels: 1
> Original sample rate: 48000 Hz
> Packet duration: 20.0ms (max), 20.0ms (avg), 20.0ms (min)
> Page duration: 1000.0ms (max), 994.1ms (avg), 340.0ms (min)
> Total data length: 127667 bytes (overhead: 7.39%)
> Playback length: 1m:51.319s
> Average bitrate: 9.175 kbit/s, w/o overhead: 8.497 kbit/s
> Logical stream 1 ended
>
> $ soxi out-pcm.wav
>
> Input File : 'out-pcm.wav'
> Channels : 1
> Sample Rate : 48000
> Precision : 16-bit
> Duration : 00:01:51.32 = 5343360 samples ~ 8349 CDDA sectors
> File Size : 10.7M
> Bit Rate : 768k
> Sample Encoding: 16-bit Signed Integer PCM
>
> $ soxi out-float.wav
>
> Input File : 'out-float.wav'
> Channels : 1
> Sample Rate : 48000
> Precision : 25-bit
> Duration : 00:01:51.32 = 5343360 samples ~ 8349 CDDA sectors
> File Size : 21.4M
> Bit Rate : 1.54M
> Sample Encoding: 32-bit Floating Point PCM
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: spectrogram-opus.png
Type: image/png
Size: 190437 bytes
Desc: not available
URL: <http://lists.xiph.org/pipermail/opus/attachments/20240807/1e698c42/attachment-0001.png>
More information about the opus
mailing list