Search code examples
linuxgstreameraudio-recordinglame

How do I convert an AAC audio mp4 to mp3 using gstreamer


I want to take the AAC audio track from a mp4 container and encode it as a constant rate mp3 to play on some of my older audio equipment that can't play mp4s or variable bit rate mp3's. I can't seem to get the pipeline right, it always comes out variable rate. Also, is there a better way to be doing this? Here's what I have.

gst-launch filesrc location=/path/to/file.mp4 ! qtdemux name=demux \
demux. ! queue ! faad ! lamemp3enc quality=2 bitrate=192 cbr=true \
! id3v2mux ! filesink location=/path/to/file.mp3

Solution

  • The bit rate doesn't take effect unless you specify a target. You should add target=bitrate to your pipeline.

    gst-launch filesrc location=/path/to/file.mp4 ! qtdemux name=demux \
    demux. ! queue ! faad ! lamemp3enc quality=2 target=bitrate bitrate=192 cbr=true \
    ! id3v2mux ! filesink location=/path/to/file.mp3