# Visual Basic > Visual Basic .NET >  [RESOLVED] MediaInfoDll.vb temporally temperamental

## dunfiddlin

I am trying to incorporate a media info test into an existing media cataloguing program (mkv files), thus ....



```
       For Each fp As String In FileIO.FileSystem.GetFiles(SeriesPath(SeriesList.SelectedIndex), FileIO.SearchOption.SearchAllSubDirectories, {"*.mkv", "*.mp4", "*.avi"})
            EpisodePath.Add(fp) 'not relevant to problem

            sw.Reset() 'stopwatch declared formwide added to monitor problem
            sw.Start()

            info.Open(fp) 'info is formwide MediaInfo object
            info.Option_("Inform", "General;%Audio_Language_List%")

            Dim test As String = info.Inform
            'if Audio track #0 is not English add distinctive marker in list box
            If test.Length > 3 AndAlso test.Substring(0, 3) = "Eng" Then

                EpisodeList.Items.Add(fp.Substring(fp.LastIndexOf("\") + 1, fp.LastIndexOf(".") - fp.LastIndexOf("\")))
            Else
                EpisodeList.Items.Add("**" & fp.Substring(fp.LastIndexOf("\") + 1, fp.LastIndexOf(".") - fp.LastIndexOf("\")))
            End If
            info.Close()
            sw.Stop()
            tb.AppendText(sw.Elapsed.ToString & vbCrLf) 'text box to record stopwatch times
        Next
```

It works as intended but is extremely inconsistent in execution time sometimes literally taking an age. Typical results obtained from the stopwatch I inserted ....

00:00:08.3439203
00:00:06.6966452
00:00:11.5110716
00:00:10.1231502
00:00:09.5855481
00:00:08.7140320
00:00:07.5426060
00:00:11.3585911
00:00:14.4681965
00:00:09.4656555

Change of directory

00:00:01.5973053
00:00:01.3142594

Note that the files in the second directory are generally 0.5 to 1GB longer than in the first which dispels the possibility that file length is a factor particularly as one directory of even longer files produces  ....

00:00:00.8293086
00:00:01.5704835
00:00:00.5504360
00:00:01.2516989
00:00:00.2938937
00:00:00.2614383

Obviously if the processing of just ten files can take over a minute it will be impractical so I would be grateful for any explanation of the sluggardly operation of MediaInfoDLL routines, the extreme variation in processing time for different directories/files etc. and any suggestions for how speed might be improved or variations narrowed.

----------


## dunfiddlin

Should anyone be interested I finally abandoned MediaInfo and replaced it with running ffmpeg as a process (with a hideously complex command line) to obtain the information I need. Although results are not instant it's acceptably fast and constant over all files.

----------

