How do you add ReplayGain tags with flacenc?

Asked by CatKiller on 2009-07-09

I can't seem to get a GStreamer pipeline that rips tracks from a cd, performs the ReplayGain analysis, converts the audio to FLAC and tags the file appropriately. I'd like SoundJuicer to be able to do this. I think that this should work, but it doesn't.

audio/x-raw-int,rate=44100,channels=2 ! rganalysis ! flacenc name=enc

gst-launch shows me that rganalysis is spitting out the values, but flacenc doesn't seem to put them in the file. I've generated some tags with SoundKonverter, and metaflac does show these tags if they're there. They just aren't there with this pipeline.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu gst-plugins-good0.10 Edit question
Assignee:
No assignee Edit question
Last query:
2009-07-10
Last reply:
2012-02-11
Ted M Lin (kitlaan) said : #1

flacenc seems to have a restriction that all tags must be set by the time the audio data is fed through. Since the replaygain tags are fed into the pipeline at the very end, flacenc does get them, but ignores them.

It seems the flac spec requires tags to be in the header of the file; since flacenc only handles data in a stream, it can't do anything with the new tags (as they've been "written" out already).

CatKiller (catkiller) said : #2

I came to a similar conclusion after reading this in the rganalysis documentation.

"Because the generated metadata tags become available at the end of streams, downstream muxer and encoder elements are normally unable to save them in their output since they generally save metadata in the file header. Therefore, it is often necessary that applications read the results in a bus event handler for the tag message. Obtaining the values this way is always needed for album processing since the album gain and peak values need to be associated with all tracks of an album, not just the last one."

Is there some way of constructing the pipeline so that the new tags can be written in at the end?

Ted M Lin (kitlaan) said : #3

I've been poking around, and haven't really found a way to do so (even with changing the source code).

In a future version of flacenc, there will be the option of adding metadata padding, which should make adding more metadata less annoying. But it is still a 2-part process: [1] output the file & generate the replaygain values; [2] write the replaygain values to the file.

metaflac --add-replay-gain

Can you help with this problem?

Provide an answer of your own, or ask CatKiller for more information if necessary.

To post a message you must log in.