目录
编辑
1、简介
2、videotestsrc
3、videotestsrc 不同pattern参数测试罗列
3.1 (0): smpte - SMPTE 100% color bars
3.2 (1): snow - Random (television snow)
3.3 (2): black - 100% Black
编辑
3.4 checkers 方块
编辑
3.5 几何图形
4、videotestsrc 提供任意测试视频流
1、简介
书接上回,在第3章中我们做了雪球测试,其命令是:
#需要显示器支持
gst-launch-1.0 videotestsrc pattern=ball ! videoconvert ! autovideosink
#不需要硬件显示器支持 推荐
gst-launch-1.0 videotestsrc pattern=ball ! xvimagesink
其中有好几个插件我们其实都不是很清楚细节,这一部分,我们就补充说明,如何学习这些插件。也可以参考这个英文文档
videotestsrc
2、videotestsrc
videotestsrc 插件是一个视频源的插件,只有src pad,所以他只能生产数据,具体生产什么数据,需要一些参数指定,这个数据源可以帮助我们再没有硬件输出的时候,快速的实现一些测试。
#gst-inspect 工具查看插件信息 跟Element名。会列出Element的详细信息。例如,下面的命令会列出videotestsrc所支持的输入数据类型,Pad信息,支持的属性及值。我们主要关注Pad Template,以及Element的属性信息。
gst-inspect-1.0 videotestsrc
查询的输出内容
nvidia@nvidia-desktop:~$ gst-inspect-1.0 videotestsrc
Factory Details:Rank none (0)Long-name Video test sourceKlass Source/VideoDescription Creates a test video streamAuthor David A. Schleef <ds@schleef.org>
Plugin Details:Name videotestsrcDescription Creates a test video streamFilename /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstvideotestsrc.soVersion 1.14.5License LGPLSource module gst-plugins-baseSource release date 2019-05-29Binary 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: AlwaysCapabilities:video/x-rawformat: { (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-bayerformat: { (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 objectflags: readable, writableString. Default: "videotestsrc0"parent : The parent of the objectflags: readable, writableObject of type "GstObject"blocksize : Size in bytes to read per buffer (-1 = default)flags: readable, writableUnsigned Integer. Range: 0 - 4294967295 Default: 4096 num-buffers : Number of buffers to output before sending EOS (-1 = unlimited)flags: readable, writableInteger. Range: -1 - 2147483647 Default: -1 typefind : Run typefind before negotiating (deprecated, non-functional)flags: readable, writable, deprecatedBoolean. Default: falsedo-timestamp : Apply current stream time to buffersflags: readable, writableBoolean. Default: falsepattern : Type of test pattern to generateflags: readable, writableEnum "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 - Colorstimestamp-offset : An offset added to timestamps set on buffers (in ns)flags: readable, writableInteger64. Range: 0 - 9223372036854775807 Default: 0 is-live : Whether to act as a live sourceflags: readable, writableBoolean. Default: falsek0 : Zoneplate zero order phase, for generating plain fields or phase offsetsflags: readable, writableInteger. Range: -2147483648 - 2147483647 Default: 0 kx : Zoneplate 1st order x phase, for generating constant horizontal frequenciesflags: readable, writableInteger. Range: -2147483648 - 2147483647 Default: 0 ky : Zoneplate 1st order y phase, for generating contant vertical frequenciesflags: readable, writableInteger. Range: -2147483648 - 2147483647 Default: 0 kt : Zoneplate 1st order t phase, for generating phase rotation as a function of timeflags: readable, writableInteger. Range: -2147483648 - 2147483647 Default: 0 kxt : Zoneplate x*t product phase, normalised to kxy/256 cycles per vertical pixel at width/2 from originflags: readable, writableInteger. Range: -2147483648 - 2147483647 Default: 0 kyt : Zoneplate y*t product phaseflags: readable, writableInteger. Range: -2147483648 - 2147483647 Default: 0 kxy : Zoneplate x*y product phaseflags: readable, writableInteger. Range: -2147483648 - 2147483647 Default: 0 kx2 : Zoneplate 2nd order x phase, normalised to kx2/256 cycles per horizontal pixel at width/2 from originflags: readable, writableInteger. Range: -2147483648 - 2147483647 Default: 0 ky2 : Zoneplate 2nd order y phase, normailsed to ky2/256 cycles per vertical pixel at height/2 from originflags: readable, writableInteger. Range: -2147483648 - 2147483647 Default: 0 kt2 : Zoneplate 2nd order t phase, t*t/256 cycles per pictureflags: readable, writableInteger. Range: -2147483648 - 2147483647 Default: 0 xoffset : Zoneplate 2nd order products x offsetflags: readable, writableInteger. Range: -2147483648 - 2147483647 Default: 0 yoffset : Zoneplate 2nd order products y offsetflags: readable, writableInteger. Range: -2147483648 - 2147483647 Default: 0 foreground-color : Foreground color to use (big-endian ARGB)flags: readable, writable, controllableUnsigned Integer. Range: 0 - 4294967295 Default: 4294967295 background-color : Background color to use (big-endian ARGB)flags: readable, writable, controllableUnsigned Integer. Range: 0 - 4294967295 Default: 4278190080 horizontal-speed : Scroll image number of pixels per frame (positive is scroll to the left)flags: readable, writableInteger. Range: -2147483648 - 2147483647 Default: 0 animation-mode : For pattern=ball, which counter defines the position of the ball.flags: readable, writableEnum "GstVideoTestSrcAnimationMode" Default: 0, "frames"(0): frames - frame count(1): wall-time - wall clock time(2): running-time - running timemotion : For pattern=ball, what motion the ball doesflags: readable, writableEnum "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 topflip : For pattern=ball, invert colors every second.flags: readable, writableBoolean. Default: false
从所有信息中可以看到这个插件只有src,其次输出格式是 video/x-raw数据。
Pad Templates:SRC template: 'src'Availability: AlwaysCapabilities:video/x-rawPads:SRC: 'src'Pad Template: 'src'
从测试命令中我们可以看到gst-launch-1.0 videotestsrc pattern=ball ! xvimagesink,pattern参数,这个也在详细信息中有一一列举。
pattern : Type of test pattern to generateflags: readable, writableEnum "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
3、videotestsrc 不同pattern参数测试罗列
3.1 (0): smpte - SMPTE 100% color bars
gst-launch-1.0 videotestsrc pattern=smpte ! xvimagesink

3.2 (1): snow - Random (television snow)
gst-launch-1.0 videotestsrc pattern=snow ! xvimagesink
3.3 (2): black - 100% Black
gst-launch-1.0 videotestsrc pattern=black ! xvimagesink

(3): white - 100% White(4): red - Red(5): green - Green(6): blue - Blue
#白色
gst-launch-1.0 videotestsrc pattern=white ! xvimagesink
#红色
gst-launch-1.0 videotestsrc pattern=red ! xvimagesink
#绿色
gst-launch-1.0 videotestsrc pattern=green ! xvimagesink
#蓝色
gst-launch-1.0 videotestsrc pattern=blue ! xvimagesink
3.4 checkers 方块
(7): checkers-1 - Checkers 1px(8): checkers-2 - Checkers 2px(9): checkers-4 - Checkers 4px(10): checkers-8 - Checkers 8px
#棕色
gst-launch-1.0 videotestsrc pattern=checkers-1 ! xvimagesink
#米字格 checkers-4
gst-launch-1.0 videotestsrc pattern=checkers-4 ! xvimagesink
#米字格 checkers-8
gst-launch-1.0 videotestsrc pattern=checkers-8 ! xvimagesink


3.5 几何图形
(11): circular - Circular
(18): ball - Moving ball
(20): bar - Bar
(21): pinwheel - Pinwheel
(22): spokes - Spokes
(23): gradient - Gradient
#圆形
gst-launch-1.0 videotestsrc pattern=circular ! xvimagesink

#圆形
gst-launch-1.0 videotestsrc pattern=pinwheel ! xvimagesink

4、videotestsrc 提供任意测试视频流
pattern既可以是数字 [0,24] 也可以是符号。某些模式可以使用其他参数进行调整。要以给定的帧率,大小 生成测试模式,可以使用“过滤器”:
#很早的旧版本写法
gst-launch videotestsrc ! video/x-raw-rgb, framerate=25/1, width=640, height=360 ! ximagesink
#现在的写法
gst-launch-1.0 videotestsrc ! video/x-raw, framerate=25/1, width=640, height=360 ! ximagesink

所以可以用上述命令自己调整,生成很多测试视频格式,来提升测试效率。
觉得以上有点用处,点个赞呗,谢谢。



















