Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FFmpeg: Decoding of MP3 files fails #11923

Open
uklotzde opened this issue Sep 5, 2023 · 16 comments · May be fixed by #12034
Open

FFmpeg: Decoding of MP3 files fails #11923

uklotzde opened this issue Sep 5, 2023 · 16 comments · May be fixed by #12034

Comments

@uklotzde
Copy link
Contributor

uklotzde commented Sep 5, 2023

Bug Description

Caused by #11879.

warning [AnalyzerThread 0 #1] SoundSourceFFmpeg - av_seek_frame() failed: Operation not permitted
warning [AnalyzerThread 0 #1] AudioSource - Failed to read sample frames: expected = [0 -> 1) , actual = [0 -> 0)
info [AnalyzerThread 0 #1] AudioSource - Shrinking readable frame index range: before = [0 -> 16816943) , after = [0 -> 0)
warning [AnalyzerThread 0 #1] AudioSource - Read test failed: expected = [0 -> 1) , actual = [0 -> 0)
warning [AnalyzerThread 0 #1] SoundSourceProxy - Failed to read file "file:///home/uk/Music/1st/*****.mp3" with provider "FFmpeg"

av_seek_frame() fails if seekTimestamp is negative.

Version

No response

OS

No response

@Swiftb0y
Copy link
Member

can confirm. #12034

@acolombier
Copy link
Member

acolombier commented Dec 5, 2023

I am currently experiencing something similar as well. I have been for some times and thought files were missing, but it turns out the are here and can be read just fine with any other software. The is the output of ffprobe on one if them in case it helps:

Input #0, mp3, from './path/to/file':
  Metadata:
    title           : ...
    artist          : ...
    genre           : ...
    TKEY            : 4m
    TBPM            : 128
    id3v2_priv.TRAKTOR4: DMRT\x92\x0d\x00\x00\x02\x00\x00\x00RDH 0\x00\x00\x00\x03\x00\x00\x00SKHC\x04\x00\x00\x00\x00\x00\x00\x00\x81z\x04\x00DOMF\x04\x00\x00\x00\x00\x00\x00\x00\x19\x04\xdf\x07NSRV\x04\x00\x00\x00\x00\x00\x00\x00\x07\x00\x00\x00ATADJ\x0d\x00\x00\x12\x00\x00\x00
  Duration: 00:05:39.39, start: 0.000000, bitrate: 320 kb/s
  Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 320 kb/s

Log output:

info [CachingReaderWorker 1] SoundSourceMp3 - Recoverable MP3 header decoding error: lost synchronization
info [CachingReaderWorker 1] SoundSourceMp3 - MP3 frame header | layer: 0 mode: 0 #channels: 1 #samples: 36 bitrate: 0 samplerate: 0 flags: "0x0000"
info [CachingReaderWorker 1] SoundSourceMp3 - Recoverable MP3 header decoding error: reserved header layer value
[...repeat...]
warning [CachingReaderWorker 1] SoundSourceMp3 - Differing number of channels 2 <> 1 in MP3 frame headers: "/path/to/file"
info [CachingReaderWorker 1] SoundSourceMp3 - Recoverable MP3 frame decoding error: forbidden bit allocation value
warning [CachingReaderWorker 1] SoundSourceMp3 - MP3 frame header with mismatching number of channels 1 <> 2  - aborting
warning [CachingReaderWorker 1] AudioSource - Failed to read sample frames: expected = [0 -> 1) , actual = [0 -> 0)
info [CachingReaderWorker 1] AudioSource - Shrinking readable frame index range: before = [0 -> 14946432) , after = [0 -> 0)
warning [CachingReaderWorker 1] AudioSource - Read test failed: expected = [0 -> 1) , actual = [0 -> 0)
warning [CachingReaderWorker 1] SoundSourceProxy - Failed to read file "file:///path/to/file" with provider "MAD: MPEG Audio Decoder 0.15.1 (beta) NDEBUG FPM_64BIT"
[mp3 @ 0x7fffac00a480] Skipping 1035 bytes of junk at 29444.
[mp3 @ 0x7fffac00a480] Estimating duration from bitrate, this may be inaccurate
warning [CachingReaderWorker 1] SoundSourceFFmpeg - av_seek_frame() failed: Operation not permitted
warning [CachingReaderWorker 1] AudioSource - Failed to read sample frames: expected = [0 -> 1) , actual = [0 -> 0)
info [CachingReaderWorker 1] AudioSource - Shrinking readable frame index range: before = [0 -> 14966926) , after = [0 -> 0)
warning [CachingReaderWorker 1] AudioSource - Read test failed: expected = [0 -> 1) , actual = [0 -> 0)
warning [CachingReaderWorker 1] SoundSourceProxy - Failed to read file "file:///path/to/file" with provider "FFmpeg 4.4.2-0ubuntu0.22.04.1+esm1"
info [CachingReaderWorker 1] SoundSourceMp3 - Recoverable MP3 header decoding error: lost synchronization
info [CachingReaderWorker 1] SoundSourceMp3 - MP3 frame header | layer: 0 mode: 0 #channels: 1 #samples: 36 bitrate: 0 samplerate: 0 flags: "0x0000"
info [CachingReaderWorker 1] SoundSourceMp3 - Recoverable MP3 header decoding error: reserved header layer value
[...repeat...]
warning [CachingReaderWorker 1] SoundSourceMp3 - Differing number of channels 2 <> 1 in MP3 frame headers: "/path/to/file"
info [CachingReaderWorker 1] SoundSourceMp3 - Recoverable MP3 frame decoding error: forbidden bit allocation value
warning [CachingReaderWorker 1] SoundSourceMp3 - MP3 frame header with mismatching number of channels 1 <> 2  - aborting
warning [CachingReaderWorker 1] AudioSource - Failed to read sample frames: expected = [0 -> 1) , actual = [0 -> 0)
info [CachingReaderWorker 1] AudioSource - Shrinking readable frame index range: before = [0 -> 14946432) , after = [0 -> 0)
warning [CachingReaderWorker 1] AudioSource - Read test failed: expected = [0 -> 1) , actual = [0 -> 0)
warning [CachingReaderWorker 1] SoundSourceProxy - Failed to read file "file:///path/to/file" with provider "MAD: MPEG Audio Decoder 0.15.1 (beta) NDEBUG FPM_64BIT"
[mp3 @ 0x7fffac00a480] Skipping 1035 bytes of junk at 29444.
[mp3 @ 0x7fffac00a480] Estimating duration from bitrate, this may be inaccurate
warning [CachingReaderWorker 1] SoundSourceFFmpeg - av_seek_frame() failed: Operation not permitted
warning [CachingReaderWorker 1] AudioSource - Failed to read sample frames: expected = [0 -> 1) , actual = [0 -> 0)
info [CachingReaderWorker 1] AudioSource - Shrinking readable frame index range: before = [0 -> 14966926) , after = [0 -> 0)
warning [CachingReaderWorker 1] AudioSource - Read test failed: expected = [0 -> 1) , actual = [0 -> 0)
warning [CachingReaderWorker 1] SoundSourceProxy - Failed to read file "file:///path/to/file" with provider "FFmpeg 4.4.2-0ubuntu0.22.04.1+esm1"
warning [CachingReaderWorker 1] SoundSourceProxy - Giving up to open file "file:///path/to/file" after 4 unsuccessful attempts
warning [CachingReaderWorker 1] CachingReaderWorker - "[Channel1]" Failed to open file QFileInfo(/path/to/file)

Is this still an issue and related or would that be something different? The open PR seems to only include a test change.

Edit: the SoundSourceFFmpeg - av_seek_frame() failed: Operation not permitted makes me think it is probably the same

@Swiftb0y
Copy link
Member

Swiftb0y commented Dec 6, 2023

Well, can you try #12034 and see if that fixes it for you too. Then the issue is pretty clear cut...

@acolombier
Copy link
Member

The open PR seems to only include a test change.

Or do you mean something suggested in the PR discussion?

@Swiftb0y
Copy link
Member

Swiftb0y commented Dec 6, 2023

Ah I forgot that the actual fix got rebased out halfway through the PR. If you clamp the seeking (see 012a415) then you should be able to load the mp3s. However, as pointed out by the others in that PR, it reintroduces some issues with playing back AACs so thats why I didn't get accepted. I have not bothered enough to look into this, though we really should.

@uklotzde
Copy link
Contributor Author

uklotzde commented Dec 6, 2023

I have reverted the "fix" locally and use FFmpeg for MP3/M4A. No issues.

No one seems to be able to come up with a suitable offset compensation or otherwise prove that the usage of the FFmpeg API in Mixxx is wrong.

Everyone seems to be happy with the broken state...

@acolombier
Copy link
Member

Thanks for the tip @Swiftb0y, will give it a go asap.

No one seems to be able to come up with a suitable offset compensation or otherwise prove that the usage of the FFmpeg API in Mixxx is wrong.

VLC/ffplay seem to be able to deal fine with those mp3s, and I would hope AACs too (I don't use that format so can't verify), perhaps it's worth to check the implementation in there and see if there is any indication on something we are doing wrong. I will try to give that a go.

@uklotzde
Copy link
Contributor Author

uklotzde commented Dec 6, 2023

VLC/ffplay seem to be able to deal fine with those mp3s, and I would hope AACs too (I don't use that format so can't verify), perhaps it's worth to check the implementation in there and see if there is any indication on something we are doing wrong.

The offset compensation for MP3 that has been added later as a "fix" is wrong. There were never any issues with decoding. VLC/ffplay don't need to care about offsets when decoding lossy formats.

@daschuer
Copy link
Member

daschuer commented Dec 6, 2023

The original issue we see here is that the SoundSourceMp3 is not able to decode the file. Than SoundSourceFFmpeg fails as well probably because of this bug. You may send the effected file to my email and I can have a look why our error recovering code fails in your case.

@acolombier
Copy link
Member

I've just shared it to your Mixxx address via Drive. I can also send it to you directly if you would prefer (not sure if drive perform any post treatment after upload on MP3)

@daschuer
Copy link
Member

daschuer commented Dec 6, 2023

Received it and I can confirm the issue.

@acolombier
Copy link
Member

I haven't been experienced this issue since your fix @daschuer
Perhaps we can close this issue?

@daschuer
Copy link
Member

The issue is still kind of open because it is an issue with the not standard configuration of not using libmad for mp3.
ffmpeg uses to he faster libmpg123, wich is unfortunately not compatible to the waveforms and cues created with libmad.
So a switch is not trivial.

@uklotzde
Copy link
Contributor Author

Decoding MP3 with FFmpeg is still broken. I am using a local patch that basically reverts the non-workimg changes.

@Swiftb0y
Copy link
Member

same here. Been using ffmpeg since 2.3-beta iirc... The incompatibility boils down to the varying start-timing between the decoders, or is there something else?

@daschuer
Copy link
Member

Yes basically. There will also be issues when skipping frames in the process of error handling but I would rather ignore that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants