Skip to content

Instantly share code, notes, and snippets.

@wkf
Last active November 16, 2023 09:22
Show Gist options
  • Save wkf/5658578 to your computer and use it in GitHub Desktop.
Save wkf/5658578 to your computer and use it in GitHub Desktop.
Use gstreamer to generate raw LPCM audio files
requirements:
brew: http://mxcl.github.io/homebrew/
xquartz: https://xquartz.macosforge.org/landing/
brew install mad
brew install gstreamer
brew install gst-plugins-base
brew install gst-plugins-good
brew install gst-plugins-ugly
test pipeline (should just play a tone):
gst-launch-1.0 audiotestsrc ! audioconvert ! osxaudiosink
write out audio file to disk (using same tone):
gst-launch-1.0 audiotestsrc ! audioconvert ! capsfilter caps = "audio/x-raw,format=F32BE,channels=1,rate=44100" ! filesink location = "audio.raw"
read audio file from disk (should play the same tone):
gst-launch-1.0 filesrc location = "audio.raw" ! capsfilter caps = "audio/x-raw,format=F32BE,channels=1,rate=44100" ! audioconvert ! osxaudiosink
decode mp3 and write to disk:
gst-launch-1.0 filesrc location = shake.mp3 ! decodebin ! audioconvert ! capsfilter caps = "audio/x-raw,format=F32BE,channels=1,rate=44100" ! filesink location = "audio.raw"
@jay-uchenna
Copy link

jay-uchenna commented Nov 16, 2023

@CAMOBAP did you find a way to encode/parse audio/x-raw to audio/x-lpcm in order to perform a successful link with elements which require audio/x-lpcm cap like mpegtsmux?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment