跳转至

GStreamer 相关命令工具

编译完毕或者安装 GStreamer 后会存在一些命令工具:

gst-device-monitor-1.0 gst-inspect-1.0 gst-play-1.0 gst-tester-1.0 gst-typefind-1.0

gst-discoverer-1.0 gst-launch-1.0 gst-stats-1.0 gst-transcoder-1.0

使用率比较高的:

gst-inspect-1.0, gst-launch-1.0gst-play-1.0

版本确认:

hywelstar@hywelstar-virtual-machine:~$ gst-device-monitor-1.0 --version
gst-device-monitor-1.0 version 1.20.1
GStreamer 1.20.3
https://launchpad.net/distros/ubuntu/+source/gst-plugins-base1.0

## 1. gst-device-monitor-1.0

hywelstar@hywelstar-virtual-machine:~$ gst-device-monitor-1.0 --help
Usage:
  gst-device-monitor-1.0 [OPTION…] [DEVICE_CLASSES[:FILTER_CAPS]] [DEVICE_CLASSES[:FILTER_CAPS]] …

Help Options:
  -h, --help                        Show help options
  --help-all                        Show all help options
  --help-gst                        Show GStreamer Options

Application Options:
  --version                         Print version information and exit
  -f, --follow                      Don't exit after showing the initial device list, but wait for devices to added/removed.
  -i, --include-hidden              Include devices from hidden device providers.

gst-device-monitor-1.0 --help 简单的命令行测试工具 GStreamer 设备监视器

2. gst-inspect-1.0

gst-inspect-1.0 命令用于查询插件列表,指定插件或者元素信息;

此命令使用率较高,比如查看某个元件的详细信息使用方法,属性,支持的参数;

hywelstar@hywelstar-virtual-machine:~$ gst-inspect-1.0 --help
Usage:
  gst-inspect-1.0 [OPTION…] [ELEMENT-NAME | PLUGIN-NAME]

Help Options:
  -h, --help                           Show help options
  --help-all                           Show all help options
  --help-gst                           Show GStreamer Options

Application Options:
  -a, --print-all                      Print all elements
  -b, --print-blacklist                Print list of blacklisted files
  --print-plugin-auto-install-info     Print a machine-parsable list of features the specified plugin or all plugins provide.
                                       Useful in connection with external automatic plugin installation mechanisms
  --plugin                             List the plugin contents
  -t, --types                          A slashes ('/') separated list of types of elements (also known as klass) to list. (unordered)
  --exists                             Check if the specified element or plugin exists
  --atleast-version                    When checking if an element or plugin exists, also check that its version is at least the version specified
  -u, --uri-handlers                   Print supported URI schemes, with the elements that implement them
  --no-colors                          Disable colors in output. You can also achieve the same by setting 'GST_INSPECT_NO_COLORS' environment variable to any value.
  --sort=<sort-key>                    Sort plugins and features. Sorting keys: name (default), none.
  -C, --color                          Color output, even when not sending to a tty.
  --version                            Print version information and exit
#查询元素的属性信息
gst-inspect-1.0 <element-name>

hywelstar@hywelstar-virtual-machine:~$ gst-inspect-1.0 audioconvert
...<省略很多>

3. gst-play-1.0

gst-play-1.0 用于播放多媒体文件或流。它是一个简单的播放器,可以通过命令行选项来控制播放行为。

# 播放本地文件
gst-play-1.0 <file>
gst-play-1.0 video.mp4

# 播放网络流
gst-play-1.0 <url>
gst-play-1.0 rtsp://example.com/stream

# 指定视频和音频输出设备
gst-play-1.0 <file> --videosink=<sink> --audiosink=<sink>

# 调整播放速度
gst-play-1.0 <file> --rate=<rate>
# 比如1.5倍播放视频
gst-play-1.0 video.mp4 --rate=1.5

# 显示播放进度状态
gst-play-1.0 <file> --verbose

4. gst-tester-1.0

gst-tester-1.0 是 GStreamer 提供的一个命令行工具,用于测试 GStreamer 元素和插件的功能。它主要用于调试、验证和测试 GStreamer 环境中安装的插件、管道以及元素是否按预期工作。

5. gst-typefind-1.0