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