1

I have 120,000 MIDI files. A couple hundred of them are corrupted. So far I have been able to identify some of those, playing them one by one with two different media players (Foobar 2000 and Van Basco's Karaoke Player). Both players report that the file can't be played because is corrupted.

Since I'm talking about hundreds of files, it is very time-consuming doing it that way. I'm not necessarily looking to fix them, I just want to identify them. Is there a way to identify corrupted MIDI files in batch?

I can work with Linux or Microsoft Windows. I can't use MacOS though.

Kamil Maciorowski
  • 69,815
  • 22
  • 136
  • 202
3d1l
  • 323
  • 1
  • 7
  • 21
  • 2
    Software requests are off-topic on Super User. You may want to stick with "methods". Also, you may want to describe the results you've already investigated and why those solutions were unsuitable. – Anaksunaman May 21 '22 at 03:46
  • Great on-topic superuser question. Too bad it will never get any answers. – superuser May 23 '22 at 16:52
  • If those media players can be scripted, then I'd imagine you can open each file to play a few seconds worth, and if they return an error you'd capture that. So, have you tried scripting those players yet? – music2myear May 24 '22 at 05:15

1 Answers1

1

Wanted to at least give you something to try.

Try using the file command. I created a fake midi for comparison on output.

file *.mid 

OR

file -i *.mid

fake_rename.mid: XML 1.0 document, Unicode text, UTF-8 text, with very long lines (65359), with no line terminators MIDI_sample.mid: Standard MIDI data (format 1) using 6 tracks at 1/480

Creating a one-liner or script to move/remove bad files will take a little work.

Found this one-liner that can possibly be modified to fit MIDI

find <your_recovery_drive_mount_point> -iname '*.mp3' | while read f; do echo "mplayer -ss 10 -endpos 1  '${f}' | grep -iq failed && echo '${f}' >> bad.lst" >> check.sh ; done

How can I find and delete corrupt files on Linux?

Czar
  • 254
  • 1
  • 2
  • 1
    Czar I was not able to make it work with your option but you point me in the right direction. When you tell Foobar2000 to load all the MIDI files from a directory, it first scan the files and creates a report that identify those that are not valid MIDI files. Foobar2000 have an option that allow you to view those errors and save that report to a file. You gave me the idea, thanks! – 3d1l May 22 '22 at 03:28