AydinAdn / MediaToolkit

A .NET library to convert and process all your video & audio files.
MIT License
648 stars 199 forks source link

Out of bounds issue #92

Open hassanrazakhalid opened 5 years ago

hassanrazakhalid commented 5 years ago

hi i just tried this. the code im using 1.1.0.1 in dotnet core

var inputFile = new MediaFile { Filename = temp_path };

                //var engine = new engine();
                using (var engine = new Engine("/Volumes/Data/hardstone_projects/xtheia_2.2/xtheiaWeb/ffmpeg.exe"))
                {
                    engine.GetMetadata(inputFile);
                }
                var duration = inputFile.Metadata.Duration;

But i am getting expection Index was out of range. Must be non-negative and less than the size of the collection.\nParameter name: index Please help

it14118 commented 5 years ago

Greetings, could you provide more details? It seems that in the first line of code you are providing Filename is not defined.

mustelan commented 5 years ago

I have the same exception. I analyzed code and I suppose that line:

throw new Exception(
                        this.FFmpegProcess.ExitCode + ": " + receivedMessagesLog[1] + receivedMessagesLog[0],
                        caughtException);

in https://github.com/AydinAdn/MediaToolkit/blob/cb21861bcccc4d5f8c7557d21d823ed68e4d85ef/MediaToolkit%20src/MediaToolkit/Engine.cs#L219 can be problematic.

In my opinion there is a chance that: https://github.com/AydinAdn/MediaToolkit/blob/cb21861bcccc4d5f8c7557d21d823ed68e4d85ef/MediaToolkit%20src/MediaToolkit/Engine.cs#L221 has no elements (or has only one element) and there is not possible to build exception message correctly. To sum up - a main exception can be hidden by a negligible exception.

hassanrazakhalid commented 5 years ago

I tried TagLib with exact same path... It is working fine