dd2ac3601116983d6e060253fcafa94bf6e8e7df
[platform/upstream/gstreamer.git] / tools / gst-launch.1.in
1 .TH "GStreamer" "1" "May 2007"
2 .SH "NAME"
3 gst\-launch \- build and run a GStreamer pipeline
4 .SH "SYNOPSIS"
5 \fBgst\-launch\fR \fI[OPTION...]\fR PIPELINE\-DESCRIPTION
6 .SH "DESCRIPTION"
7 .LP
8 \fIgst\-launch\fP is a tool that builds and runs basic
9 \fIGStreamer\fP pipelines.
10
11 In simple form, a PIPELINE\-DESCRIPTION is a list of
12 elements separated by exclamation marks (!). Properties may be appended to
13 elements, in the form \fIproperty=value\fR.
14
15 For a complete description of possible PIPELINE-DESCRIPTIONS see the section
16 \fIpipeline description\fR below or consult the GStreamer documentation.
17
18 Please note that \fIgst\-launch\fP is primarily a debugging tool for
19 developers and users. You should not build applications on top of it. For
20 applications, use the gst_parse_launch() function of the GStreamer API as an
21 easy way to construct pipelines from pipeline descriptions.
22 .
23 .SH "OPTIONS"
24 .l
25 \fIgst\-launch\fP accepts the following options:
26 .TP 8
27 .B  \-\-help
28 Print help synopsis and available FLAGS
29 .TP 8
30 .B  \-v, \-\-verbose
31 Output status information and property notifications
32 .TP 8
33 .B  \-q, \-\-quiet
34 Do not print any progress information
35 .TP 8
36 .B  \-m, \-\-messages
37 Output messages posted on the pipeline's bus
38 .TP 8
39 .B  \-t, \-\-tags
40 Output tags (also known as metadata)
41 .TP 8
42 .B  \-e, \-\-eos\-on\-shutdown
43 Force an EOS event on sources before shutting the pipeline down. This is
44 useful to make sure muxers create readable files when a muxing pipeline is
45 shut down forcefully via Control-C.
46 .TP 8
47 .B  \-i, \-\-index
48 Gather and print index statistics. This is mostly useful for playback or
49 recording pipelines.
50 .TP 8
51 .B  \-f, \-\-no\-fault
52 Do not install a fault handler
53 .TP 8
54 .B  \-T, \-\-trace
55 Print memory allocation traces. The feature must be enabled at compile time to
56 work.
57 .TP 8
58
59 .
60 .SH "GSTREAMER OPTIONS"
61 .l
62 \fIgst\-launch\fP also accepts the following options that are common
63 to all GStreamer applications:
64 .TP 8
65 .B  \-\-gst\-version
66 Prints the version string of the \fIGStreamer\fP core library.
67 .TP 8
68 .B  \-\-gst\-fatal\-warnings
69 Causes \fIGStreamer\fP to abort if a warning message occurs. This is equivalent
70 to setting the environment variable G_DEBUG to 'fatal_warnings' (see the
71 section \fIenvironment variables\fR below for further information).
72 .TP 8
73 .B  \-\-gst\-debug=STRING
74 A comma separated list of category_name:level pairs to specify debugging levels
75 for each category. Level is in the range 0-9 where 0 will show no messages, and
76 9 will show all messages. The wildcard * can be used to match category names.
77 Note that the order of categories and levels is important, wildcards at the
78 end may override levels set earlier. The log levels are: 1=ERROR, 2=WARNING,
79 3=FIXME, 4=INFO, 5=DEBUG, 6=LOG, 7=TRACE, 9=MEMDUMP. Since GStreamer 1.2 one
80 can also use the debug level names, e.g. \-\-gst\-debug=*sink:LOG. A full
81 description of the various debug levels can be found in the GStreamer core
82 library API documentation, in the "Running GStreamer Applications" section.
83
84 Use \-\-gst\-debug\-help to show category names
85
86 Example:
87 GST_CAT:5,GST_ELEMENT_*:3,oggdemux:5
88
89 .TP 8
90 .B  \-\-gst\-debug\-level=LEVEL
91 Sets the threshold for printing debugging messages.  A higher level
92 will print more messages.  The useful range is 0-9, with the default
93 being 0. Level 6 (LOG level) will show all information that is usually
94 required for debugging purposes. Higher levels are only useful in very
95 specific cases. See above for the full list of levels.
96 .TP 8
97 .B  \-\-gst\-debug\-no\-color
98 \fIGStreamer\fP normally prints debugging messages so that the
99 messages are color-coded when printed to a terminal that handles
100 ANSI escape sequences.  Using this option causes \fIGStreamer\fP
101 to print messages without color. Setting the \fBGST_DEBUG_NO_COLOR\fR
102 environment variable will achieve the same thing.
103 .TP 8
104 .B  \-\-gst\-debug\-color\-mode
105 \fIGStreamer\fP normally prints debugging messages so that the
106 messages are color-coded when printed to a terminal that handles
107 ANSI escape sequences (on *nix), or uses W32 console API to color the
108 messages printed into a console (on W32). Using this option causes
109 \fIGStreamer\fP to print messages without color ('off' or 'disable'),
110 print messages with default colors ('on' or 'auto'), or print messages
111 using ANSI escape sequences for coloring ('unix'). Setting the
112 \fBGST_DEBUG_COLOR_MODE\fR environment variable will achieve the same thing.
113 .TP 8
114 .B  \-\-gst\-debug\-disable
115 Disables debugging.
116 .TP 8
117 .B  \-\-gst\-debug\-help
118 Prints a list of available debug categories and their default debugging level.
119 .TP 8
120 .B  \-\-gst\-plugin\-spew
121 \fIGStreamer\fP info flags to set
122 Enable printout of errors while loading \fIGStreamer\fP plugins
123 .TP 8
124 .B  \-\-gst\-plugin\-path=PATH
125 Add directories separated with ':' to the plugin search path
126 .TP 8
127 .B  \-\-gst\-plugin\-load=PLUGINS
128 Preload plugins specified in a comma-separated list. Another way to specify
129 plugins to preload is to use the environment variable GST_PLUGIN_PATH
130
131 .SH "PIPELINE DESCRIPTION"
132
133 A pipeline consists \fIelements\fR and \fIlinks\fR. \fIElements\fR can be put
134 into \fIbins\fR of different sorts. \fIElements\fR, \fIlinks\fR and \fIbins\fR
135 can be specified in a pipeline description in any order.
136
137 .B Elements
138
139 ELEMENTTYPE \fI[PROPERTY1 ...]\fR
140
141 Creates an element of type ELEMENTTYPE and sets the PROPERTIES.
142
143 .B Properties
144
145 PROPERTY=VALUE ...
146
147 Sets the property to the specified value. You can use \fBgst\-inspect\fR(1) to
148 find out about properties and allowed values of different elements.
149 .br
150 Enumeration properties can be set by name, nick or value.
151
152 .B Bins
153
154 \fI[BINTYPE.]\fR ( \fI[PROPERTY1 ...]\fR PIPELINE-DESCRIPTION )
155 .br
156
157 Specifies that a bin of type BINTYPE is created and the given properties are
158 set. Every element between the braces is put into the bin. Please note the dot
159 that has to be used after the BINTYPE. You will almost never need this
160 functionality, it is only really useful for applications using the
161 gst_launch_parse() API with 'bin' as bintype. That way it is possible to build
162 partial pipelines instead of a full-fledged top-level pipeline.
163
164 .B Links
165
166 \fI[[SRCELEMENT].[PAD1,...]]\fR ! \fI[[SINKELEMENT].[PAD1,...]]\fR
167 \fI[[SRCELEMENT].[PAD1,...]]\fR ! CAPS ! \fI[[SINKELEMENT].[PAD1,...]]\fR
168 \fI[[SRCELEMENT].[PAD1,...]]\fR : \fI[[SINKELEMENT].[PAD1,...]]\fR
169 \fI[[SRCELEMENT].[PAD1,...]]\fR : CAPS : \fI[[SINKELEMENT].[PAD1,...]]\fR
170
171 Links the element with name SRCELEMENT to the element with name SINKELEMENT,
172 using the caps specified in CAPS as a filter.
173 Names can be set on elements with the name property. If the name is omitted, the
174 element that was specified directly in front of or after the link is used. This
175 works across bins. If a padname is given, the link is done with these pads. If
176 no pad names are given all possibilities are tried and a matching pad is used.
177 If multiple padnames are given, both sides must have the same number of pads
178 specified and multiple links are done in the given order.
179 .br
180 So the simplest link is a simple exclamation mark, that links the element to
181 the left of it to the element right of it.
182 .br
183 Linking using the : operator attempts to link all possible pads between
184 the elements
185 .br
186
187 .B Caps
188
189 MEDIATYPE \fI[, PROPERTY[, PROPERTY ...]]]\fR \fI[; CAPS[; CAPS ...]]\fR
190
191 Creates a capability with the given media type and optionally with given
192 properties. The media type can be escaped using " or '.
193 If you want to chain caps, you can add more caps in the same format afterwards.
194
195 .B Properties
196
197 NAME=\fI[(TYPE)]\fRVALUE
198 .br
199 in lists and ranges: \fI[(TYPE)]\fRVALUE
200
201 Sets the requested property in capabilities. The name is an alphanumeric value
202 and the type can have the following case-insensitive values:
203 .br
204 - \fBi\fR or \fBint\fR for integer values or ranges
205 .br
206 - \fBf\fR or \fBfloat\fR for float values or ranges
207 .br
208 - \fBb\fR, \fBbool\fR or \fBboolean\fR for boolean values
209 .br
210 - \fBs\fR, \fBstr\fR or \fBstring\fR for strings
211 .br
212 - \fBfraction\fR for fractions (framerate, pixel\-aspect\-ratio)
213 .br
214 - \fBl\fR or \fBlist\fR for lists
215 .br
216 If no type was given, the following order is tried: integer, float, boolean,
217 string.
218 .br
219 Integer values must be parsable by \fBstrtol()\fP, floats by \fBstrtod()\fP. FOURCC values may
220 either be integers or strings. Boolean values are (case insensitive) \fIyes\fR,
221 \fIno\fR, \fItrue\fR or \fIfalse\fR and may like strings be escaped with " or '.
222 .br
223 Ranges are in this format:  [ VALUE, VALUE ]
224 .br
225 Lists use this format:      { VALUE \fI[, VALUE ...]\fR }
226
227 .SH "PIPELINE EXAMPLES"
228
229 The examples below assume that you have the correct plug-ins available.
230 In general, "pulsesink" can be substituted with another audio output
231 plug-in such as "alsasink" or "osxaudiosink"
232 Likewise, "xvimagesink" can be substituted with "ximagesink", "glimagesink",
233 or "osxvideosink". Keep in mind though that different sinks might
234 accept different formats and even the same sink might accept different formats
235 on different machines, so you might need to add converter elements like
236 audioconvert and audioresample (for audio) or videoconvert (for video)
237 in front of the sink to make things work.
238
239 .B Audio playback
240
241 .B
242         gst\-launch filesrc location=music.mp3 ! mad ! audioconvert ! audioresample ! pulsesink
243 .br
244 Play the mp3 music file "music.mp3" using a libmad-based plug-in and
245 output to an Pulseaudio device
246
247 .B
248         gst\-launch filesrc location=music.ogg ! oggdemux ! vorbisdec ! audioconvert ! audioresample ! pulsesink
249 .br
250 Play an Ogg Vorbis format file
251
252 .B
253         gst\-launch giosrc location=music.mp3 ! mpegaudioparse ! mad ! pulsesink
254 .br
255 .B
256         gst\-launch giosrc location=http://domain.com/music.mp3 ! mpegaudioparse ! mad ! audioconvert ! audioresample ! pulsesink
257 .br
258 Play an mp3 file or an http stream using GIO
259
260 .B
261         gst\-launch giosrc location=smb://computer/music.mp3 ! mpegaudioparse ! mad ! audioconvert ! audioresample ! pulsesink
262 .br
263 Use GIO to play an mp3 file located on an SMB server
264
265 .B Format conversion
266
267 .B
268         gst\-launch filesrc location=music.mp3 ! mpegaudioparse ! mad ! audioconvert ! vorbisenc ! oggmux ! filesink location=music.ogg
269 .br
270 Convert an mp3 music file to an Ogg Vorbis file
271
272 .B
273         gst\-launch filesrc location=music.mp3 ! mpegaudioparse ! mad ! audioconvert ! flacenc ! filesink location=test.flac
274 .br
275 Convert to the FLAC format
276
277 .B Other
278
279 .B
280         gst\-launch filesrc location=music.wav ! wavparse ! audioconvert ! audioresample ! pulsesink
281 .br
282 Plays a .WAV file that contains raw audio data (PCM).
283
284 .B
285         gst\-launch filesrc location=music.wav ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location=music.ogg
286 .br
287 .B
288         gst\-launch filesrc location=music.wav ! wavparse ! audioconvert ! lame ! filesink location=music.mp3
289 .br
290 Convert a .WAV file containing raw audio data into an Ogg Vorbis or mp3 file
291
292 .B
293         gst\-launch cdparanoiasrc mode=continuous ! audioconvert ! lame ! mpegaudioparse ! id3v2mux ! filesink location=cd.mp3
294 .br
295 rips all tracks from compact disc and convert them into a single mp3 file
296
297 .B
298         gst\-launch cdparanoiasrc track=5 ! audioconvert ! lame ! mpegaudioparse ! id3v2mux ! filesink location=track5.mp3
299 .br
300 rips track 5 from the CD and converts it into a single mp3 file
301
302 Using \fBgst\-inspect\fR(1), it is possible to discover settings like the above
303 for cdparanoiasrc that will tell it to rip the entire cd or only tracks of it.
304 Alternatively, you can use an URI and gst\-launch will find an element (such as
305 cdparanoia) that supports that protocol for you, e.g.:
306 .B
307        gst\-launch cdda://5 ! lame vbr=new vbr\-quality=6 ! filesink location=track5.mp3
308
309 .B
310         gst\-launch pulsesrc ! audioconvert ! vorbisenc ! oggmux ! filesink location=input.ogg
311 .br
312 records sound from your audio input and encodes it into an ogg file
313
314 .B Video
315
316 .B
317         gst\-launch filesrc location=JB_FF9_TheGravityOfLove.mpg ! dvddemux ! mpegvideoparse ! mpeg2dec ! xvimagesink
318 .br
319 Display only the video portion of an MPEG-1 video file, outputting to
320 an X display window
321
322 .B
323         gst\-launch filesrc location=/flflfj.vob ! dvddemux ! mpegvideoparse ! mpeg2dec ! sdlvideosink
324 .br
325 Display the video portion of a .vob file (used on DVDs), outputting to
326 an SDL window
327
328 .B
329         gst\-launch filesrc location=movie.mpg ! dvddemux name=demuxer  demuxer. ! queue ! mpegvideoparse ! mpeg2dec ! sdlvideosink  demuxer. ! queue ! mpegaudioparse ! mad ! audioconvert ! audioresample ! pulsesink
330 .br
331 Play both video and audio portions of an MPEG movie
332
333 .B
334         gst\-launch filesrc location=movie.mpg ! mpegdemux name=demuxer demuxer. ! queue ! mpegvideoparse ! mpeg2dec ! videoconvert ! sdlvideosink   demuxer. ! queue ! mpegaudioparse ! mad ! audioconvert ! audioresample ! pulsesink
335 .br
336 Play an AVI movie with an external text subtitle stream
337
338 This example also shows how to refer to specific pads by name if an element
339 (here: textoverlay) has multiple sink or source pads.
340
341 .B
342         gst\-launch textoverlay name=overlay ! videoconvert ! videoscale !  autovideosink   filesrc location=movie.avi ! decodebin ! videoconvert ! overlay.video_sink   filesrc location=movie.srt ! subparse ! overlay.text_sink
343
344 .br
345 Play an AVI movie with an external text subtitle stream using playbin
346
347 .B
348         gst\-launch playbin uri=file:///path/to/movie.avi suburi=file:///path/to/movie.srt
349
350 .B Network streaming
351
352 Stream video using RTP and network elements.
353
354 .B
355         gst\-launch 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
356 .br
357 This command would be run on the transmitter
358
359 .B
360         gst\-launch udpsrc port=5000 ! application/x\-rtp, clock\-rate=90000,payload=96 ! rtph263pdepay queue\-delay=0 ! ffdec_h263 ! xvimagesink
361 .br
362 Use this command on the receiver
363
364 .B Diagnostic
365
366 .B
367         gst\-launch \-v fakesrc num\-buffers=16 ! fakesink
368 .br
369 Generate a null stream and ignore it (and print out details).
370
371 .B
372         gst\-launch audiotestsrc ! audioconvert ! audioresample ! pulsesink
373 .br
374 Generate a pure sine tone to test the audio output
375
376 .B
377         gst\-launch videotestsrc ! xvimagesink
378 .br
379 .B
380         gst\-launch videotestsrc ! ximagesink
381 .br
382 Generate a familiar test pattern to test the video output
383
384 .B Automatic linking
385
386 You can use the decodebin element to automatically select the right elements
387 to get a working pipeline.
388
389 .B
390         gst\-launch filesrc location=musicfile ! decodebin ! audioconvert ! audioresample ! pulsesink
391 .br
392 Play any supported audio format
393
394 .B
395         gst\-launch filesrc location=videofile ! decodebin name=decoder decoder. ! queue ! audioconvert ! audioresample ! pulsesink   decoder. !  videoconvert ! xvimagesink
396 .br
397 Play any supported video format with video and audio output. Threads are used
398 automatically. To make this even easier, you can use the playbin element:
399
400 .B
401         gst\-launch playbin uri=file:///home/joe/foo.avi
402 .br
403
404
405 .B Filtered connections
406
407 These examples show you how to use filtered caps.
408
409 .B
410         gst\-launch videotestsrc ! 'video/x\-raw,format=YUY2;video/x\-raw,format=YV12' ! xvimagesink
411 .br
412 Show a test image and use the YUY2 or YV12 video format for this.
413
414 .B
415         gst\-launch pulsesrc !  'audio/x\-raw,rate=[32000,64000],format={S16LE,S24LE,S32LE}' ! wavenc ! filesink location=recording.wav
416 .br
417 record audio and write it to a .wav file. Force usage of signed 16 to 32 bit
418 samples and a sample rate between 32kHz and 64KHz.
419
420
421 .SH "ENVIRONMENT VARIABLES"
422 .TP
423 \fBGST_DEBUG\fR
424 Comma-separated list of debug categories and levels (e.g.
425 GST_DEBUG=totem:4,typefind:5). '*' is allowed as a wildcard as part of
426 debug category names (e.g. GST_DEBUG=*sink:6,*audio*:6). Since 1.2.0 it is
427 also possible to specify the log level by name (1=ERROR, 2=WARN, 3=FIXME,
428 4=INFO, 5=DEBUG, 6=LOG, 7=TRACE, 9=MEMDUMP) (e.g. GST_DEBUG=*audio*:LOG)
429 .TP
430 \fBGST_DEBUG_NO_COLOR\fR
431 When this environment variable is set, coloured debug output is disabled.
432 .TP
433 \fBGST_DEBUG_DUMP_DOT_DIR\fR
434 When set to a filesystem path, store 'dot' files of pipeline graphs there.
435 These can then later be converted into an image using the 'dot' utility from
436 the graphviz set of tools, like this: dot foo.dot \-Tsvg \-o foo.svg (png or jpg
437 are also possible as output format). There is also a utility called 'xdot'
438 which allows you to view the .dot file directly without converting it first.
439 .TP
440 \fBGST_REGISTRY\fR
441 Path of the plugin registry file. Default is
442 ~/.cache/gstreamer\-GST_API_VERSION/registry\-CPU.bin where CPU is the
443 machine/cpu type GStreamer was compiled for, e.g. 'i486', 'i686', 'x86\-64', 'ppc',
444 etc. (check the output of "uname \-i" and "uname \-m" for details).
445 .TP
446 \fBGST_REGISTRY_UPDATE\fR
447 Set to "no" to force GStreamer to assume that no plugins have changed,
448 been added or been removed. This will make GStreamer skip the initial check
449 whether a rebuild of the registry cache is required or not. This may be useful
450 in embedded environments where the installed plugins never change. Do not
451 use this option in any other setup.
452 .TP
453 \fBGST_PLUGIN_PATH\fR
454 Specifies a list of directories to scan for additional plugins.
455 These take precedence over the system plugins.
456 .TP
457 \fBGST_PLUGIN_SYSTEM_PATH\fR
458 Specifies a list of plugins that are always loaded by default.  If not set,
459 this defaults to the system-installed path, and the plugins installed in the
460 user's home directory
461 .TP
462 \fBGST_DEBUG_FILE\fR
463 Set this variable to a file path to redirect all GStreamer debug
464 messages to this file. If left unset, debug messages with be output
465 unto the standard error.
466 .TP
467 \fBORC_CODE\fR
468 Useful Orc environment variable. Set ORC_CODE=debug to enable debuggers
469 such as gdb to create useful backtraces from Orc-generated code.  Set
470 ORC_CODE=backup or ORC_CODE=emulate if you suspect Orc's SIMD code
471 generator is producing incorrect code.  (Quite a few important
472 GStreamer plugins like videotestsrc, audioconvert or audioresample use Orc).
473 .TP
474 \fBG_DEBUG\fR
475 Useful GLib environment variable. Set G_DEBUG=fatal_warnings to make
476 GStreamer programs abort when a critical warning such as an assertion failure
477 occurs. This is useful if you want to find out which part of the code caused
478 that warning to be triggered and under what circumstances. Simply set G_DEBUG
479 as mentioned above and run the program in gdb (or let it core dump). Then get
480 a stack trace in the usual way.
481 .
482 .SH FILES
483 .TP 8
484 ~/.cache/gstreamer\-GST_API_VERSION/registry\-*.bin
485 The plugin cache; can be deleted at any time, will be re-created
486 automatically when it does not exist yet or plugins change. Based on
487 XDG_CACHE_DIR, so may be in a different location than the one suggested.
488 .
489 .SH "SEE ALSO"
490 .BR gst\-inspect\-GST_API_VERSION (1),
491 .BR gst\-launch\-GST_API_VERSION (1),
492 .SH "AUTHOR"
493 The GStreamer team at http://gstreamer.freedesktop.org/