Zeugma440 / atldotnet

Fully managed, portable and easy-to-use C# library to read and edit audio data and metadata (tags) from various audio formats, playlists and CUE sheets
MIT License
440 stars 60 forks source link

The `AudioFileIO` reads HEIC file endlessly #263

Closed atamanuk closed 2 months ago

atamanuk commented 2 months ago

The problem

The AudioFileIO reads HEIC file endlessly

Environment

Details

When I'm creating the Track from HEIC file without mimeType, the constructor of AudioFileIO goes into an endless loop and incessantly writes to log:

  {ATL.Logging.Log.LogItem}
    Level: 1
    Location: "in-memory"
    Message: "moov atom could not be found; aborting read"
    When: {22.04.2024 18:43:30}

Code To Reproduce Issue

  var b = File.ReadAllBytes("./2020-08-25 23-23-33.HEIC");
  using var s = new MemoryStream(b);
  var t = new Track(s);
Zeugma440 commented 2 months ago

Thanks for your feedback~

These kind of issues are often specific to a quirk inside the file you're using. Would it be possible to upload it somewhere (e.g. mega, WeTransfer...)?

Thanks in advance

Zeugma440 commented 2 months ago

Plus I just realized HEIC is a picture format. This library is an audio library. Are you sure you're using it correctly?

atamanuk commented 2 months ago

I use the library to find out the type of audio. But sometimes incorrect files are sent to the input. It would be nice if the library would return error or throw exception in this case.

2020-08-25 23-23-33.HEIC.zip

Numpsy commented 2 months ago

fwiw, looks like it gets stuck at https://github.com/Zeugma440/atldotnet/blob/a8e4217e880e2172e08ca5944838bd08542dc7ee/ATL/AudioData/AudioFileIO.cs#L75, because found is always false and alternate doesn't get incremented (the variant of AudioFileIO() that takes a path does exit for comparison)

Zeugma440 commented 2 months ago

Well done @Numpsy, you saved me quite some debugging time 😄

The fix will be available on next release ✅

Zeugma440 commented 2 months ago

Fix is available on today's v5.23