GStreamer——gst-launch-1.0(man)

$ man gst-launch-1.0

NAME
       gst-launch-1.0 - build and run a GStreamer pipeline

SYNOPSIS
       gst-launch-1.0 [OPTION...] PIPELINE-DESCRIPTION

DESCRIPTION
       gst-launch-1.0 is a tool that builds and runs basic GStreamer pipelines.

       In  simple form, a PIPELINE-DESCRIPTION is a list of elements separated by exclamation marks (!). Properties may be appended to elements, in the form property=value. A "preset" can also be set using the
       @preset=<preset name> syntax.

       For a complete description of possible PIPELINE-DESCRIPTIONS see the section pipeline description below or consult the GStreamer documentation.

       Please note that gst-launch-1.0 is primarily a debugging tool for developers and users. You should not build applications on top of it. For applications,  use  the  gst_parse_launch()  function  of  the
       GStreamer API as an easy way to construct pipelines from pipeline descriptions.

OPTIONS
       gst-launch-1.0 accepts the following options:

       --help  Print help synopsis and available FLAGS

       -v, --verbose
               Output status information and property notifications

       -q, --quiet
               Do not print any progress information

       -m, --messages
               Output messages posted on the pipeline's bus

       -t, --tags
               Output tags (also known as metadata)

       -e, --eos-on-shutdown
               Force an EOS event on sources before shutting the pipeline down. This is useful to make sure muxers create readable files when a muxing pipeline is shut down forcefully via Control-C.

       -i, --index
               Gather and print index statistics. This is mostly useful for playback or recording pipelines.

       -f, --no-fault
               Do not install a fault handler

       -T, --trace
               Print memory allocation traces. The feature must be enabled at compile time to work.

       --no-position
               Do  not  print current position of pipeline.  If this option is unspecified, the position will be printed when stdout is a TTY.  To enable printing position when stdout is not a TTY, use "force-
               position" option.

       --force-position
               Allow printing current position of pipeline even if stdout is not a TTY.  This option has no effect if the "no-position" option is specified.

       GSTREAMER OPTIONS
              gst-launch-1.0 also accepts the following options that are common to all GStreamer applications:

       --gst-version
               Prints the version string of the GStreamer core library.

       --gst-fatal-warnings
               Causes GStreamer to abort if a warning message occurs. This is equivalent to setting the environment variable G_DEBUG to 'fatal_warnings' (see the section environment variables below for further
               information).

       --gst-debug=STRING
               A  comma  separated  list  of  category_name:level pairs to specify debugging levels for each category. Level is in the range 0-9 where 0 will show no messages, and 9 will show all messages. The
               wildcard * can be used to match category names.  Note that the order of categories and levels is important, wildcards at the end may override levels set earlier. The  log  levels  are:  1=ERROR,
               2=WARNING,  3=FIXME,  4=INFO,  5=DEBUG, 6=LOG, 7=TRACE, 9=MEMDUMP. Since GStreamer 1.2 one can also use the debug level names, e.g. --gst-debug=*sink:LOG. A full description of the various debug
               levels can be found in the GStreamer core library API documentation, in the "Running GStreamer Applications" section.

               Use --gst-debug-help to show category names

               Example: GST_CAT:5,GST_ELEMENT_*:3,oggdemux:5

       --gst-debug-level=LEVEL
               Sets the threshold for printing debugging messages.  A higher level will print more messages.  The useful range is 0-9, with the default being 0. Level 6 (LOG level) will  show  all  information
               that is usually required for debugging purposes. Higher levels are only useful in very specific cases. See above for the full list of levels.

       --gst-debug-no-color
               GStreamer normally prints debugging messages so that the messages are color-coded when printed to a terminal that handles ANSI escape sequences.  Using this option causes GStreamer to print mes-
               sages without color. Setting the GST_DEBUG_NO_COLOR environment variable will achieve the same thing.

       --gst-debug-color-mode
               GStreamer normally prints debugging messages so that the messages are color-coded when printed to a terminal that handles ANSI escape sequences (on *nix), or uses W32 console API  to  color  the
               messages  printed  into a console (on W32). Using this option causes GStreamer to print messages without color ('off' or 'disable'), print messages with default colors ('on' or 'auto'), or print
               messages using ANSI escape sequences for coloring ('unix'). Setting the GST_DEBUG_COLOR_MODE environment variable will achieve the same thing.

       --gst-debug-disable
               Disables debugging.

       --gst-debug-help
               Prints a list of available debug categories and their default debugging level.

       --gst-plugin-spew
               GStreamer info flags to set Enable printout of errors while loading GStreamer plugins

       --gst-plugin-path=PATH
               Add directories separated with ':' to the plugin search path

       --gst-plugin-load=PLUGINS
               Preload plugins specified in a comma-separated list. Another way to specify plugins to preload is to use the environment variable GST_PLUGIN_PATH


PIPELINE DESCRIPTION
       A pipeline consists elements and links. Elements can be put into bins of different sorts. Elements, links and bins can be specified in a pipeline description in any order.

       Elements

       ELEMENTTYPE [PROPERTY1 ...]

       Creates an element of type ELEMENTTYPE and sets the PROPERTIES.

       Properties

       PROPERTY=VALUE ...

       Sets the property to the specified value. You can use gst-inspect-1.0(1) to find out about properties and allowed values of different elements.
       Enumeration properties can be set by name, nick or value.

       Presets

       @preset=<preset name> ...

       Sets the preset on the element. you can use gst-inspect-1.0(1) to find out what presets are available for a specific element.

       Bins

       [BINTYPE.] ( [PROPERTY1 ...] PIPELINE-DESCRIPTION )

       Specifies that a bin of type BINTYPE is created and the given properties are set. Every element between the braces is put into the bin. Please note the dot that has to be used  after  the  BINTYPE.  You
       will almost never need this functionality, it is only really useful for applications using the gst_launch_parse() API with 'bin' as bintype. That way it is possible to build partial pipelines instead of
       a full-fledged top-level pipeline.

       Links

       [[SRCELEMENT].[PAD1,...]] ! [[SINKELEMENT].[PAD1,...]]  [[SRCELEMENT].[PAD1,...]] ! CAPS ! [[SINKELEMENT].[PAD1,...]]  [[SRCELEMENT].[PAD1,...]] : [[SINKELEMENT].[PAD1,...]]  [[SRCELEMENT].[PAD1,...]] :
       CAPS : [[SINKELEMENT].[PAD1,...]]

       Links  the  element with name SRCELEMENT to the element with name SINKELEMENT, using the caps specified in CAPS as a filter.  Names can be set on elements with the name property. If the name is omitted,
       the element that was specified directly in front of or after the link is used. This works across bins. If a padname is given, the link is done with these pads. If no pad names are given  all  possibili-
       ties are tried and a matching pad is used.  If multiple padnames are given, both sides must have the same number of pads specified and multiple links are done in the given order.
       So the simplest link is a simple exclamation mark, that links the element to the left of it to the element right of it.
       Linking using the : operator attempts to link all possible pads between the elements

       Caps

       MEDIATYPE [, PROPERTY[, PROPERTY ...]]] [; CAPS[; CAPS ...]]

       Creates  a capability with the given media type and optionally with given properties. The media type can be escaped using " or '.  If you want to chain caps, you can add more caps in the same format af-
       terwards.

       Properties

       NAME=[(TYPE)]VALUE
       in lists and ranges: [(TYPE)]VALUE

       Sets the requested property in capabilities. The name is an alphanumeric value and the type can have the following case-insensitive values:
       - i or int for integer values or ranges
       - f or float for float values or ranges
       - b, bool or boolean for boolean values
       - s, str or string for strings
       - fraction for fractions (framerate, pixel-aspect-ratio)
       - l or list for lists
       If no type was given, the following order is tried: integer, float, boolean, string.
       Integer values must be parsable by strtol(), floats by strtod(). FOURCC values may either be integers or strings. Boolean values are (case insensitive) yes, no, true or false and may like strings be es-
       caped with " or '.
       Ranges are in this format:  [ VALUE, VALUE ]
       Lists use this format:      { VALUE [, VALUE ...] }


PIPELINE EXAMPLES
       The  examples  below  assume  that  you  have the correct plug-ins available.  In general, "pulsesink" can be substituted with another audio output plug-in such as "alsasink" or "osxaudiosink" Likewise,
       "xvimagesink" can be substituted with "ximagesink", "glimagesink", or "osxvideosink". Keep in mind though that different sinks might accept different formats and even the same sink might accept  differ-
       ent formats on different machines, so you might need to add converter elements like audioconvert and audioresample (for audio) or videoconvert (for video) in front of the sink to make things work.

       Audio playback

       Play the mp3 music file "music.mp3" using a libmpg123-based plug-in and output to an Pulseaudio device
               gst-launch-1.0 filesrc location=music.mp3 ! mpegaudioparse ! mpg123audiodec ! audioconvert ! audioresample ! pulsesink

       Play an Ogg Vorbis format file
               gst-launch-1.0 filesrc location=music.ogg ! oggdemux ! vorbisdec ! audioconvert ! audioresample ! pulsesink

       Play an mp3 file or an http stream using GIO
               gst-launch-1.0 giosrc location=music.mp3 ! mpegaudioparse ! mpg123audiodec ! audioconvert ! pulsesink
               gst-launch-1.0 giosrc location=http://domain.com/music.mp3 ! mpegaudioparse ! mpg123audiodec ! audioconvert ! audioresample ! pulsesink

       Use GIO to play an mp3 file located on an SMB server
               gst-launch-1.0 giosrc location=smb://computer/music.mp3 ! mpegaudioparse ! mpg123audiodec ! audioconvert ! audioresample ! pulsesink

       Format conversion

       Convert an mp3 music file to an Ogg Vorbis file
               gst-launch-1.0 filesrc location=music.mp3 ! mpegaudioparse ! mpg123audiodec ! audioconvert ! vorbisenc ! oggmux ! filesink location=music.ogg

       Convert to the FLAC format
               gst-launch-1.0 filesrc location=music.mp3 ! mpegaudioparse ! mpg123audiodec ! audioconvert ! flacenc ! filesink location=test.flac

       Other

       Plays a .WAV file that contains raw audio data (PCM).
               gst-launch-1.0 filesrc location=music.wav ! wavparse ! audioconvert ! audioresample ! pulsesink

       Convert a .WAV file containing raw audio data into an Ogg Vorbis or mp3 file
               gst-launch-1.0 filesrc location=music.wav ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location=music.ogg
               gst-launch-1.0 filesrc location=music.wav ! wavparse ! audioconvert ! lamemp3enc ! filesink location=music.mp3

       Rips all tracks from compact disc and convert them into a single mp3 file
               gst-launch-1.0 cdparanoiasrc mode=continuous ! audioconvert ! lamemp3enc ! mpegaudioparse ! id3v2mux ! filesink location=cd.mp3

       Rips track 5 from the CD and converts it into a single mp3 file
               gst-launch-1.0 cdparanoiasrc track=5 ! audioconvert ! lamemp3enc ! mpegaudioparse ! id3v2mux ! filesink location=track5.mp3

       Using  gst-inspect-1.0(1),  it  is  possible  to  discover  settings  like the above for cdparanoiasrc that will tell it to rip the entire cd or only tracks of it.  Alternatively, you can use an URI and
       gst-launch-1.0 will find an element (such as cdparanoia) that supports that protocol for you, e.g.:
              gst-launch-1.0 cdda://5 ! lamemp3enc vbr=new vbr-quality=6 ! filesink location=track5.mp3

       Records sound from your audio input and encodes it into an ogg file
               gst-launch-1.0 pulsesrc ! audioconvert ! vorbisenc ! oggmux ! filesink location=input.ogg

       Video

       Display only the video portion of an MPEG-1 video file, outputting to an X display window
               gst-launch-1.0 filesrc location=JB_FF9_TheGravityOfLove.mpg ! dvddemux ! mpegvideoparse ! mpeg2dec ! xvimagesink

       Display the video portion of a .vob file (used on DVDs), outputting to an SDL window
               gst-launch-1.0 filesrc location=/flflfj.vob ! dvddemux ! mpegvideoparse ! mpeg2dec ! sdlvideosink

       Play both video and audio portions of an MPEG movie
               gst-launch-1.0 filesrc location=movie.mpg ! dvddemux name=demuxer  demuxer. ! queue ! mpegvideoparse ! mpeg2dec ! sdlvideosink  demuxer. ! queue ! mpegaudioparse ! mpg123audiodec !  audioconvert
       ! audioresample ! pulsesink

       Play an AVI movie with an external text subtitle stream
               gst-launch-1.0 filesrc location=movie.mpg ! mpegdemux name=demuxer demuxer. ! queue ! mpegvideoparse ! mpeg2dec ! videoconvert ! sdlvideosink   demuxer. ! queue ! mpegaudioparse ! mpg123audiodec
       ! audioconvert ! audioresample ! pulsesink

       This example also shows how to refer to specific pads by name if an element (here: textoverlay) has multiple sink or source pads.
               gst-launch-1.0 textoverlay name=overlay ! videoconvert ! videoscale !  autovideosink   filesrc location=movie.avi ! decodebin ! videoconvert ! overlay.video_sink   filesrc  location=movie.srt  !
       subparse ! overlay.text_sink

       Play an AVI movie with an external text subtitle stream using playbin
               gst-launch-1.0 playbin uri=file:///path/to/movie.avi suburi=file:///path/to/movie.srt

       Network streaming

       Stream video using RTP and network elements.

       This command would be run on the transmitter
               gst-launch-1.0 v4l2src ! video/x-raw,width=128,height=96,format=UYVY ! videoconvert ! ffenc_h263 ! video/x-h263 ! rtph263ppay pt=96 ! udpsink host=192.168.1.1 port=5000

       Use this command on the receiver
               gst-launch-1.0 udpsrc port=5000 ! application/x-rtp, clock-rate=90000,payload=96 ! rtph263pdepay queue-delay=0 ! ffdec_h263 ! xvimagesink

       Diagnostic

       Generate a null stream and ignore it (and print out details).
               gst-launch-1.0 -v fakesrc num-buffers=16 ! fakesink

       Generate a pure sine tone to test the audio output
               gst-launch-1.0 audiotestsrc ! audioconvert ! audioresample ! pulsesink

       Generate a familiar test pattern to test the video output
               gst-launch-1.0 videotestsrc ! xvimagesink
               gst-launch-1.0 videotestsrc ! ximagesink

       Automatic linking

       You can use the decodebin element to automatically select the right elements to get a working pipeline.

       Play any supported audio format
               gst-launch-1.0 filesrc location=musicfile ! decodebin ! audioconvert ! audioresample ! pulsesink

       Play any supported video format with video and audio output. Threads are used automatically. To make this even easier, you can use the playbin element:
               gst-launch-1.0 filesrc location=videofile ! decodebin name=decoder decoder. ! queue ! audioconvert ! audioresample ! pulsesink   decoder. !  videoconvert ! xvimagesink
               gst-launch-1.0 playbin uri=file:///home/joe/foo.avi

       Filtered connections

       These examples show you how to use filtered caps.

       Show a test image and use the YUY2 or YV12 video format for this.
               gst-launch-1.0 videotestsrc ! 'video/x-raw,format=YUY2;video/x-raw,format=YV12' ! xvimagesink

       Record audio and write it to a .wav file. Force usage of signed 16 to 32 bit samples and a sample rate between 32kHz and 64KHz.
               gst-launch-1.0 pulsesrc !  'audio/x-raw,rate=[32000,64000],format={S16LE,S24LE,S32LE}' ! wavenc ! filesink location=recording.wav

ENVIRONMENT VARIABLES
       GST_DEBUG
              Comma-separated  list  of  debug categories and levels (e.g.  GST_DEBUG=totem:4,typefind:5). '*' is allowed as a wildcard as part of debug category names (e.g. GST_DEBUG=*sink:6,*audio*:6). Since
              1.2.0 it is also possible to specify the log level by name (1=ERROR, 2=WARN, 3=FIXME, 4=INFO, 5=DEBUG, 6=LOG, 7=TRACE, 9=MEMDUMP) (e.g. GST_DEBUG=*audio*:LOG)

       GST_DEBUG_NO_COLOR
              When this environment variable is set, coloured debug output is disabled.

       GST_DEBUG_DUMP_DOT_DIR
              When set to a filesystem path, store 'dot' files of pipeline graphs there.  These can then later be converted into an image using the 'dot' utility from the graphviz set of tools, like this:  dot
              foo.dot -Tsvg -o foo.svg (png or jpg are also possible as output format). There is also a utility called 'xdot' which allows you to view the .dot file directly without converting it first.
              When the pipeline changes state through NULL to PLAYING and back to NULL, a dot file is generated on each state change. To write a snapshot of the pipeline state, send a SIGHUP to the process.

       GST_REGISTRY
              Path  of  the  plugin  registry  file.  Default is ~/.cache/gstreamer-1.0/registry-CPU.bin where CPU is the machine/cpu type GStreamer was compiled for, e.g. 'i486', 'i686', 'x86-64', 'ppc', etc.
              (check the output of "uname -i" and "uname -m" for details).

       GST_REGISTRY_UPDATE
              Set to "no" to force GStreamer to assume that no plugins have changed, been added or been removed. This will make GStreamer skip the initial check whether a rebuild of the registry cache  is  re-
              quired or not. This may be useful in embedded environments where the installed plugins never change. Do not use this option in any other setup.

       GST_PLUGIN_PATH
              Specifies a list of directories to scan for additional plugins.  These take precedence over the system plugins.

       GST_PLUGIN_SYSTEM_PATH
              Specifies a list of plugins that are always loaded by default.  If not set, this defaults to the system-installed path, and the plugins installed in the user's home directory

       GST_DEBUG_FILE
              Set this variable to a file path to redirect all GStreamer debug messages to this file. If left unset, debug messages with be output unto the standard error.

       ORC_CODE
              Useful  Orc  environment  variable. Set ORC_CODE=debug to enable debuggers such as gdb to create useful backtraces from Orc-generated code.  Set ORC_CODE=backup or ORC_CODE=emulate if you suspect
              Orc's SIMD code generator is producing incorrect code.  (Quite a few important GStreamer plugins like videotestsrc, audioconvert or audioresample use Orc).

       G_DEBUG
              Useful GLib environment variable. Set G_DEBUG=fatal_warnings to make GStreamer programs abort when a critical warning such as an assertion failure occurs. This is useful if you want to  find  out
              which  part  of the code caused that warning to be triggered and under what circumstances. Simply set G_DEBUG as mentioned above and run the program in gdb (or let it core dump). Then get a stack
              trace in the usual way.

FILES
       ~/.cache/gstreamer-1.0/registry-*.bin
               The plugin cache; can be deleted at any time, will be re-created automatically when it does not exist yet or plugins change. Based on XDG_CACHE_DIR, so may be in a different  location  than  the
               one suggested.

SEE ALSO
       gst-inspect-1.0(1), gst-launch-1.0(1),

AUTHOR
       The GStreamer team at http://gstreamer.freedesktop.org/

翻译:

NAME
       gst-launch-1.0 - 构建并运行一个GStreamer管道

SYNOPSIS
       gst-launch-1.0 [OPTION...] PIPELINE-DESCRIPTION

DESCRIPTION
       gst-launch-1.0是一个用于构建和运行基础GStreamer管道的工具。

       简单来说,PIPELINE-DESCRIPTION是由感叹号(!)分隔的元素列表。属性可以以property=value的形式附加到元素上。还可以使用@preset=<preset name>的语法设置“预置”。

       有关可能的PIPELINE-DESCRIPTION的完整说明,请参阅下面的管道描述部分或咨询GStreamer文档。

       请注意,gst-launch-1.0主要是供开发人员和用户使用的调试工具。您不应在其之上构建应用程序。对于应用程序,使用GStreamer API中的gst_parse_launch()函数是从管道描述构建管道的简便方法。
OPTIONS
       gst-launch-1.0接受以下选项:

       --help 打印帮助概要和可用的标志

       -v, --verbose 输出状态信息和属性通知

       -q, --quiet 不打印任何进度信息

       -m, --messages 输出管道总线上发布的消息

       -t, --tags 输出标签(也称为元数据)

       -e, --eos-on-shutdown 在关闭管道之前强制在源上发送EOS事件。这有助于确保在通过Control-C强制关闭多路复用管道时,复用器创建可读文件。

       -i, --index 收集并打印索引统计信息。这对于播放或录制管道非常有用。

       -f, --no-fault 不安装故障处理程序

       -T, --trace 打印内存分配跟踪。此功能必须在编译时启用才能工作。

       --no-position           不打印管道的当前位置。如果未指定此选项,当stdout是TTY时将打印位置。要在stdout不是TTY时允许打印位置,使用“force-position”选项。

       --force-position 即使stdout不是TTY,也允许打印管道的当前位置。如果指定了“no-position”选项,则此选项无效。

       GSTREAMER OPTIONS
              gst-launch-1.0还接受所有GStreamer应用程序共有的以下选项:

       --gst-version 打印GStreamer核心库的版本字符串。

       --gst-fatal-warnings
              如果发生警告消息,则导致GStreamer中止。这与将环境变量G_DEBUG设置为'fatal_warnings'等效(请参阅下面的环境变量部分以获取更多信息)。

       --gst-debug=STRING
              指定每个类别的调试级别的类别名称:级别对的逗号分隔列表。级别在0-9范围内,其中0不会显示任何消息,9会显示所有消息。可以使用通配符*来匹配类别名称。注意类别和级别的顺序很重要,末尾的通配符可能会覆盖之前设置的级别。日志级别如下:1=ERROR, 2=WARNING, 3=FIXME, 4=INFO, 5=DEBUG, 6=LOG, 7=TRACE, 9=MEMDUMP。从GStreamer 1.2开始,也可以使用调试级别名称,例如 --gst-debug=*sink:LOG。各种调试级别的完整描述可以在GStreamer核心库API文档的“运行GStreamer应用程序”部分找到。

              使用 --gst-debug-help 显示类别名称

              示例:GST_CAT:5,GST_ELEMENT_*:3,oggdemux:5

       --gst-debug-level=LEVEL
              设置打印调试消息的阈值。更高的级别将打印更多消息。有用的范围是0-9,默认值为0。级别6(LOG级别)将显示通常需要的所有调试信息。只有在特定情况下才需要更高级别。请参阅上面的完整级别列表。

       --gst-debug-no-color
              GStreamer通常会以彩色编码的方式打印调试消息,以便在支持ANSI转义序列的终端中打印消息。使用此选项会导致GStreamer以无颜色的方式打印消息。设置GST_DEBUG_NO_COLOR环境变量将实现相同的效果。

       --gst-debug-color-mode
              GStreamer通常会以彩色编码的方式打印调试消息,以便在支持ANSI转义序列的终端中打印消息(在*nix上),或使用W32控制台API对打印到控制台的消息进行颜色编码(在W32上)。使用此选项会导致GStreamer以无颜色('off'或'disable')、默认颜色('on'或'auto')或使用ANSI转义序列进行颜色编码的方式打印消息('unix')。设置GST_DEBUG_COLOR_MODE环境变量将实现相同的效果。

       --gst-debug-disable
              禁用调试。

       --gst-debug-help
              打印可用调试类别及其默认调试级别的列表。

       --gst-plugin-spew
              GStreamer信息标志设置为加载GStreamer插件时的错误打印

       --gst-plugin-path=PATH
              添加由':'分隔的目录到插件搜索路径

       --gst-plugin-load=PLUGINS
              预加载以逗号分隔的列表中指定的插件。指定要预加载的插件的另一种方法是使用环境变量GST_PLUGIN_PATH
		   
管道描述
       一个管道由元素和链接组成。元素可以放入不同种类的容器中。元素、链接和容器可以在管道描述中以任何顺序指定。

       元素

       ELEMENTTYPE [PROPERTY1 ...]

       创建一个类型为ELEMENTTYPE的元素,并设置属性。
	
       属性

       PROPERTY=VALUE ...

       将属性设置为指定的值。你可以使用gst-inspect-1.0(1)来查找不同元素的属性和允许的值。
       枚举属性可以通过名称、昵称或值来设置。

       预设

       @preset=<preset name> ...

       在元素上设置预设。你可以使用gst-inspect-1.0(1)来查找特定元素的可用预设。

       Bins

       [BINTYPE.] ( [PROPERTY1 ...] PIPELINE-DESCRIPTION )

       指定创建类型为BINTYPE的容器,并设置给定的属性。括号之间的每个元素都被放入容器中。请注意,必须在BINTYPE之后使用点。你几乎不需要这个功能,它只对使用gst_launch_parse() API并将'bin'作为容器类型的应用程序真正有用。这样,就可以构建部分管道,而不是完整的顶层管道。

       链接

       [[SRCELEMENT].[PAD1,...]] ! [[SINKELEMENT].[PAD1,...]]  [[SRCELEMENT].[PAD1,...]] ! CAPS ! [[SINKELEMENT].[PAD1,...]]  [[SRCELEMENT].[PAD1,...]] : [[SINKELEMENT].[PAD1,...]]  [[SRCELEMENT].[PAD1,...]] :
       CAPS : [[SINKELEMENT].[PAD1,...]]

       使用指定的CAPS作为过滤器,将名为SRCELEMENT的元素链接到名为SINKELEMENT的元素。可以使用name属性在元素上设置名称。如果省略了名称,则使用直接在链接前或后指定的元素。这可以跨容器工作。如果给出了垫片名称,则使用这些垫片进行链接。如果没有给出垫片名称,则尝试所有可能性,并使用匹配的垫片。如果给出了多个垫片名称,则两边必须指定相同数量的垫片,并按给定的顺序进行多次链接。
       因此,最简单的链接是一个简单的感叹号,它将左侧的元素链接到右侧的元素。
       使用:操作符进行的链接尝试在所有可能的垫片之间建立链接

       Caps

       MEDIATYPE [, PROPERTY[, PROPERTY ...]]] [; CAPS[; CAPS ...]]

       使用给定的媒体类型和可选的给定属性创建能力。媒体类型可以使用"或'进行转义。如果你想链接更多的caps,你可以在后面以相同的格式添加更多的caps。

       属性

       NAME=[(TYPE)]VALUE
       在列表和范围中:[(TYPE)]VALUE

       在能力中设置请求的属性。名称是字母数字值,类型可以是以下不区分大小写的值:

       - i或int用于整数值或范围
       - f或float用于浮点值或范围
       - b, bool或boolean用于布尔值
       - s, str或string用于字符串
       - fraction用于分数(帧率,像素宽高比)
       - l或list用于列表 
       如果没有给出类型,将尝试以下顺序:整数,浮点数,布尔值,字符串。 整数值必须能被strtol()解析,浮点数能被strtod()解析。FOURCC值可以是整数或字符串。布尔值是不区分大小写的yes, no, true或false,可以像字符串一样用"或'转义。 
	   范围使用这种格式: [ VALUE, VALUE ] 
	   列表使用这种格式: { VALUE [, VALUE ...] }

管道示例
       下面的示例假设您有正确的插件可用。通常,“pulsesink”可以用另一个音频输出插件如“alsasink”或“osxaudiosink”替换。同样,“xvimagesink”可以用“ximagesink”、“glimagesink”或“osxvideosink”替换。但请记住,不同的接收器可能接受不同的格式,即使是同一个接收器也可能在不同的机器上接受不同的格式,因此您可能需要在接收器前面添加转换元素,如音频的“audioconvert”和“audioresample”(对于音频)或视频的“videoconvert”,以使事情正常工作。

       音频播放
       使用基于libmpg123的插件播放mp3音乐文件“music.mp3”,并输出到Pulseaudio设备
              gst-launch-1.0 filesrc location=music.mp3 ! mpegaudioparse ! mpg123audiodec ! audioconvert ! audioresample ! pulsesink

       播放Ogg Vorbis格式文件
              gst-launch-1.0 filesrc location=music.ogg ! oggdemux ! vorbisdec ! audioconvert ! audioresample ! pulsesink

       使用GIO播放mp3文件或http流
              gst-launch-1.0 giosrc location=music.mp3 ! mpegaudioparse ! mpg123audiodec ! audioconvert ! pulsesink
              gst-launch-1.0 giosrc location=http://domain.com/music.mp3 ! mpegaudioparse ! mpg123audiodec ! audioconvert ! audioresample ! pulsesink

       使用GIO播放位于SMB服务器上的mp3文件
              gst-launch-1.0 giosrc location=smb://computer/music.mp3 ! mpegaudioparse ! mpg123audiodec ! audioconvert ! audioresample ! pulsesink

       格式转换
	   
       将mp3音乐文件转换为Ogg Vorbis文件
              gst-launch-1.0 filesrc location=music.mp3 ! mpegaudioparse ! mpg123audiodec ! audioconvert ! vorbisenc ! oggmux ! filesink location=music.ogg

       转换为FLAC格式
              gst-launch-1.0 filesrc location=music.mp3 ! mpegaudioparse ! mpg123audiodec ! audioconvert ! flacenc ! filesink location=test.flac

       其他
	   
       播放包含原始音频数据(PCM)的.WAV文件。
              gst-launch-1.0 filesrc location=music.wav ! wavparse ! audioconvert ! audioresample ! pulsesink

       将包含原始音频数据的.WAV文件转换为Ogg Vorbis或mp3文件
              gst-launch-1.0 filesrc location=music.wav ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location=music.ogg
              gst-launch-1.0 filesrc location=music.wav ! wavparse ! audioconvert ! lamemp3enc ! filesink location=music.mp3

       从光盘中抓取所有音轨并将其转换为单个mp3文件
              gst-launch-1.0 cdparanoiasrc mode=continuous ! audioconvert ! lamemp3enc ! mpegaudioparse ! id3v2mux ! filesink location=cd.mp3

       从CD中抓取第5首曲目并将其转换为单个mp3文件
              gst-launch-1.0 cdparanoiasrc track=5 ! audioconvert ! lamemp3enc ! mpegaudioparse ! id3v2mux ! filesink location=track5.mp3

       使用gst-inspect-1.0(1),可以发现像上述cdparanoiasrc的设置,它将告诉它抓取整个cd或其上的音轨。或者,您可以使用URI,gst-launch-1.0将为您找到一个支持该协议的元素(如cdparanoia),例如:
              gst-launch-1.0 cdda://5 ! lamemp3enc vbr=new vbr-quality=6 ! filesink location=track5.mp3

       从您的音频输入录制声音并将其编码为ogg文件
              gst-launch-1.0 pulsesrc ! audioconvert ! vorbisenc ! oggmux ! filesink location=input.ogg

       视频
	   
       仅显示MPEG-1视频文件的视频部分,输出到X显示窗口
              gst-launch-1.0 filesrc location=JB_FF9_TheGravityOfLove.mpg ! dvddemux ! mpegvideoparse ! mpeg2dec ! xvimagesink

       显示.vob文件(用于DVD上)的视频部分,输出到SDL窗口
              gst-launch-1.0 filesrc location=/flflfj.vob ! dvddemux ! mpegvideoparse ! mpeg2dec ! sdlvideosink

       播放MPEG电影的视频和音频部分
              gst-launch-1.0 filesrc location=movie.mpg ! dvddemux name=demuxer  demuxer. ! queue ! mpegvideoparse ! mpeg2dec ! sdlvideosink  demuxer. ! queue ! mpegaudioparse ! mpg123audiodec !  audioconvert
       ! audioresample ! pulsesink

       播放带有外部文本字幕流的AVI电影
              gst-launch-1.0 filesrc location=movie.mpg ! mpegdemux name=demuxer demuxer. ! queue ! mpegvideoparse ! mpeg2dec ! videoconvert ! sdlvideosink   demuxer. ! queue ! mpegaudioparse ! mpg123audiodec
       ! audioconvert ! audioresample ! pulsesink

       此示例还展示了如何通过名称引用特定垫片,如果元素(在这里:textoverlay)具有多个接收器或源垫片。
              gst-launch-1.0 textoverlay name=overlay ! videoconvert ! videoscale !  autovideosink   filesrc location=movie.avi ! decodebin ! videoconvert ! overlay.video_sink   filesrc  location=movie.srt  !
       subparse ! overlay.text_sink
	   
       使用playbin播放带有外部文本字幕流的AVI电影
              gst-launch-1.0 playbin uri=file:///path/to/movie.avi suburi=file:///path/to/movie.srt

       网络流媒体

       使用RTP和网络元素传输视频。

       此命令将在发送端运行
              gst-launch-1.0 v4l2src ! video/x-raw,width=128,height=96,format=UYVY ! videoconvert ! ffenc_h263 ! video/x-h263 ! rtph263ppay pt=96 ! udpsink host=192.168.1.1 port=5000

       在接收端使用此命令
              gst-launch-1.0 udpsrc port=5000 ! application/x-rtp, clock-rate=90000,payload=96 ! rtph263pdepay queue-delay=0 ! ffdec_h263 ! xvimagesink

       诊断

       生成一个空流并忽略它(并打印出详细信息)。
              gst-launch-1.0 -v fakesrc num-buffers=16 ! fakesink

       生成一个纯音调以测试音频输出
              gst-launch-1.0 audiotestsrc ! audioconvert ! audioresample ! pulsesink

       生成一个熟悉的测试图案以测试视频输出
              gst-launch-1.0 videotestsrc ! xvimagesink
              gst-launch-1.0 videotestsrc ! ximagessink

       自动链接

       你可以使用decodebin元素自动选择正确的元素以获得一个工作的管道。

       播放任何支持的音频格式
              gst-launch-1.0 filesrc location=musicfile ! decodebin ! audioconvert ! audioresample ! pulsesink

       播放任何支持的视频格式,包括视频和音频输出。线程会自动使用。为了使这更加简单,您可以使用playbin元素:
              gst-launch-1.0 filesrc location=videofile ! decodebin name=decoder decoder. ! queue ! audioconvert ! audioresample ! pulsesink   decoder. !  videoconvert ! xvimagesink
              gst-launch-1.0 playbin uri=file:///home/joe/foo.avi

       过滤连接

       这些示例展示了如何使用过滤的caps。

       显示一个测试图像,并使用YUY2或YV12视频格式。
              gst-launch-1.0 videotestsrc ! 'video/x-raw,format=YUY2;video/x-raw,format=YV12' ! xvimagesink

       录制音频并将其写入.wav文件。强制使用有符号的16到32位样本以及32kHz到64KHz之间的采样率。
              gst-launch-1.0 pulsesrc !  'audio/x-raw,rate=[32000,64000],format={S16LE,S24LE,S32LE}' ! wavenc ! filesink location=recording.wav
		   


环境变量
       GST_DEBUG
              以逗号分隔的调试类别和级别列表(例如 GST_DEBUG=totem:4,typefind:5)。允许使用''作为通配符作为调试类别名称的一部分(例如 GST_DEBUG=sink:6,audio:6)。自1.2.0起,还可以通过名称指定日志级别(1=ERROR, 2=WARN, 3=FIXME, 4=INFO, 5=DEBUG, 6=LOG, 7=TRACE, 9=MEMDUMP)(例如 GST_DEBUG=audio:LOG)

       GST_DEBUG_NO_COLOR
              当设置此环境变量时,禁用彩色调试输出。

       GST_DEBUG_DUMP_DOT_DIR
              当设置为文件系统路径时,将流水线图的'dot'文件存储在那里。然后可以使用graphviz工具集的'dot'实用程序将这些文件转换为图像,如下所示:dot foo.dot -Tsvg -o foo.svg(png或jpg也作为输出格式可能)。还有一个名为'xdot'的实用程序,允许您直接查看.dot文件,而无需首先转换它。
              当流水线状态从NULL变为PLAYING再变回NULL时,每次状态变化都会生成一个dot文件。要编写流水线状态的快照,向进程发送SIGHUP信号。

       GST_REGISTRY
              插件注册表文件的路径。默认为~/.cache/gstreamer-1.0/registry-CPU.bin,其中CPU是GStreamer编译的机器/cpu类型,例如'i486', 'i686', 'x86-64', 'ppc'等(检查“uname -i”和“uname -m”的输出以获取详细信息)。

       GST_REGISTRY_UPDATE
              设置为"no"以强制GStreamer假设没有插件更改、添加或移除。这将使GStreamer跳过是否需要重建注册表缓存的初始检查。这在嵌入式环境中可能有用,因为安装的插件永远不会改变。不要在任何其他设置中使用此选项。

       GST_PLUGIN_PATH
              指定要扫描的附加插件目录列表。这些优先于系统插件。

       GST_PLUGIN_SYSTEM_PATH
              指定一组始终默认加载的插件。如果未设置,这将默认为系统安装的路径和用户主目录中安装的插件

       GST_DEBUG_FILE
              将此变量设置为文件路径,将所有GStreamer调试消息重定向到该文件。如果未设置,调试消息将输出到标准错误。

       ORC_CODE
              有用的Orc环境变量。设置ORC_CODE=debug以启用调试器(如gdb)从Orc生成的代码创建有用的回溯。如果您怀疑Orc的SIMD代码生成器产生了不正确的代码,请设置ORC_CODE=backup或ORC_CODE=emulate。(许多重要的GStreamer插件如videotestsrc、audioconvert或audioresample使用Orc)。

       G_DEBUG
              有用的GLib环境变量。设置G_DEBUG=fatal_warnings以使GStreamer程序在发生临界警告(如断言失败)时中止。如果您想找出哪部分代码触发了该警告以及在什么情况下触发,这是有用的。只需按照上述方式设置G_DEBUG并运行程序在gdb中(或让其核心转储)。然后以通常的方式获取堆栈跟踪。

文件
       ~/.cache/gstreamer-1.0/registry-*.bin
              插件缓存;可以随时删除,如果不存在或插件更改,将自动重新创建。基于XDG_CACHE_DIR,因此可能位于建议的位置之外的其他地方。

SEE ALSO
       gst-inspect-1.0(1), gst-launch-1.0(1),

作者
GStreamer团队 http://gstreamer.freedesktop.org/

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值