mixxxdj / mixxx

Mixxx is Free DJ software that gives you everything you need to perform live mixes.
http://mixxx.org
Other
4.36k stars 1.26k forks source link

Ogg Vorbis: Offset with random seeks #11267

Open smesgr9000 opened 1 year ago

smesgr9000 commented 1 year ago

Bug Description

this issue is not reproducable for all files/songs, but if a file has this issue it is reproducable at 100% for me. As far as I'm aware this only happens with ogg vorbis. Didn't notice this for mp3s or wavs.

Way to reproduce and easily notice it.

example database entry for this song: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

112 4559 2 3160 0 -1   16744448
113 4559 8 3160 41131816 -1   16744448
114 4559 6 3160 0 -1   16744448
115 4559 7 -1 41134976 -1   16744448
388 4559 1 37858326.9677419 0 6   16744448
447 4559 4 2692133 341419.35483871 -1   16744448
524 4559 1 9733907.61290323 0 3 Gesang 16744448
525 4559 1 3456 0 0 Ü Start 16744448
527 4559 1 2692133.41935484 0 1   16744448

I did try changing the audio buffer and settings but does not mitigate the issue - the resulting effect maybe differ but still affected.

Attached a short sample of the steps above delay.mp3.zip

Version

2.3.2

OS

Ubuntu 22.04

daschuer commented 1 year ago

I do not understand what the issue is. Looping works on the decoded raw samples, so an issue cannot be related to looping. There may be an issue with random seeks or a general decoding issue.

Can you describe again what happens and what should happen instead? Can you provide the wav and the ogg file as a private message?

smesgr9000 commented 1 year ago

sorry it is hard to explain. Hope this helps: issue

expectation: in this setup the music continue to play as "one" song to the end. seen: the playback on both files seem to be shifted by some milliseconds at hotcue point 2

if the ogg file is played alone, you could hear a stutter on hotcue 2. I will provide both files via private message

daschuer commented 1 year ago

Ah, now I understand. Mixxx keeps the portions of samples in cache that are likely to be played next, to avoid tiny gaps of silence for accessing the disk. When you reach a cue point, it uses the already cached samples instead of the samples from a steady stream. This should not make differences. Since it makes a difference for you, the ogg decoder id probably broken.

daschuer commented 1 year ago

I can confirm this with Ubuntu Focal 20.4

daschuer commented 1 year ago

When I load the original ogg file with Audacity and then export it as new ogg file, the issue is gone. So I think it is something in the original file that tricks Mixxx. Unlike mp3 where we manage the seeking yourself we rely for ogg on libvorbisfile. So we may consider to file an upstream bug at: https://github.com/xiph/vorbis/issues Do you have more files with this issue?

smesgr9000 commented 1 year ago

yes, but can't pin-point it at the moment. Of course most of them are generated by the same lib

libvorbisenc2/jammy,now 1.3.7-1build2 amd64 [Installiert,automatisch] encoder library for Vorbis General Audio Compression Codec

should be my installed version as far as i know

daschuer commented 1 year ago

I have just compared the original and the Audacity re-encoded file with oggz-info

With this result:

Original

Content-Duration: 00:07:46.382

Vorbis: serialno 1179750276
    32655 packets in 464 pages, 70.4 packets/page, 0.871% Ogg overhead
    Audio-Samplerate: 44100 Hz
    Audio-Channels: 2

re-encoded:

Content-Duration: 00:07:46.419

Vorbis: serialno 1478221743
    39067 packets in 1735 pages, 22.5 packets/page, 1.387% Ogg overhead
    Audio-Samplerate: 44100 Hz
    Audio-Channels: 2

What does packets/page mean?

smesgr9000 commented 1 year ago

odd the duration differs - this shouldn't happen right?

I can confirm the behavior, after re-encoding the file the issue goes away:

Content-Duration: 00:07:46.419

Vorbis: serialno 1296591695
    38388 packets in 1412 pages, 27.2 packets/page, 1.482% Ogg overhead
    Audio-Samplerate: 44100 Hz
    Audio-Channels: 2

I would suggest closing the issue. If I have some more time i will dig deeper and open an issue over at the lib vorbis project. If I can reproduce the encoding error. Thanks for looking into this.

daschuer commented 1 year ago

We may consider to add an automatic test to detect such issues and warn the user. We have already have a check decoding offsets at the beginning. we may extend that for the end as well.