gstreamer
gstreamer命令行的主命令
链接的gstreamer的翻译
通过这个调用音频的测试源到音频的输出。
运行命令后会发出声音
gst-launch-1.0 audiotestsrc ! alsasink
该命令可查询该任务的用法。
gst-inspect-1.0 audiotestsrc
Factory Details:
Rank none (0)
Long-name Audio test source
Klass Source/Audio
Description Creates audio test signals of given frequency and volume
Author Stefan Kost <ensonic@users.sf.net>
Plugin Details:
Name audiotestsrc
Description Creates audio test signals of given frequency and volume
Filename /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstaudiotestsrc.so
Version 1.14.5
License LGPL
Source module gst-plugins-base
Source release date 2019-05-29
Binary package GStreamer Base Plugins (Ubuntu)
Origin URL https://launchpad.net/distros/ubuntu/+source/gst-plugins-base1.0
GObject
+----GInitiallyUnowned
+----GstObject
+----GstElement
+----GstBaseSrc
+----GstAudioTestSrc
说明属性,是源,功能是音频,采用的格式
Pad Templates:
SRC template: 'src'
Availability: Always
Capabilities:
audio/x-raw
format: { (string)S16LE, (string)S16BE, (string)U16LE, (string)U16BE, (string)S24_32LE, (string)S24_32BE, (string)U24_32LE, (string)U24_32BE, (string)S32LE, (string)S32BE, (string)U32LE, (string)U32BE, (string)S24LE, (string)S24BE, (string)U24LE, (string)U24BE, (string)S20LE, (string)S20BE, (string)U20LE, (string)U20BE, (string)S18LE, (string)S18BE, (string)U18LE, (string)U18BE, (string)F32LE, (string)F32BE, (string)F64LE, (string)F64BE, (string)S8, (string)U8 }
layout: interleaved
rate: [ 1, 2147483647 ]
channels: [ 1, 2147483647 ]
Element has no clocking capabilities.
Element has no URI handling capabilities.
Pads:
SRC: 'src'
Pad Template: 'src'
属性,是可以修改和配置的内容。
Element Properties:
name : The name of the object
flags: readable, writable
String. Default: "audiotestsrc0"
parent : The parent of the object
flags: readable, writable
Object of type "GstObject"
blocksize : Size in bytes to read per buffer (-1 = default)
flags: readable, writable
Unsigned Integer. Range: 0 - 4294967295 Default: 4294967295
num-buffers : Number of buffers to output before sending EOS (-1 = unlimited)
flags: readable, writable
Integer. Range: -1 - 2147483647 Default: -1
typefind : Run typefind before negotiating (deprecated, non-functional)
flags: readable, writable, deprecated
Boolean. Default: false
do-timestamp : Apply current stream time to buffers
flags: readable, writable
Boolean. Default: false
samplesperbuffer : Number of samples in each outgoing buffer
flags: readable, writable
Integer. Range: 1 - 2147483647 Default: 1024
wave : Oscillator waveform
flags: readable, writable, controllable
Enum "GstAudioTestSrcWave" Default: 0, "sine"
(0): sine - Sine
(1): square - Square
(2): saw - Saw
(3): triangle - Triangle
(4): silence - Silence
(5): white-noise - White uniform noise
(6): pink-noise - Pink noise
(7): sine-table - Sine table
(8): ticks - Periodic Ticks
(9): gaussian-noise - White Gaussian noise
(10): red-noise - Red (brownian) noise
(11): blue-noise - Blue noise
(12): violet-noise - Violet noise
freq : Frequency of test signal. The sample rate needs to be at least 4 times higher.
flags: readable, writable, controllable
Double. Range: 0 - 5.368709e+08 Default: 440
volume : Volume of test signal
flags: readable, writable, controllable
Double. Range: 0 - 1 Default: 0.8
is-live : Whether to act as a live source
flags: readable, writable
Boolean. Default: false
timestamp-offset : An offset added to timestamps set on buffers (in ns)
flags: readable, writable
Integer64. Range: -9223372036854775808 - 9223372036854775807 Default: 0
can-activate-push : Can activate in push mode
flags: readable, writable
Boolean. Default: true
can-activate-pull : Can activate in pull mode
flags: readable, writable
Boolean. Default: false
根据这个参数说明进行修改的几个尝试。
#会产生方波的声音
gst-launch-1.0 audiotestsrc wave=1 !alsasink
#修改一下频率,声音的高低不同
#范围0 - 5.368709e+08
gst-launch-1.0 audiotestsrc wave=0 freq=200 !alsasink
音量也可以修改
#Double. Range: 0 - 1
gst-launch-1.0 audiotestsrc wave=0 freq=200
volume=0.5 !alsasink
不同的参数和插件需要空格分隔
! video/x-raw这个是相机对应的一个模块,在音频中对应的是audio/x-raw,在相关(Capabilities)部分可以看到。更好的叫法应该是兼容性
此处有许多格式
查询
gst-inspect-1.0 alsasink
通过查询source和sink的相关的一些内容,可以知道在这中间是否要加入一些格式的转换器。选择一个两者共有的格式形式。
gst-launch-1.0 audiotestsrc wave=0 freq=200
volume=0.5 !audio/x-raw,format=U8 !alsasink
因为两者有相同的兼容格式。
下面将使用格式转换
#U18LE不能被直接接受,添加一个转换器
gst-launch-1.0 audiotestsrc wave=0 freq=200
volume=0.5 !audio/x-raw,format=U18LE !audioconvert !alsasink
同样,查询audioconvert
gst-inspect-1.0 audioconvert
有source和sink,作为一个源头和一个下水管道(沉没)
设置它对应的转化的格式
#U18LE不能被直接接受,添加一个转换器
gst-launch-1.0 audiotestsrc wave=0 freq=200 volume=0.5 !audio/x-raw,format=U18LE !audioconvert !audio/x-raw,format=U8 !alsasink
视频的一些输出测试
gst-launch-1.0 videotestsrc !ximagesink
查询
gst-inspect-1.0 videotestsrc
Factory Details:
Rank none (0)
Long-name Video test source
Klass Source/Video
Description Creates a test video stream
Author David A. Schleef <ds@schleef.org>
Plugin Details:
Name videotestsrc
Description Creates a test video stream
Filename /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstvideotestsrc.so
Version 1.14.5
License LGPL
Source module gst-plugins-base
Source release date 2019-05-29
Binary package GStreamer Base Plugins (Ubuntu)
Origin URL https://launchpad.net/distros/ubuntu/+source/gst-plugins-base1.0
GObject
+----GInitiallyUnowned
+----GstObject
+----GstElement
+----GstBaseSrc
+----GstPushSrc
+----GstVideoTestSrc
Pad Templates:
SRC template: 'src'
Availability: Always
Capabilities:
video/x-raw
format: { (string)I420, (string)YV12, (string)YUY2, (string)UYVY, (string)AYUV, (string)RGBx, (string)BGRx, (string)xRGB, (string)xBGR, (string)RGBA, (string)BGRA, (string)ARGB, (string)ABGR, (string)RGB, (string)BGR, (string)Y41B, (string)Y42B, (string)YVYU, (string)Y444, (string)v210, (string)v216, (string)NV12, (string)NV21, (string)GRAY8, (string)GRAY16_BE, (string)GRAY16_LE, (string)v308, (string)RGB16, (string)BGR16, (string)RGB15, (string)BGR15, (string)UYVP, (string)A420, (string)RGB8P, (string)YUV9, (string)YVU9, (string)IYU1, (string)ARGB64, (string)AYUV64, (string)r210, (string)I420_10BE, (string)I420_10LE, (string)I422_10BE, (string)I422_10LE, (string)Y444_10BE, (string)Y444_10LE, (string)GBR, (string)GBR_10BE, (string)GBR_10LE, (string)NV16, (string)NV24, (string)NV12_64Z32, (string)A420_10BE, (string)A420_10LE, (string)A422_10BE, (string)A422_10LE, (string)A444_10BE, (string)A444_10LE, (string)NV61, (string)P010_10BE, (string)P010_10LE, (string)IYU2, (string)VYUY, (string)GBRA, (string)GBRA_10BE, (string)GBRA_10LE, (string)GBR_12BE, (string)GBR_12LE, (string)GBRA_12BE, (string)GBRA_12LE, (string)I420_12BE, (string)I420_12LE, (string)I422_12BE, (string)I422_12LE, (string)Y444_12BE, (string)Y444_12LE, (string)GRAY10_LE32, (string)NV12_10LE32, (string)NV16_10LE32 }
width: [ 1, 2147483647 ]
height: [ 1, 2147483647 ]
framerate: [ 0/1, 2147483647/1 ]
multiview-mode: { (string)mono, (string)left, (string)right }
video/x-bayer
format: { (string)bggr, (string)rggb, (string)grbg, (string)gbrg }
width: [ 1, 2147483647 ]
height: [ 1, 2147483647 ]
framerate: [ 0/1, 2147483647/1 ]
multiview-mode: { (string)mono, (string)left, (string)right }
Element has no clocking capabilities.
Element has no URI handling capabilities.
Pads:
SRC: 'src'
Pad Template: 'src'
Element Properties:
name : The name of the object
flags: readable, writable
String. Default: "videotestsrc0"
parent : The parent of the object
flags: readable, writable
Object of type "GstObject"
blocksize : Size in bytes to read per buffer (-1 = default)
flags: readable, writable
Unsigned Integer. Range: 0 - 4294967295 Default: 4096
num-buffers : Number of buffers to output before sending EOS (-1 = unlimited)
flags: readable, writable
Integer. Range: -1 - 2147483647 Default: -1
typefind : Run typefind before negotiating (deprecated, non-functional)
flags: readable, writable, deprecated
Boolean. Default: false
do-timestamp : Apply current stream time to buffers
flags: readable, writable
Boolean. Default: false
pattern : Type of test pattern to generate
flags: readable, writable
Enum "GstVideoTestSrcPattern" Default: 0, "smpte"
(0): smpte - SMPTE 100% color bars
(1): snow - Random (television snow)
(2): black - 100% Black
(3): white - 100% White
(4): red - Red
(5): green - Green
(6): blue - Blue
(7): checkers-1 - Checkers 1px
(8): checkers-2 - Checkers 2px
(9): checkers-4 - Checkers 4px
(10): checkers-8 - Checkers 8px
(11): circular - Circular
(12): blink - Blink
(13): smpte75 - SMPTE 75% color bars
(14): zone-plate - Zone plate
(15): gamut - Gamut checkers
(16): chroma-zone-plate - Chroma zone plate
(17): solid-color - Solid color
(18): ball - Moving ball
(19): smpte100 - SMPTE 100% color bars
(20): bar - Bar
(21): pinwheel - Pinwheel
(22): spokes - Spokes
(23): gradient - Gradient
(24): colors - Colors
timestamp-offset : An offset added to timestamps set on buffers (in ns)
flags: readable, writable
Integer64. Range: 0 - 9223372036854775807 Default: 0
is-live : Whether to act as a live source
flags: readable, writable
Boolean. Default: false
k0 : Zoneplate zero order phase, for generating plain fields or phase offsets
flags: readable, writable
Integer. Range: -2147483648 - 2147483647 Default: 0
kx : Zoneplate 1st order x phase, for generating constant horizontal frequencies
flags: readable, writable
Integer. Range: -2147483648 - 2147483647 Default: 0
ky : Zoneplate 1st order y phase, for generating contant vertical frequencies
flags: readable, writable
Integer. Range: -2147483648 - 2147483647 Default: 0
kt : Zoneplate 1st order t phase, for generating phase rotation as a function of time
flags: readable, writable
Integer. Range: -2147483648 - 2147483647 Default: 0
kxt : Zoneplate x*t product phase, normalised to kxy/256 cycles per vertical pixel at width/2 from origin
flags: readable, writable
Integer. Range: -2147483648 - 2147483647 Default: 0
kyt : Zoneplate y*t product phase
flags: readable, writable
Integer. Range: -2147483648 - 2147483647 Default: 0
kxy : Zoneplate x*y product phase
flags: readable, writable
Integer. Range: -2147483648 - 2147483647 Default: 0
kx2 : Zoneplate 2nd order x phase, normalised to kx2/256 cycles per horizontal pixel at width/2 from origin
flags: readable, writable
Integer. Range: -2147483648 - 2147483647 Default: 0
ky2 : Zoneplate 2nd order y phase, normailsed to ky2/256 cycles per vertical pixel at height/2 from origin
flags: readable, writable
Integer. Range: -2147483648 - 2147483647 Default: 0
kt2 : Zoneplate 2nd order t phase, t*t/256 cycles per picture
flags: readable, writable
Integer. Range: -2147483648 - 2147483647 Default: 0
xoffset : Zoneplate 2nd order products x offset
flags: readable, writable
Integer. Range: -2147483648 - 2147483647 Default: 0
yoffset : Zoneplate 2nd order products y offset
flags: readable, writable
Integer. Range: -2147483648 - 2147483647 Default: 0
foreground-color : Foreground color to use (big-endian ARGB)
flags: readable, writable, controllable
Unsigned Integer. Range: 0 - 4294967295 Default: 4294967295
background-color : Background color to use (big-endian ARGB)
flags: readable, writable, controllable
Unsigned Integer. Range: 0 - 4294967295 Default: 4278190080
horizontal-speed : Scroll image number of pixels per frame (positive is scroll to the left)
flags: readable, writable
Integer. Range: -2147483648 - 2147483647 Default: 0
animation-mode : For pattern=ball, which counter defines the position of the ball.
flags: readable, writable
Enum "GstVideoTestSrcAnimationMode" Default: 0, "frames"
(0): frames - frame count
(1): wall-time - wall clock time
(2): running-time - running time
motion : For pattern=ball, what motion the ball does
flags: readable, writable
Enum "GstVideoTestSrcMotionType" Default: 0, "wavy"
(0): wavy - Ball waves back and forth, up and down
(1): sweep - 1 revolution per second
(2): hsweep - 1/2 revolution per second, then reset to top
flip : For pattern=ball, invert colors every second.
flags: readable, writable
Boolean. Default: false
有时识别出现错误可以添加转义符号\,尝试在每个!前添加
#添加一个自动转换,ximagesink只接受video/x-raw的格式
gst-launch-1.0 videotest pattern=0 !video/x-raw,format=BGR
!autovideoconvert !ximagesink
gst-launch-1.0 videotest pattern=0 !video/x-raw,format=BGR
!autovideoconvert !video/x-raw,width=1280,hight=640 !ximagesink
下面在英伟达上,进行相机的尝试
和audiotestsrc相同,相机的配置使用的是nvarguscamerasrc叫做
module(模块)。后面是它的参数
以视频,或者下面的参数为例
设置传感器的id-0,因为视频中的机器有两个摄像接口
nvarguscamerasrc sensor-id=0
使用!进入下一个模块
设置相机的属性proporty时使用,分开
video/x-raw(memory:NVMM), width=3264, height=2464, format=NV12, framerate=21/1
gst-launch-1.0 nvarguscamerasrc !autovideoconvert !ximagesink
gst-launch-1.0 nvarguscamerasrc \!'video/x-raw(memory:NVMM),width=3264,height=2464,framerate=21/1' \! nvvidconv flip-method=2 ! video/x-raw,width=640, height=480 \!ximagesink
变成老电视
!agingtv
nvarguscamerasrc ! video/x-raw(memory:NVMM), width=3264, height=2464, format=NV12, framerate=21/1 ! nvvidconv flip-method=‘+str(flip)+’ ! video/x-raw, width=‘+str(dispW)+’, height=‘+str(dispH)+’, format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink