gstreamer-cheat-sheet/test_streams.md

88 lines
2.5 KiB
Markdown
Raw Permalink Normal View History

2018-02-20 12:23:23 +00:00
# Test streams (GStreamer command-line cheat sheet)
2018-04-17 23:00:13 +00:00
## Video test streams
2018-03-25 22:42:24 +00:00
2018-04-17 23:00:13 +00:00
### Display a test pattern
The `videotestsrc` element creates test patterns. Display locally like this:
2018-02-20 12:23:23 +00:00
```
gst-launch-1.0 videotestsrc ! videoconvert ! autovideosink
```
2018-03-20 08:18:38 +00:00
This should display the test pattern in a window, that looks a
2018-02-20 13:12:12 +00:00
bit like this:
![Test pattern window](images/test-pattern.png "Test pattern window")
2018-03-20 08:18:38 +00:00
There are multiple test patterns available, such as:
2018-02-20 13:12:12 +00:00
2018-02-20 13:14:22 +00:00
| Pattern | Example |
| ------------- |:-------------:|
2018-02-20 13:13:44 +00:00
| `videotestsrc pattern=snow` | ![](images/test_snow.png) |
| `videotestsrc pattern=red` (and blue, green, white and black) | ![](images/test_red.png) |
2018-02-20 13:15:58 +00:00
| `videotestsrc pattern=pinwheel` | ![](images/test_pinwheel.png) |
| `videotestsrc pattern=smpte100` (color test bars) | ![](images/test_smpte100.png) |
| `videotestsrc pattern=colors` | ![](images/test_colors.png) |
2018-02-20 13:12:12 +00:00
For the full list of patterns, see https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-videotestsrc.html
2018-03-20 08:18:38 +00:00
### Change the shape of a test pattern
To change the width and/or height, pass width and height immediately afterwards, e.g.
```
gst-launch-1.0 -v videotestsrc pattern=snow ! video/x-raw,width=1280,height=720 ! autovideosink
```
2018-03-25 22:42:24 +00:00
## Audio test streams
### Listen to a test audio (beep)
2018-02-20 12:23:23 +00:00
2018-04-17 23:00:13 +00:00
The element `audiotestsrc` can make a variety of test sounds:
2018-02-20 12:23:23 +00:00
```
2018-03-25 22:42:24 +00:00
gst-launch-1.0 audiotestsrc ! autoaudiosink
```
You can change the pitch using the `freq` property:
```
# This creates a higher beep:
gst-launch-1.0 audiotestsrc freq=1000 ! autoaudiosink
```
The [mixing page](./mixing.md) shows how two different frequency audio test streams can be mixed together.
You can change the *volume* by setting the `volume` property between `0` and `1`. E.g. for a quiet beep:
```
gst-launch-1.0 audiotestsrc volume=0.1 ! autoaudiosink
```
2022-07-20 20:31:01 +00:00
### White noise
2018-03-25 22:42:24 +00:00
2018-04-17 23:00:13 +00:00
Set `wave` to `white-noise`:
2018-03-25 22:42:24 +00:00
```
gst-launch-1.0 audiotestsrc wave="white-noise" ! autoaudiosink
```
There are variations (e.g. _red noise_) - see the [docs](https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-audiotestsrc.html) for a complete list.
2022-07-20 20:31:01 +00:00
### Silence
2018-03-25 22:42:24 +00:00
If you need an audio stream with nothing in:
```
gst-launch-1.0 audiotestsrc wave="silence" ! autoaudiosink
2018-02-20 12:23:23 +00:00
```
2018-03-25 22:42:24 +00:00
## Combining audio and video test streams
2018-03-20 08:18:38 +00:00
2018-02-20 12:23:23 +00:00
Combine both the test pattern and test audio:
```
gst-launch-1.0 audiotestsrc ! autoaudiosink videotestsrc ! autovideosink
```