lamemp3enc

This element encodes raw integer audio into an MPEG-1 layer 3 (MP3) stream. Note that MP3 is not a free format, there are licensing and patent issues to take into consideration. See Ogg/Vorbis for a royalty free (and often higher quality) alternative.

Output sample rate

If no fixed output sample rate is negotiated on the element's src pad, the element will choose an optimal sample rate to resample to internally. For example, a 16-bit 44.1 KHz mono audio stream encoded at 48 kbit will get resampled to 32 KHz. Use filter caps on the src pad to force a particular sample rate.

Example pipelines

 gst-launch-1.0 -v audiotestsrc wave=sine num-buffers=100 ! audioconvert ! lamemp3enc ! filesink location=sine.mp3

Encode a test sine signal to MP3.

 gst-launch-1.0 -v autoaudiosrc ! audioconvert ! lamemp3enc target=bitrate bitrate=192 ! filesink location=alsasrc.mp3

Record from a sound card using ALSA and encode to MP3 with an average bitrate of 192kbps

 gst-launch-1.0 -v filesrc location=music.wav ! decodebin ! audioconvert ! audioresample ! lamemp3enc target=quality quality=0 ! id3v2mux ! filesink location=music.mp3

Transcode from a .wav file to MP3 (the id3v2mux element is optional) with best VBR quality

 gst-launch-1.0 -v cdda://5 ! audioconvert ! lamemp3enc target=bitrate cbr=true bitrate=192 ! filesink location=track5.mp3

Encode Audio CD track 5 to MP3 with a constant bitrate of 192kbps

 gst-launch-1.0 -v audiotestsrc num-buffers=10 ! audio/x-raw,rate=44100,channels=1 ! lamemp3enc target=bitrate cbr=true bitrate=48 ! filesink location=test.mp3

Encode to a fixed sample rate

Hierarchy

GObject
    ╰──GInitiallyUnowned
        ╰──GstObject
            ╰──GstElement
                ╰──GstAudioEncoder
                    ╰──lamemp3enc

Implemented interfaces

GstPreset

Factory details

Authors: – Sebastian Dröge

Classification:Codec/Encoder/Audio

Rank – primary

Plugin – lame

Package – GStreamer Good Plug-ins

Pad Templates

sink

audio/x-raw:
         format: S16LE
         layout: interleaved
           rate: { (int)8000, (int)11025, (int)12000, (int)16000, (int)22050, (int)24000, (int)32000, (int)44100, (int)48000 }
       channels: 1
audio/x-raw:
         format: S16LE
         layout: interleaved
           rate: { (int)8000, (int)11025, (int)12000, (int)16000, (int)22050, (int)24000, (int)32000, (int)44100, (int)48000 }
       channels: 2
   channel-mask: 0x0000000000000003

Presencealways

Directionsink

Object typeGstPad


src

audio/mpeg:
    mpegversion: 1
          layer: 3
           rate: { (int)8000, (int)11025, (int)12000, (int)16000, (int)22050, (int)24000, (int)32000, (int)44100, (int)48000 }
       channels: [ 1, 2 ]

Presencealways

Directionsrc

Object typeGstPad


Properties

bitrate

“bitrate” gint

Bitrate in kbit/sec (Only valid if target is bitrate, for CBR one of 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 or 320)

Flags : Read / Write / Construct

Default value : 128


cbr

“cbr” gboolean

Enforce constant bitrate encoding (Only valid if target is bitrate)

Flags : Read / Write / Construct

Default value : false


encoding-engine-quality

“encoding-engine-quality” GstLameMP3EncEncodingEngineQuality *

Quality/speed of the encoding engine, this does not affect the bitrate!

Flags : Read / Write / Construct

Default value : standard (1)


mono

“mono” gboolean

Enforce mono encoding

Flags : Read / Write / Construct

Default value : false


quality

“quality” gfloat

VBR Quality from 0 to 10, 0 being the best (Only valid if target is quality)

Flags : Read / Write / Construct

Default value : 4


target

“target” GstLameMP3EncTarget *

Optimize for quality or bitrate

Flags : Read / Write / Construct

Default value : quality (0)


Named constants

GstLameMP3EncEncodingEngineQuality

Members

fast (0) – Fast
standard (1) – Standard
high (2) – High

GstLameMP3EncTarget

Members

quality (0) – Quality
bitrate (1) – Bitrate

The results of the search are