mirror of
https://github.com/matthew1000/gstreamer-cheat-sheet.git
synced 2024-11-21 16:00:59 +00:00
More audio mixing examples
This commit is contained in:
parent
29c6357f2a
commit
b1462c127a
3 changed files with 41 additions and 4 deletions
|
@ -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:
|
||||
|
||||
|
|
12
basics.md
12
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/]
|
||||
|
|
29
mixing.md
29
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.
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue