(Download the script here: reflac.sh)

Problem

When using oggenc to convert a FLAC file to OGG Vorbis using oggenc, you might encounter the following error:

"ERROR: Input file <file> is not a supported format"

Explanation

One possible reason for this can be an ID3 tag in the flac file. This can happen if the program you used to create your FLAC files uses ID3 tags instead of native FLAC tags to store metadata.

You can confirm this by typing the following:

flac --ogg enc <file>

which would then output something like this:

ERROR: input file <file> has an ID3v2 tag

If this is the problem you are having, then the following should help you

Bad “Solutions”

The “solutions” I found on the web have drawbacks that I could not accept.

The first “solution” is to just rip the CD again with a different software or different options. This is annoying, because you need to go through the whole process again and ripping a CD can take a long time, depending on how you do it.

Another “solution” is to convert your FLACs to WAV files and then either to OGG or back to FLAC (to get “repaired” FLACs you can now use with oggenc). The drawback of this approach is that all the metadata gets lost during the conversion from FLAC to WAV, because WAV files can not hold metadata.

I am using quotes (“solution”) to make clear that I don’t really consider them solutions to the problem, because the amount of work that would be required makes them practically useless for large collections.

Solution

The “only” problem with the second “solution” is the lost metadata. Other than that the solution works fine. Fortunately it is possible to solve the problem by using a command line tool that is already installed with flac, but that most people don’t seem to know about: metaflac.

Metaflac can extract metadata from a FLAC file and add metadata to a FLAC file as well. Therefore, all we need to do is:

  1. extract the metadata using metaflac
  2. decode the FLAC to a WAV file
  3. encode the WAV file back to FLAC
  4. import the metadata using metaflac into the new FLAC file

Using a script to “repair” the FLACs

Because this is pretty annoying by hand, I wrote a script named “reflac”. You can either use the script in a terminal or “integrate” it with Nautilus.

Downloading the script

You can download the script here: reflac.sh

Using the script from the command line

The script can be used like this:

reflac.sh <flac file>...

Example 1:

refla.shc foo.flac bar.flac

Example 2:

reflac.sh *.flac

It just goes through the four steps for every file you throw at it.

Adding the script to Nautilus

If you don’t like the terminal that much, you can also use the script directly from Nautilus. Just copy the script to the folder ~/.gnome2/nautilus-scripts/ (To copy the script to this location from within Nautilus, download the script

Just as a disclaimer: This is a quick & dirty script I wrote and I don’t really see something in it that could go horribly wrong. Nevertheless, there is ALWAYS a risk when using software, so backing up your data is YOUR responsibility. And always keep in mind: “If it’s worth saving, it’s worth backing up!”.

Download

Download the script here: reflac.sh

 

  7 Responses to ““ERROR: Input file is not a supported format” when using oggenc to convert a FLAC to OGG Vorbis”

  1. Hey, I tried out your script and it works great. Thanks a bunch for doing this!

    • Thanks a lot. I hope I can work on it a bit next month. If you find anything you might think should be added, I am always happy to see what others might need/want and how/for what they use it.

  2. Hello, and thanks for this information.

    I solved the problem without any decoding/encondig this way:

    metaflac --export-tags-to="${FLAC}.meta" "${FLAC}"
    id3v2 --delete-all "${FLAC}"
    metaflac --import-tags-from="${FLAC}.meta" "${FLAC}"
    rm "${FLAC}.meta"

    Yes, there’s an extra dependency, but I think it’s worth.

    Regards,
    Norberto

    • Thanks for sharing. That is definitely a better solution. I don’t care about the extra dependency, either. And I have id3v2 installed anyway. Luckily all my problem-FLACs are long gone, but I think it’s time to update the script anyway.

  3. Thanks. :) Super little script.

  4. But isn’t that actually a bug in oggenc (at least the error message is misleading)?

  5. Thanks for the script

Leave a Reply to nbensa Cancel reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>