'Detecting corrupted OGG files

I have recently been converting large batches of WEM files, from a video game. When I use a tool to convert them, it converts them into an OGG file. I then use Audacity to convert them into a WAV file so I can use it practically. When I do batch converting in Audacity, it works, but every once in a while Audacity freezes. This is because Audacity is trying to read a corrupt OGG file, and crashes. This wouldn't be so hard to weed out the corrupt files, if they weren't named after numbers! (e.g. 3147685.ogg) I am used to programming in Java. Is their any program, script, or website I can use to delete the corrupt ogg files, so I can convert the rest to WAVs easily. Please help. Thank You, -Blue



Solution 1:[1]

There is a Linux command called oggz-validate; see manual entry.

I suggest that you install and use it for validating your OGG files. Using the results to trigger deletion of a file is some trivial shell scripting.

If you really need to do this from Java, then use Process.exec(...) to launch it, etcetera.

Solution 2:[2]

For Windows, oggzvalidate.exe is available from liboggz (https://github.com/kfish/liboggz). Even though the latest Visual Studio project is for 2008, I could migrate it to 2019 and compile it with no issue.

It would appear to be the same program/project Stephen C answered with, but working on windows, so the rest of his answer applies.

I'll also add for completeness, you could interface with liboggz using Java.lang.Runtime.loadLibrary() and implement oggzvalidate in java based on the available C source code. But that's probably way more complicated than you want.

Solution 3:[3]

oggz-validate validates only the container, but it does not try to decode contents. You can try instead:

ffmpeg -i file.ogg -f null -err_detect +crccheck+bitstream+buffer+explode+careful+compliant+aggressive -v error -xerror -

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Stephen C
Solution 2 bmargoat
Solution 3 Mitar