flacenc: produces empty SEEKTABLE metadata block (when source is .wav)
When converting from .wav to .flac using a GStreamer-based tool (SoundConverter), I was having an issue where some programs (such as Lollypop and Quod Libet) would recognize the Vorbis tags I was adding with another tool (Kid3), but other programs (including KDE Elisa and Dolphin) would not recognize any tags or cover art that I added to the files. I tried using different tools to change the tags, and nothing seemed to make the tags in the "non-working" files get recognized by those programs.
After comparing a "working" flac file exported from Audacity with a "non-working" flac file created with gst-launch-1.0 (flacenc), I've narrowed down the issue to the SEEKTABLE metadata block that flacenc is adding:
metaflac --list --block-type=STREAMINFO,PADDING,APPLICATION,SEEKTABLE,VORBIS_COMMENT ./bad-file.flac
...
METADATA block #1
type: 3 (SEEKTABLE)
is last: false
length: 0
seek points: 0
...
The Audacity flac file did not have a seektable, so I tried deleting the SEEKTABLE block with metaflac --remove --block-type=SEEKTABLE
, and Dolphin immediately recognized the cover art I had previously added to the file. Looking further, a file created with the "flac" command does have a seektable with 9 seek points by default, and its tags are recognized by the programs in question.
While it seems some particular programs (or the libraries they're using) are less resilient than others, it also seems like a mistake for there to be a seektable of length 0 with 0 seek points. I tried using the "seekpoints" option with flacenc/gst-launch-1.0, and no matter if I set the seekpoints to 1, 9, 23, -3, -13, or any non-zero number, I always get the above seektable with 0 seek points. The only way to produce a fully working file is by using seekpoints=0
, in which case there is no seekpoints block in the resulting file and all of my programs are able to read its tags.
Seems like this part of the code deals with seekpoints? https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/blob/master/ext/flac/gstflacenc.c#L701
Edit: A SEEKTABLE block does not appear to get created when I'm converting an mp3 file to flac. It does happen any time the source is a wav file, testing with multiple unrelated wav files.