mirror of
https://github.com/matthew1000/gstreamer-cheat-sheet.git
synced 2024-11-24 01:01:01 +00:00
Move to compositor and add audio example
This commit is contained in:
parent
d12138e065
commit
c48760ecab
1 changed files with 29 additions and 3 deletions
32
mixing.md
32
mixing.md
|
@ -1,5 +1,9 @@
|
|||
# Mixing video (GStreamer command-line cheat sheet)
|
||||
|
||||
The element `compositor` allows video to be mixed (overlayed, put side-by-side, etc).
|
||||
|
||||
The older `videomixer` element can be used instead, and takes the same arguments as `compositor` so it's easy to swap between them. However, `videomixer` is apparently inferior in some situations, such as for live streams.
|
||||
|
||||
### Picture in picture
|
||||
|
||||
Here we have two source (mp4) files, which should be set as environment variables `$SRC` and `$SRC2`
|
||||
|
@ -9,7 +13,7 @@ gst-launch-1.0 \
|
|||
filesrc location="$SRC2" ! \
|
||||
decodebin ! videoconvert ! \
|
||||
videoscale ! video/x-raw,width=640,height=360 ! \
|
||||
videomixer name=mix sink_0::alpha=1 sink_1::alpha=1 ! \
|
||||
compositor name=mix sink_0::alpha=1 sink_1::alpha=1 ! \
|
||||
videoconvert ! autovideosink \
|
||||
filesrc location="$SRC" ! \
|
||||
decodebin ! videoconvert ! \
|
||||
|
@ -24,7 +28,7 @@ gst-launch-1.0 \
|
|||
filesrc location="$SRC2" ! \
|
||||
decodebin ! videoconvert ! \
|
||||
videoscale ! video/x-raw,width=640,height=360 ! \
|
||||
videomixer name=mix sink_0::alpha=1 sink_1::alpha=1 ! \
|
||||
compositor name=mix sink_0::alpha=1 sink_1::alpha=1 ! \
|
||||
videoconvert ! autovideosink \
|
||||
filesrc location="$SRC" ! \
|
||||
decodebin ! videoconvert ! \
|
||||
|
@ -40,7 +44,7 @@ gst-launch-1.0 \
|
|||
filesrc location="$SRC2" ! \
|
||||
decodebin ! videoconvert ! \
|
||||
videoscale ! video/x-raw,width=640,height=360 ! \
|
||||
videomixer name=mix sink_0::alpha=1 sink_1::alpha=1 sink_1::xpos=50 sink_1::ypos=50 ! \
|
||||
compositor name=mix sink_0::alpha=1 sink_1::alpha=1 sink_1::xpos=50 sink_1::ypos=50 ! \
|
||||
videoconvert ! autovideosink \
|
||||
filesrc location="$SRC" ! \
|
||||
decodebin ! videoconvert ! \
|
||||
|
@ -48,3 +52,25 @@ gst-launch-1.0 \
|
|||
mix.
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Add audio by demuxing the inputs so it can be handled separately. This example does so on the first source (rather than mixing the two together):
|
||||
|
||||
```
|
||||
gst-launch-1.0 \
|
||||
filesrc location="$SRC" ! \
|
||||
qtdemux name=demux demux.audio_0 ! queue ! decodebin ! audioconvert ! audioresample ! \
|
||||
autoaudiosink \
|
||||
demux.video_0 ! queue ! \
|
||||
decodebin ! videoconvert ! \
|
||||
videoscale ! video/x-raw,width=640,height=360 ! \
|
||||
compositor name=mix sink_0::alpha=1 sink_1::alpha=1 sink_1::xpos=50 sink_1::ypos=50 ! \
|
||||
videoconvert ! autovideosink \
|
||||
filesrc location="$SRC2" ! \
|
||||
decodebin ! videoconvert ! \
|
||||
videoscale ! video/x-raw,width=320,height=180! \
|
||||
mix.
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue