xiph / xiph/opus

Bug: Bad quality at beginning of file: Frequency capped to ~7kHz after a few seconds quality is again OK

Open
#309 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
3.3k
Forks
808
PR merge metrics
No merged PRs in 30d

Description

I use opus a lot for audiobooks storing at 32 kbit/s. At the beginning I used opusenc --bitrate 32 --framesize 60 to save a few bits extra. Then I've read here https://wiki.xiph.org/Opus_Recommended_Settings#Framesize_Tweaking that using a framesize of 60 has slightly lower quality. With framesize 60 I've encountered the problem quite often. Using default framesize of 32 the problem occured now with 2 files. So it looks like it is some kind of probablity that the problem occurs whereas the probablity rises significant with --framesize 60

When the problem occurs the first few seconds of the audio book file are very damp. Then with 2 to 4 seconds, you can here how the frequency range goes up and the audio sounds brilliant again. Somtimes it also takes only 1 to 2 seconds where you can here the frequencies going continiously up. Very seldom there is also a hard switch where within less then one seconds the full freuquency range is suddenly back (e.g. in 101 - Kapitel 101). Sometime the audio is clear within the first five seconds of the file, mostly it takes about to second 15 of the file until it is fully brilliant again.

Example with Elena Krieger - Die Milchlüge. Die Milch macht's leider doch nicht - 013.mp3
According to audacity frequency is capped to about 7 kHz
grafik

A few seconds later, when problem is gone, it looks like this
grafik

I've reproduced the problem with the same file with

opusenc opus-tools 0.2-3-gf5f571b (using libopus 1.3)
Copyright (C) 2008-2018 Xiph.Org Foundation
opusenc opus-tools 0.2 (using libopus 1.3.1)
Copyright (C) 2008-2018 Xiph.Org Foundation
opusenc --version
opusenc opus-tools 0.2 (using libopus 1.4)
Copyright (C) 2008-2018 Xiph.Org Foundation

So the problem seems to be deeply in the library of opusenc. When using either --speech or --music in addition problem doesn't occur.
Input is mp3 which is decoded via lame --decode. Using ffmpeg for decode of Elena Krieger - Die Milchlüge. Die Milch macht's leider doch nicht - 013.mp3 and then encoded with opus lead to the same problem.

Very extreme is the audio book Martin Wehrle - Wenn jeder dich mag, nimmt keiner dich ernst
with opusenc --birate 32 --framesize 60 the problem occurs in almost every file

Here a list of files where it occurs

004 - Kapitel 4
006 - Kapitel 6
007 - Kapitel 7
011 - Kapitel 11
012 - Kapitel 12
015 - Kapitel 15
016 - Kapitel 16
018 - Kapitel 18
022 - Kapitel 22
023 - Kapitel 23
024 - Kapitel 24
025 - Kapitel 25
026 - Kapitel 26
029 - Kapitel 29
030 - Kapitel 30
033 - Kapitel 33
034 - Kapitel 34
035 - Kapitel 35
037 - Kapitel 37
041 - Kapitel 41
042 - Kapitel 42
045 - Kapitel 45
046 - Kapitel 46
050 - Kapitel 50
051 - Kapitel 51
053 - Kapitel 53
054 - Kapitel 54
055 - Kapitel 55
056 - Kapitel 56
057 - Kapitel 57
059 - Kapitel 59
060 - Kapitel 60
062 - Kapitel 62
063 - Kapitel 63
067 - Kapitel 67
068 - Kapitel 68
070 - Kapitel 70
071 - Kapitel 71
072 - Kapitel 72
073 - Kapitel 73
074 - Kapitel 74
075 - Kapitel 75
076 - Kapitel 76
077 - Kapitel 77
078 - Kapitel 78
079 - Kapitel 79
080 - Kapitel 80
084 - Kapitel 84
085 - Kapitel 85
087 - Kapitel 87
088 - Kapitel 88
089 - Kapitel 89
090 - Kapitel 90
093 - Kapitel 93
094 - Kapitel 94
096 - Kapitel 96
097 - Kapitel 97
098 - Kapitel 98
099 - Kapitel 99
100 - Kapitel 100
101 - Kapitel 101
102 - Kapitel 102
103 - Kapitel 103
105 - Kapitel 105
108 - Kapitel 108
110 - Kapitel 110
112 - Kapitel 112
113 - Kapitel 113
114 - Kapitel 114
115 - Kapitel 115
116 - Kapitel 116
117 - Kapitel 117
118 - Kapitel 118
119 - Kapitel 119
120 - Kapitel 120
121 - Kapitel 121
122 - Kapitel 122
124 - Kapitel 124
125 - Kapitel 125
126 - Kapitel 126
128 - Kapitel 128
131 - Kapitel 131
133 - Kapitel 133
134 - Kapitel 134
135 - Kapitel 135
137 - Kapitel 137
138 - Kapitel 138
140 - Kapitel 140

So in totalit occurs in 88 of 141 files, which is about 2/3.

Using opusenc --birate 32 it occurs only with

053 - Kapitel 53
080 - Kapitel 80
100 - Kapitel 100

EDIT: Removed Track 134 because there problem already existed in original audio

If it is helpful I can to the same analysis with the audio book of Elena Krieger - Die Milchlüge

You can get the audio book on variaous sources like myglly.com or h**rbch.us

In the attachement you find the SHA256Sums of the files I've tested with.
The list above was made with Files of SHA256SumsMartinFullyTested.txt

With SHA256SumsMartin2Only4FilesWithDefaultFramesizeTested.txt I've only tested with opusenc --bitrate 32 the "Kapitel" 53,80,100 and 134 files. Despite a differenct file checksum the same damp audio quality occured.

If I can further assist you, just write.
SHA256SumsMartinFullyTested.txt
SHA256SumsMartin2Only4FilesWithDefaultFramesizeTested.txt

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the report with opusenc using libopus 1.3, 1.3.1, or 1.4, especially at 32 kbit/s with --framesize 60, and compare the listed audiobook files. Examine the encoder behavior behind opusenc and the contrasting results with --speech or --music. Done means identifying and correcting the cause of the initial frequency cap, with the reported files no longer showing the damp opening.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
audio-video-rtc, cli
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.