diff --git a/README.md b/README.md index 7a0cfcd..94d9a85 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ A few Python examples are also included for when you need GStreamer to be dynami ## Sources and references * [Basic command line reference](http://docs.gstreamer.com/display/GstSDK/Basic+tutorial+10%3A+GStreamer+tools) -* [More examples here](http://docs.gstreamer.com/display/GstSDK/gst-launch) +* [Pipeline examples](https://gstreamer.freedesktop.org/documentation/tools/gst-launch.html#pipeline-examples) * [List of all Gstreamer plugins](https://gstreamer.freedesktop.org/documentation/plugins.html) * [Handy elements](https://gstreamer.freedesktop.org/documentation/tutorials/basic/handy-elements.html#uridecodebin) @@ -27,7 +27,7 @@ A few Python examples are also included for when you need GStreamer to be dynami * https://github.com/xmementoit/gstreamerCheatsheet/blob/master/README.md * https://gist.github.com/nebgnahz/26a60cd28f671a8b7f522e80e75a9aa5 -## Interaction +## Interacting with the GStreamer pipeline If you want to interact with GStreamer after it's started (e.g. respond to an event, or dynamically change a pipeline), the command-line GStreamer doesn't really cut it. Instead you have two options: diff --git a/basics.md b/basics.md index e2ba51c..344090f 100644 --- a/basics.md +++ b/basics.md @@ -109,6 +109,18 @@ gst-launch-1.0 filesrc location=$SRC ! \ autovideosink ``` +### Play an MP3 audio file + +Set the environment variable `$AUDIO_SRC` to be the location of the MP3 file. Then: + +``` +# All three of these do the same thing: +gst-launch-1.0 playbin uri=file://$AUDIO_SRC +gst-launch-1.0 -v uridecodebin uri="file://$AUDIO_SRC" ! autoaudiosink +gst-launch-1.0 -v filesrc location=$AUDIO_SRC ! mpegaudioparse ! decodebin ! autoaudiosink +``` + + ### Play files back to back See (https://coaxion.net/blog/2014/08/concatenate-multiple-streams-gaplessly-with-gstreamer/)[https://coaxion.net/blog/2014/08/concatenate-multiple-streams-gaplessly-with-gstreamer/] diff --git a/mixing.md b/mixing.md index 972e4d7..c05f681 100644 --- a/mixing.md +++ b/mixing.md @@ -93,10 +93,35 @@ gst-launch-1.0 \ Use the `audiomixer` element to mix audio. It replaces the `adder` element, which struggles under some circumstances (according to the [GStreamer 1.14 release notes](https://gstreamer.freedesktop.org/releases/1.14/)). -Mix to audio streams: +### Mix two (or more) test streams ``` -gst-launch-1.0 audiotestsrc freq=100 ! audiomixer name=mix ! audioconvert ! alsasink audiotestsrc freq=500 ! mix. +gst-launch-1.0 \ + audiomixer name=mix ! audioconvert ! autoaudiosink \ + audiotestsrc freq=400 ! mix. \ + audiotestsrc freq=600 ! mix. ``` +### Mix two test streams, dynamically + [This Python example](python_examples/audio_dynamic_add.py) shows a dynamic equivalent of this example - the second test source is only mixed when the user presses Enter. + +### Mix two (or more) MP3 files + +``` +gst-launch-1.0 \ + audiomixer name=mix ! audioconvert ! autoaudiosink \ + filesrc location=$AUDIO_SRC ! mpegaudioparse ! decodebin ! mix. \ + filesrc location=$AUDIO_SRC2 ! mpegaudioparse ! decodebin ! mix. +``` + +### Mix a test stream with an MP3 file + +Because the audio streams are from different sources, they must each be passed through `audioconvert`. + +``` +gst-launch-1.0 \ + audiomixer name=mix ! audioconvert ! autoaudiosink \ + audiotestsrc is-live=true freq=400 ! audioconvert ! mix. \ + filesrc location=$AUDIO_SRC ! mpegaudioparse ! decodebin ! audioconvert ! mix. +```