xiph / opus

Modern audio compression for the internet.
https://opus-codec.org/
Other
2.31k stars 619 forks source link

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

Open JsBergbau opened 9 months ago

JsBergbau commented 9 months ago

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 134 - Kapitel 134 (only first second)

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 myg*lly.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

silverbacknet commented 9 months ago

Can you add a wav or flac of the first ~10 seconds of a file that clearly shows the problem? That would be a lot simpler than trying to source the originals via iffy sites.

JsBergbau commented 9 months ago

Ok I under fair use policies to debug this, I provide here the wave of the Audio Book "Martin Wehrle - Wenn jeder dich mag, nimmt keiner dich ernst." Please download and write when you have received your sample, then I'll delete here.

I am providing the first 15 seconds of file 080 - Kapitel 80. This file also has problems with default framesize of 20. Why 15 seconds? Because it takes about 12 seconds until opus has reached its full quality.

Interessting when using bitrate 31 the problem doesn't occur.

it sounds much more brilliant than using 32. With --bitrate 33 it has the same problem as with 32. Problems are with bitrates of 32, 33, 34, 35, 36 (tested bitrates 16, 31, 37, 38, 39, 40)

080 - Kapitel 80 15s.zip PW: xSObaJfGJmCtHn1

JsBergbau commented 8 months ago

Any progress so far in background?

JsBergbau commented 7 months ago

Any update on this? Even with --bitrate 31 I encountered the problem at the beginning of the file. At least it is less severe, but still clearly audible.

JsBergbau commented 5 months ago

Can anybody raise the priority of this issue? I consider this as a severe bug.