[gst-devel] Normalization, audio properties

Sam Thursfield ssssam at gmail.com
Mon May 29 09:26:07 CEST 2006


Hi
I have a couple of questions about gstreamer ! The first one is about:
the properties of audio files. I'd like to find out the bitrate,
samplerate and number of channels of some mp3 and ogg files. I'm going
to PAUSED and reading all the tag messages, but it seems the mad
plugin isn't often sending samplerate or bitrate tags. And neither
plugin sends me anything about the number of channels. Is there
another way to find out these properties?  Certainly it should be
possible to count the channels being sent but I can't see how. Is the
mp3 plugin simply broken that it's not always sending any bitrate and
samplerate tags ?

The other question is about normalize/replaygain. I've searched the
mailing lists but I can't see much helpful info. It seems it's up to
me to act on the replaygain tags instead of gstreamer, which I can
understand though it would be nice in the future if they could be
handled in the pipeline. There doesn't seem to be any plugin who can
take an audiostream and calculate the gain and peak. It wouldn't be
hard to code because you could just rip out the guts of normalize or
some such. I would have thought album gains could be calculated
outside of gstreamer once all the track gains for an album are known.
They could then be fed to a tag_setter or dealt with by the
application. If there's nothing like this I'll get to and write it,
but I wanted to check a) there's nothing that does this already and b)
this is the best way to go about it.

I also had an issue with gst_element_get_state which I might as well
bring up. The code:
gst_element_get_state(GST_ELEMENT(pipeline), &state, NULL, 5*GST_SECOND)
as used in the metadata example doesn't work. Specifically for a
series of ogg vorbis files, the tags are read for the first file and
ignored for the rest. I really couldn't work out why. I found that:
while (GST_STATE(pipeline)!=GST_STATE_PAUSED) ;
would work perfectly. In the end I've settled on

    int timeout=5;
    while (sret==GST_STATE_CHANGE_ASYNC && state!=GST_STATE_PAUSED &&
is_audio!=FALSE && timeout>0) {
        sret=gst_element_get_state(GST_ELEMENT(pipeline), NULL, NULL,
1*GST_SECOND);
        timeout--;
    }

as used in the rhythmbox tagging code. I'd like to know if this is a
known issue though and what the hell we can do about it.

Thanks for any help with all this junk
sam



- normalize
- bitrate, channels




More information about the gstreamer-devel mailing list