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
459 stars 61 forks source link

Unable to handle large audio,OutOfMemory #196

Closed FantasyGmm closed 1 year ago

FantasyGmm commented 1 year ago

The problem

I use ATL to batch process song tags, and in most cases, it works normally until it encounters a large lossless file (such as 96KHz24Bit 110MB), which it cannot read and prompts' System. OutOfMemoryException ' Some tags can be read, but some custom tags cannot be read. When I try to read them, I will output some garbled code, and the program has crashed

Environment

Code To Reproduce Issue [ Good To Have ]

        var theTrack = new Track(url);
        var fileName = Path.GetFileNameWithoutExtension(url);
        if (Config.DEBUG_LOG && !isBatch)
        {
            LogDebug($"{fileName}-Title : {theTrack.Title}");
            LogDebug($"{fileName}-Artist : {theTrack.Artist}");
            LogDebug($"{fileName}-Album : {theTrack.Album}");
            LogDebug($"{fileName}-Recording year : {theTrack.Year}");
            LogDebug($"{fileName}-Track number : {theTrack.TrackNumber}");
            LogDebug($"{fileName}-Disc number : {theTrack.DiscNumber}");
            LogDebug($"{fileName}-Comment : {theTrack.Comment}");
            LogDebug($"{fileName}-Duration (s) : {theTrack.Duration}");
            LogDebug($"{fileName}-Bitrate (KBps) : {theTrack.Bitrate}");
            LogDebug($"{fileName}-Number of channels : {theTrack.ChannelsArrangement.NbChannels}");
            LogDebug($"{fileName}-Channels arrangement : {theTrack.ChannelsArrangement.Description}");
            LogDebug($"{fileName}-Has variable bitrate audio : {(theTrack.IsVBR ? "yes" : "no")}");
            LogDebug($"{fileName}-Has lossless audio : {(AudioDataIOFactory.CF_LOSSLESS == theTrack.CodecFamily ? "yes" : "no")}");

            foreach (KeyValuePair<string, string> field in theTrack.AdditionalFields)
            {
                LogDebug($"{fileName}-Custom field {field.Key} : value = {field.Value}");
            }
        }
Zeugma440 commented 1 year ago

Hi and thanks for your feedback.

ATL can process files much larger than 110MB. There's probably an issue with the file you're using.

Could you send it to me using a 3rd party cloud (e.g. Google Drive, Mega, DropBox...) ?

Thanks in advance~

FantasyGmm commented 1 year ago

It may be a problem with Mora's tag, but the source file contains user info,I used FB2K to change the numbers to the same, but the number of digits did not change This is the software I wrote using this library This is the music I bought from Mora,After closing the issue, I will delete it

Zeugma440 commented 1 year ago

Unfortunately, I can't reproduce your issue with the code and the file you provided. Everything runs fine and the debugger shows 12MB max memory usage.

image

Are you sure you provided me with the correct file?

What's more, the link you provided to https://github.com/FantasyGmm/MoraAudioModify doesn't work. Is it a private repo?

FantasyGmm commented 1 year ago

Sorry, I forgot he's a private. I'll make it public instead The file modified using FB2K can be read normally, but if it is a downloaded source file, it cannot be read. Can you provide me with an email so that I can send the source file to you via email This is when I tried to load the audio, I made a breakpoint on line 127 of Program.cs img

Zeugma440 commented 1 year ago

Can you provide me with an email so that I can send the source file to you via email

You can contact me at [my github username] at [not-cold] mail [dot] com

FantasyGmm commented 1 year ago

Okay, I sent it to you

Zeugma440 commented 1 year ago

Thanks for your help. The problem has been fixed and the fix published in today's v4.33.

FantasyGmm commented 1 year ago

Thank you for your code