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

ESP crashes during playing local MP3 file with ID3 Tag v2.2 #460

Closed
anp59 opened this issue Jan 10, 2023 · 7 comments
Closed

ESP crashes during playing local MP3 file with ID3 Tag v2.2 #460

anp59 opened this issue Jan 10, 2023 · 7 comments
Labels
wontfix This will not be worked on

Comments

@anp59
Copy link

anp59 commented Jan 10, 2023

Hi,
during a test I noticed that local MP3 files with ID3 tags v2.2 cause the programme to crash. With common Windows players these files are played correctly.
This error was tested with the standard example, both with and without SdFat support. The test file is attached.
test1.zip

Perhaps you can investigate this error in more detail when you get the chance.
Many thanks in advance.

LOG
info PSRAM not found, inputBufferSize: 6399 bytes
info buffers freed, free Heap: 238520 bytes
info Reading file: "/test1.mp3"
info MP3Decoder has been initialized, free Heap: 210704 bytes
info Content-Length: 4209541
info ID3 framesSize: 112444
info ID3 version: 2.2
id3data Title/Songname/Content description: La mamma morta
id3data Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group: Callas
id3data Track number/Position in set: 1
id3data Content type: (103)P
id3data Attached picture: PNG
Guru Meditation Error: Core 1 panic'ed (InstrFetchProhibited). Exception was unhandled.

schreibfaul1 added a commit that referenced this issue Jan 11, 2023
fix ESP crashes during playing local MP3 file with ID3 Tag v2.2 #460
@schreibfaul1
Copy link
Owner

Hello @anp59,
strange, no one noticed the error before. MP3 files with ID3V2.2 and embedded image are rare. I hadn't considered the APIC and so the MP3 decoder was served the image data. After the image data, there is more metadata that is now read out correctly. Only then does the MP3 decoder come into play.
Many greetings
Wolle

@anp59
Copy link
Author

anp59 commented Jan 11, 2023

Hi,
thanks for the quick error correction. Good job!
I have tested it with 3 files - all are played. One small thing was noticed with 2 files. At the end an MP3 decode error -1 : INDATA_UNDERFLOW is displayed.

Here is the log and a test file:
info PSRAM not found, inputBufferSize: 6399 bytes
info buffers freed, free Heap: 239352 bytes
info Reading file: "/test2.mp3"
info MP3Decoder has been initialized, free Heap: 211536 bytes
info Content-Length: 5372698
info ID3 framesSize: 112444
info ID3 version: 2.2
id3data Title/Songname/Content description: Surta e la notte 1
id3data Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group: Callas
id3data Track number/Position in set: 1
id3data Content type: (103)P
id3data Album/Movie/Show title: La Divina
id3data BPM (Beats Per Minute): 140
info Audio-Length: 5260254
info stream ready
info syncword found at pos 0
info Channels: 2
info SampleRate: 44100
info BitsPerSample: 16
info BitRate: 112000
info MP3 decode error -1 : INDATA_UNDERFLOW
info syncword not found
info Closing audio file
info End of file "test2.mp3"
eof_mp3 test2.mp3

test2.zip

Kind regards
Andreas

@schreibfaul1
Copy link
Owner

The error message comes at the end of the file. The file has a constant bit rate throughout. This means that all mp3 frames must have the same length (can vary by 1, depending on the padding bit). Everything is fine in test1.mp3. The last mp3 frame of the test2.mp3 file is too short. You can calculate how long the frame has to be: 144bitrate/samplerate. 144112000/44100 ~ 365 Bytes. Of these, 23 are in the frame header, leaving 342 for the audio data. I watched that in a hex exitor.
I marked the frame header. The red is the syncword and the yellow is the heder information. The last frame should also be 342 bytes long, but it isn't. I think the easiest will be to edit the file with an audio tool.
image

@anp59
Copy link
Author

anp59 commented Jan 12, 2023

Ok. Now I know the cause and can edit the file if necessary. Without changes, it also works, you don't hear the error message :-).
The original problem is closed with this and can be closed.
Thank you very much and best regards!

@schreibfaul1
Copy link
Owner

Most commercial audio players like VLC or Celluloid are fault tolerant. You can use a hex editor to erase the last incomplete frame with no problem and everything works fine.
If you discover further problems, you are welcome to let us know, there are certainly still some errors or deficiencies undiscovered.

@khvolk
Copy link

khvolk commented Feb 28, 2023

I have a slightly different problem: I have two local mp3 files which do not play at all. When the playback starts you see only the meta-data in monitor. No sound. These files have the CD-cover as local stream embedded.

ffmpeg:
...
Duration: 00:06:14.39, start: 0.000000, bitrate: 128 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s
Stream #0:1: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 300x298 [SAR 1:1 DAR 150:149], 90k tbr, 90k tbn (attached pic)

@stale
Copy link

stale bot commented May 15, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label May 15, 2023
@stale stale bot closed this as completed Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants