I have a bunch of mp3 files, of which some got cut short (due to an unfinished download or something). I want to determine the good from the bad (i.e. the ones that cut off in the middle). There's a few possibilities listed in answers to related questions, e.g.
- Detect truncated mp3 or ogg files
- Is there a tool that can detect (and if possible, fix) glitches in MP3 files?
that use metadata to determine if length does not match what it's supposed to (and find and correct other errors). There's a few tools that can be used for this, such as mp3val, mp3check and mp3diags (all of which were available to me via apt-get in Ubuntu repositories and looked promising and easy to use), as well as checkmate (which I didn't try).
However, none of these worked in my case because apparently all the files appeared to have metadata errors. So that left me manually listening to the end of each to see if it trailed off correctly or was obviously cut short. Is there anyway to do something like this automatically (listen for abrupt sound cutoff) for a large number of files?
I found at least one way (which I'll post as an answer). Obviously this whole approach is based on an assumption and will depend on the nature of the mp3 files in question - namely whether or not they are expected to end in silence. However, I expect that would be true for most people with this general problem, so it seemed a useful route to examine and post for others who may have the same issue.