[flac-dev] libFLAC optimizations request

Gabriel Corneanu gabrielcorneanu at gmail.com
Mon Feb 5 09:19:55 UTC 2018


Hi,

On Sun, Feb 4, 2018 at 11:50 PM, Brian Willoughby
<brianw at audiobanshee.com> wrote:
> I wasn’t suggesting that you run metaflac, but that you examine its source to see how it creates new FLAC files without the Vorbis comment. As far as I know, metaflac uses the standard libFLAC and creates files without the Vorbis overhead.

Without reading the sources, I simply assume that metaflac is parsing
the metadata blocks and filtering as required. Of course it is
possible with libFLAC, but the overhead is huge (parse stream, filter,
save back, etc) compared to simply not generating it.

> My quick review of the source seemed to indicate that calling FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT) will create the comment, but I assumed that you could pass in NULL. I mistakenly thought that was FLAC__stream_encoder_new().

The comment is auto-generated in "init_stream_internal_", called from
all _init functions. I am NOT explicitly creating any metadata object.

> There is a comment saying that the Ogg FLAC mapping requires a VORBIS_COMMENT, but that doesn’t necessarily mean that standard FLAC also requires the Vorbis comment.

That's what I thought, maybe if the target is NOT Ogg we could by
default not generate the comment; the user can still explicitly
generate it.

> Looking around metaflac sources, I see FLAC__metadata_iterator_delete_block(iterator, options->use_padding), which might be the code responsible for removing the Vorbis comment.
>
> In other words, perhaps there is no existing way to avoid having the encoder create the Vorbis comment metadata, but there might be a way to delete that particular metadata before the file is saved. A closer look at how metaflac creates a file without Vorbis comments should help.
>
> Brian
>

I will create a PR with my suggestions.

Gabriel


More information about the flac-dev mailing list