gstfunnel: avoid access of freed pad
[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-5 where 0 will show no messages, and
76 5 will show all messages. The wildcard * can be used to match category names.
77
78 Use \-\-gst\-debug\-help to show category names
79
80 Example:
81 GST_CAT:5,GST_ELEMENT_*:3,oggdemux:5
82
83 .TP 8
84 .B  \-\-gst\-debug\-level=LEVEL
85 Sets the threshold for printing debugging messages.  A higher level
86 will print more messages.  The useful range is 0-5, with the default
87 being 0.
88 .TP 8
89 .B  \-\-gst\-debug\-no\-color
90 \fIGStreamer\fP normally prints debugging messages so that the
91 messages are color-coded when printed to a terminal that handles
92 ANSI escape sequences.  Using this option causes \fIGStreamer\fP
93 to print messages without color. Setting the \fBGST_DEBUG_NO_COLOR\fR
94 environment variable will achieve the same thing.
95 .TP 8
96 .B  \-\-gst\-debug\-disable
97 Disables debugging.
98 .TP 8
99 .B  \-\-gst\-debug\-help
100 Prints a list of available debug categories and their default debugging level.
101 .TP 8
102 .B  \-\-gst\-plugin\-spew
103 \fIGStreamer\fP info flags to set
104 Enable printout of errors while loading \fIGStreamer\fP plugins
105 .TP 8
106 .B  \-\-gst\-plugin\-path=PATH
107 Add directories separated with ':' to the plugin search path
108 .TP 8
109 .B  \-\-gst\-plugin\-load=PLUGINS
110 Preload plugins specified in a comma-separated list. Another way to specify
111 plugins to preload is to use the environment variable GST_PLUGIN_PATH
112
113 .SH "PIPELINE DESCRIPTION"
114
115 A pipeline consists \fIelements\fR and \fIlinks\fR. \fIElements\fR can be put
116 into \fIbins\fR of different sorts. \fIElements\fR, \fIlinks\fR and \fIbins\fR
117 can be specified in a pipeline description in any order.
118
119 .B Elements
120
121 ELEMENTTYPE \fI[PROPERTY1 ...]\fR
122
123 Creates an element of type ELEMENTTYPE and sets the PROPERTIES.
124
125 .B Properties
126
127 PROPERTY=VALUE ...
128
129 Sets the property to the specified value. You can use \fBgst\-inspect\fR(1) to
130 find out about properties and allowed values of different elements.
131 .br
132 Enumeration properties can be set by name, nick or value.
133
134 .B Bins
135
136 \fI[BINTYPE.]\fR ( \fI[PROPERTY1 ...]\fR PIPELINE-DESCRIPTION )
137 .br
138
139 Specifies that a bin of type BINTYPE is created and the given properties are
140 set. Every element between the braces is put into the bin. Please note the dot
141 that has to be used after the BINTYPE. You will almost never need this
142 functionality, it is only really useful for applications using the
143 gst_launch_parse() API with 'bin' as bintype. That way it is possible to build
144 partial pipelines instead of a full-fledged top-level pipeline.
145
146 .B Links
147
148 \fI[[SRCELEMENT].[PAD1,...]]\fR ! \fI[[SINKELEMENT].[PAD1,...]]\fR
149 \fI[[SRCELEMENT].[PAD1,...]]\fR ! CAPS ! \fI[[SINKELEMENT].[PAD1,...]]\fR
150
151 Links the element with name SRCELEMENT to the element with name SINKELEMENT,
152 using the caps specified in CAPS as a filter.
153 Names can be set on elements with the name property. If the name is omitted, the
154 element that was specified directly in front of or after the link is used. This
155 works across bins. If a padname is given, the link is done with these pads. If
156 no pad names are given all possibilities are tried and a matching pad is used.
157 If multiple padnames are given, both sides must have the same number of pads
158 specified and multiple links are done in the given order.
159 .br
160 So the simplest link is a simple exclamation mark, that links the element to
161 the left of it to the element right of it.
162 .br
163
164 .B Caps
165
166 MIMETYPE \fI[, PROPERTY[, PROPERTY ...]]]\fR \fI[; CAPS[; CAPS ...]]\fR
167
168 Creates a capability with the given mimetype and optionally with given
169 properties. The mimetype can be escaped using " or '.
170 If you want to chain caps, you can add more caps in the same format afterwards.
171
172 .B Properties
173
174 NAME=\fI[(TYPE)]\fRVALUE
175 .br
176 in lists and ranges: \fI[(TYPE)]\fRVALUE
177
178 Sets the requested property in capabilities. The name is an alphanumeric value
179 and the type can have the following case-insensitive values:
180 .br
181 - \fBi\fR or \fBint\fR for integer values or ranges
182 .br
183 - \fBf\fR or \fBfloat\fR for float values or ranges
184 .br
185 - \fB4\fR or \fBfourcc\fR for FOURCC values
186 .br
187 - \fBb\fR, \fBbool\fR or \fBboolean\fR for boolean values
188 .br
189 - \fBs\fR, \fBstr\fR or \fBstring\fR for strings
190 .br
191 - \fBfraction\fR for fractions (framerate, pixel-aspect-ratio)
192 .br
193 - \fBl\fR or \fBlist\fR for lists
194 .br
195 If no type was given, the following order is tried: integer, float, boolean,
196 string.
197 .br
198 Integer values must be parsable by \fBstrtol()\fP, floats by \fBstrtod()\fP. FOURCC values may
199 either be integers or strings. Boolean values are (case insensitive) \fIyes\fR,
200 \fIno\fR, \fItrue\fR or \fIfalse\fR and may like strings be escaped with " or '.
201 .br
202 Ranges are in this format:  [ VALUE, VALUE ]
203 .br
204 Lists use this format:      ( VALUE \fI[, VALUE ...]\fR )
205
206 .SH "PIPELINE EXAMPLES"
207
208 The examples below assume that you have the correct plug-ins available.
209 In general, "osssink" can be substituted with another audio output
210 plug-in such as "esdsink", "alsasink", "osxaudiosink", or "artsdsink".
211 Likewise, "xvimagesink" can be substituted with "ximagesink", "sdlvideosink",
212 "osxvideosink", or "aasink". Keep in mind though that different sinks might
213 accept different formats and even the same sink might accept different formats
214 on different machines, so you might need to add converter elements like
215 audioconvert and audioresample (for audio) or ffmpegcolorspace (for video)
216 in front of the sink to make things work.
217
218 .B Audio playback
219
220 .B
221         gst\-launch filesrc location=music.mp3 ! mad ! audioconvert ! audioresample ! osssink
222 .br
223 Play the mp3 music file "music.mp3" using a libmad-based plug-in and
224 output to an OSS device
225
226 .B
227         gst\-launch filesrc location=music.ogg ! oggdemux ! vorbisdec ! audioconvert ! audioresample ! osssink
228 .br
229 Play an Ogg Vorbis format file
230
231 .B
232         gst\-launch gnomevfssrc location=music.mp3 ! mad ! osssink
233 .br
234 .B
235         gst\-launch gnomevfssrc location=http://domain.com/music.mp3 ! mad ! audioconvert ! audioresample ! osssink
236 .br
237 Play an mp3 file or an http stream using GNOME\-VFS
238
239 .B
240         gst\-launch gnomevfssrc location=smb://computer/music.mp3 ! mad ! audioconvert ! audioresample ! osssink
241 .br
242 Use GNOME\-VFS to play an mp3 file located on an SMB server
243
244 .B Format conversion
245
246 .B
247         gst\-launch filesrc location=music.mp3 ! mad ! audioconvert ! vorbisenc ! oggmux ! filesink location=music.ogg
248 .br
249 Convert an mp3 music file to an Ogg Vorbis file
250
251 .B
252         gst\-launch filesrc location=music.mp3 ! mad ! audioconvert ! flacenc ! filesink location=test.flac
253 .br
254 Convert to the FLAC format
255
256 .B Other
257
258 .B
259         gst\-launch filesrc location=music.wav ! wavparse ! audioconvert ! audioresample ! osssink
260 .br
261 Plays a .WAV file that contains raw audio data (PCM).
262
263 .B
264         gst\-launch filesrc location=music.wav ! wavparse ! audioconvert ! vorbisenc ! oggmux ! filesink location=music.ogg
265 .br
266 .B
267         gst\-launch filesrc location=music.wav ! wavparse ! audioconvert ! lame ! filesink location=music.mp3
268 .br
269 Convert a .WAV file containing raw audio data into an Ogg Vorbis or mp3 file
270
271 .B
272         gst\-launch cdparanoiasrc mode=continuous ! audioconvert ! lame ! id3v2mux ! filesink location=cd.mp3
273 .br
274 rips all tracks from compact disc and convert them into a single mp3 file
275
276 .B
277         gst\-launch cdparanoiasrc track=5 ! audioconvert ! lame ! id3v2mux ! filesink location=track5.mp3
278 .br
279 rips track 5 from the CD and converts it into a single mp3 file
280
281 Using \fBgst\-inspect\fR(1), it is possible to discover settings like the above
282 for cdparanoiasrc that will tell it to rip the entire cd or only tracks of it.
283 Alternatively, you can use an URI and gst-launch will find an element (such as
284 cdparanoia) that supports that protocol for you, e.g.:
285 .B
286        gst\-launch cdda://5 ! lame vbr=new vbr-quality=6 ! filesink location=track5.mp3
287
288 .B
289         gst\-launch osssrc ! audioconvert ! vorbisenc ! oggmux ! filesink location=input.ogg
290 .br
291 records sound from your audio input and encodes it into an ogg file
292
293 .B Video
294
295 .B
296         gst\-launch filesrc location=JB_FF9_TheGravityOfLove.mpg ! dvddemux ! mpeg2dec ! xvimagesink
297 .br
298 Display only the video portion of an MPEG-1 video file, outputting to
299 an X display window
300
301 .B
302         gst\-launch filesrc location=/flflfj.vob ! dvddemux ! mpeg2dec ! sdlvideosink
303 .br
304 Display the video portion of a .vob file (used on DVDs), outputting to
305 an SDL window
306
307 .B
308         gst\-launch filesrc location=movie.mpg ! dvddemux name=demuxer  demuxer. ! queue ! mpeg2dec ! sdlvideosink  demuxer. ! queue ! mad ! audioconvert ! audioresample ! osssink
309 .br
310 Play both video and audio portions of an MPEG movie
311
312 .B
313         gst\-launch filesrc location=movie.mpg ! mpegdemux name=demuxer  demuxer. ! queue ! mpeg2dec ! ffmpegcolorspace ! sdlvideosink   demuxer. ! queue ! mad ! audioconvert ! audioresample ! osssink
314 .br
315 Play an AVI movie with an external text subtitle stream
316
317 This example also shows how to refer to specific pads by name if an element
318 (here: textoverlay) has multiple sink or source pads.
319
320 .B
321         gst\-launch textoverlay name=overlay ! ffmpegcolorspace ! videoscale ! autovideosink   filesrc location=movie.avi ! decodebin2 ! ffmpegcolorspace ! overlay.video_sink   filesrc location=movie.srt ! subparse ! overlay.text_sink
322
323 .br
324 Play an AVI movie with an external text subtitle stream using playbin2
325
326 .B
327         gst\-launch playbin2 uri=file:///path/to/movie.avi suburi=file:///path/to/movie.srt
328
329 .B Network streaming
330
331 Stream video using RTP and network elements.
332
333 .B
334         gst\-launch v4l2src ! video/x-raw-yuv,width=128,height=96,format='(fourcc)'UYVY ! ffmpegcolorspace ! ffenc_h263 ! video/x-h263 ! rtph263ppay pt=96 ! udpsink host=192.168.1.1 port=5000 sync=false
335 .br
336 This command would be run on the transmitter
337
338 .B
339         gst\-launch udpsrc port=5000 ! application/x-rtp, clock-rate=90000,payload=96 ! rtph263pdepay queue-delay=0 ! ffdec_h263 ! xvimagesink
340 .br
341 Use this command on the receiver
342
343 .B Diagnostic
344
345 .B
346         gst\-launch -v fakesrc num-buffers=16 ! fakesink
347 .br
348 Generate a null stream and ignore it (and print out details).
349
350 .B
351         gst\-launch audiotestsrc ! audioconvert ! audioresample ! osssink
352 .br
353 Generate a pure sine tone to test the audio output
354
355 .B
356         gst\-launch videotestsrc ! xvimagesink
357 .br
358 .B
359         gst\-launch videotestsrc ! ximagesink
360 .br
361 Generate a familiar test pattern to test the video output
362
363 .B Automatic linking
364
365 You can use the decodebin element to automatically select the right elements
366 to get a working pipeline.
367
368 .B
369         gst\-launch filesrc location=musicfile ! decodebin ! audioconvert ! audioresample ! osssink
370 .br
371 Play any supported audio format
372
373 .B
374         gst\-launch filesrc location=videofile ! decodebin name=decoder  decoder. ! queue ! audioconvert ! audioresample ! osssink   decoder. ! ffmpegcolorspace ! xvimagesink
375 .br
376 Play any supported video format with video and audio output. Threads are used
377 automatically. To make this even easier, you can use the playbin element:
378
379 .B
380         gst\-launch playbin uri=file:///home/joe/foo.avi
381 .br
382
383
384 .B Filtered connections
385
386 These examples show you how to use filtered caps.
387
388 .B
389         gst\-launch videotestsrc ! 'video/x-raw-yuv,format=(fourcc)YUY2;video/x-raw-yuv,format=(fourcc)YV12' ! xvimagesink
390 .br
391 Show a test image and use the YUY2 or YV12 video format for this.
392
393 .B
394         gst\-launch osssrc ! 'audio/x-raw-int,rate=[32000,64000],width=[16,32],depth={16,24,32},signed=(boolean)true' ! wavenc ! filesink location=recording.wav
395 .br
396 record audio and write it to a .wav file. Force usage of signed 16 to 32 bit
397 samples and a sample rate between 32kHz and 64KHz.
398
399
400 .SH "ENVIRONMENT VARIABLES"
401 .TP
402 \fBGST_DEBUG\fR
403 Comma-separated list of debug categories and levels, e.g.
404 GST_DEBUG=totem:4,typefind:5
405 .TP
406 \fBGST_DEBUG_NO_COLOR\fR
407 When this environment variable is set, coloured debug output is disabled.
408 .TP
409 \fBGST_DEBUG_DUMP_DOT_DIR\fR
410 When set to a filesystem path, store dot files of pipeline graphs there.
411 .TP
412 \fBGST_REGISTRY\fR
413 Path of the plugin registry file. Default is
414 ~/.gstreamer-GST_API_VERSION/registry-CPU.bin where CPU is the machine/cpu type
415 GStreamer was compiled for, e.g. 'i486', 'i686', 'x86-64', 'ppc', etc. (check
416 the output of "uname -i" and "uname -m" for details).
417 .TP
418 \fBGST_REGISTRY_UPDATE\fR
419 Set to "no" to force GStreamer to assume that no plugins have changed,
420 been added or been removed. This will make GStreamer skip the initial check
421 whether a rebuild of the registry cache is required or not. This may be useful
422 in embedded environments where the installed plugins never change. Do not
423 use this option in any other setup.
424 .TP
425 \fBGST_PLUGIN_PATH\fR
426 Specifies a list of directories to scan for additional plugins.
427 These take precedence over the system plugins.
428 .TP
429 \fBGST_PLUGIN_SYSTEM_PATH\fR
430 Specifies a list of plugins that are always loaded by default.  If not set,
431 this defaults to the system-installed path, and the plugins installed in the
432 user's home directory
433 .TP
434 \fBORC_CODE\fR
435 Useful Orc environment variable. Set ORC_CODE=debug to enable debuggers
436 such as gdb to create useful backtraces from Orc-generated code.  Set
437 ORC_CODE=backup or ORC_CODE=emulate if you suspect Orc's SIMD code
438 generator is producing incorrect code.  (Quite a few important
439 GStreamer plugins like videotestsrc, audioconvert or audioresample use Orc).
440 .TP
441 \fBG_DEBUG\fR
442 Useful GLib environment variable. Set G_DEBUG=fatal_warnings to make
443 GStreamer programs abort when a critical warning such as an assertion failure
444 occurs. This is useful if you want to find out which part of the code caused
445 that warning to be triggered and under what circumstances. Simply set G_DEBUG
446 as mentioned above and run the program in gdb (or let it core dump). Then get
447 a stack trace in the usual way.
448 .
449 .SH FILES
450 .TP 8
451 ~/.gstreamer-GST_API_VERSION/registry-*.bin
452 The plugin cache; can be deleted at any time, will be re-created
453 automatically when it does not exist yet or plugins change.
454 .
455 .SH "SEE ALSO"
456 .BR gst\-feedback (1),
457 .BR gst\-inspect (1),
458 .BR gst\-typefind (1)
459 .SH "AUTHOR"
460 The GStreamer team at http://gstreamer.freedesktop.org/