View Issue Details

IDProjectCategoryView StatusLast Update
0000725OpenMPTGeneralpublic2015-11-13 14:23
ReporterSaga Musix Assigned Tomanx  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product VersionOpenMPT 1.25.03.00 / libopenmpt 0.2-beta15 (upgrade first) 
Target VersionOpenMPT 1.25.04.00 / libopenmpt 0.2-beta16 (upgrade first)Fixed in VersionOpenMPT 1.25.04.00 / libopenmpt 0.2-beta16 (upgrade first) 
Summary0000725: MP3 encoder misses first few samples due to malformed ID3v2.4 tags
Description

The MP3 ACM encoder seems to throw away the first few samples fed into it; Having some sound with a sharp attack on the first row of the song demonstrates this best: The attack will be lost with the ACM encoder.

TagsNo tags attached.
Attached Files
kick.7z (6,627 bytes)
bug725-manx-1.7z (296,107 bytes)
Has the bug occurred in previous versions?
Tested code revision (in case you know it)

Activities

manx

manx

2015-11-12 10:17

administrator   ~0002176

Should be fixed in r5757.

Saga Musix

Saga Musix

2015-11-12 23:35

administrator   ~0002177

After the fix I start to wonder if this was actually caused by OpenMPT at all or if it's a bug in LAME ACM... now there is some additional silence at the start but the click is still missing, compared to other encoders (see attached file).

manx

manx

2015-11-13 09:35

administrator   ~0002179

r5757 did not actually fix (or even change) anything at all. Looks like LAME ACM does not even set nCodecDelay. I (we?) probably got confused with the test outputs yesterday.
Investigating further.

manx

manx

2015-11-13 10:21

administrator   ~0002180

Ok, I rendered the testcase using libmp3lame VBR (i.e. with LAME header), libmp3lame CBR (without LAME header), LAME ACM CBR and OpenMPT native WAVE output.
All renderings are 44.1kHz, stereo, 128kbps.
The 3 mp3s, when decoded using lame commandline utility (probably the best tool to get delays right, as LAME obviously knows about this stuff in order to be able to implement proper delay compensation with the LAME header), the VBR mp3 and the WAV properly align sample exact. The libmp3lame and LAME ACM version also align to each other, however, there is an additional ~13ms (did not take an exact measurement here) of silence/delay at the beginning.
Audio data is complete in all cases. I cannot see any missing initial kick.
LAME reports the skipped delay while decoding: It reports 529 samples for libmp3lame CBR as well as for LAME ACM. libmp3lame VBR (i.e. with header) reports 1105 samples delay skip.
The difference is (1105-529)=576 samples (exactly half an mp3 frame and also the specified encoder delay for LAME, roughly 13ms). LAME documents the encoder delay for the FhG encoder as 1160 samples, thus encoder delay differs from encoder to encoder in practice. There is no way for a decoder to know the encoder delay unless specified in some external way (i.e. LAME header).
Note: There are other decoders that do not even compensate for their own decoder delay (i.e. they add an additional amount of silence). Libav is such a decoder.
As of now, I cannot see any bug in OpenMPT or even LAME ACM here.

Versions tested:
libmp3lame 3.99.5 (32bit, VS2008)
LAME ACM 3.99.5 (32bit, VS2008)
lame command line (for decoding) 3.99.5 (64bit, GCC, Debian 8)
avconv version 11.4-6:11.4-1~deb8u1, Copyright (c) 2000-2014 the Libav developers

Saga Musix

Saga Musix

2015-11-13 13:11

administrator   ~0002182

I seem to have found the key to this issue: At least with the ACM codec, there seems to be a difference in the exported result depending on whether ID3 tags are embedded or not.

Saga Musix

Saga Musix

2015-11-13 14:23

administrator   ~0002185

Fixed in r5763

Issue History

Date Modified Username Field Change
2015-11-11 22:56 Saga Musix New Issue
2015-11-12 10:17 manx Assigned To => manx
2015-11-12 10:17 manx Status new => assigned
2015-11-12 10:17 manx Note Added: 0002176
2015-11-12 23:35 Saga Musix Note Added: 0002177
2015-11-12 23:36 Saga Musix File Added: kick.7z
2015-11-13 09:35 manx Note Added: 0002179
2015-11-13 10:16 manx File Added: bug725-manx-1.7z
2015-11-13 10:21 manx Note Added: 0002180
2015-11-13 13:11 Saga Musix Note Added: 0002182
2015-11-13 14:23 Saga Musix Note Added: 0002185
2015-11-13 14:23 Saga Musix Status assigned => resolved
2015-11-13 14:23 Saga Musix Resolution open => fixed
2015-11-13 14:23 Saga Musix Product Version => OpenMPT 1.25.03.00 / libopenmpt 0.2-beta15 (upgrade first)
2015-11-13 14:23 Saga Musix Fixed in Version => OpenMPT 1.25.04.00 / libopenmpt 0.2-beta16 (upgrade first)
2015-11-13 14:23 Saga Musix Target Version => OpenMPT 1.25.04.00 / libopenmpt 0.2-beta16 (upgrade first)
2015-11-13 14:23 Saga Musix Summary MP3 ACM encoder misses first few samples => MP3 encoder misses first few samples due to malformed ID3v2.4 tags