swfmill icon indicating copy to clipboard operation
swfmill copied to clipboard

Import MP3s gaplessly

Open djcsdy opened this issue 14 years ago • 0 comments

When importing MP3s, read encoder delay and padding information from Xing/Info tag (and equivalents for other encoders) in order to embed the MP3 gaplessly. It will also be necessary to discard broken MP3 frames, ID3 tags and other junk data.

  • The samples attribute of DefineSound needs to be set to the length of the original audio, which can be calculated as frames * frame_length - encoder_delay - padding.
  • The first two bytes of sound data (SeekSamples) form a 16-bit signed integer, which is currently always 0. Instead, it should be set to encoder_delay + decoder_delay.

Flash uses the Fraunhofer decoder internally, so decoder_delay is 529 samples.

I’ve written some code to do this in the Flex compiler, which can be adapted: https://github.com/djcsdy/flex-extensions/blob/master/src/net/noiseinstitute/flexextensions/compiler/media/mp3/MP3TranscodeJob.java

djcsdy avatar Nov 09 '11 05:11 djcsdy