I want to check if a audio file to see if its MP3 or FLAC the checks only have to be basic but I want to go beyond simply checking the file extensions
os.path.splitext
Works okay but no good if the file doesn't have an extensions written in or someone passes a file with a fake extension
I've tried but it just returns None
sndhdr.what(file)
I've also tried using magic but it returns 'application/octet-stream' which isn't much use.
magic.from_file(file, mime=True)
I've read Mutagen could be good for this but so far failed to find any function that outputs the audio encoding as MP3 or FLAC