Merge svn changes up to r28162
[mplayer.git] / DOCS / tech / slave.txt
blob2ad276defd02199017a7942eef57286408d03d50
1 SLAVE MODE PROTOCOL
2 -------------------
4 The -slave option switches on slave mode, in which MPlayer works as a backend
5 for other programs. Instead of intercepting keyboard events, MPlayer will read
6 commands separated by a newline (\n) from stdin.
8 To try slave mode out by hand, run
10   mplayer -slave -quiet <movie>
12 and type slave commands into the console window.
14 You can also use a fifo file (named pipe):
16   mkfifo </tmp/fifofile>
17   mplayer -slave -input file=</tmp/fifofile> <movie>
19 Most slave mode commands are equivalent to command line options, though not
20 necessarily under the same name. Detailed descriptions can be found in the
21 man page.
23 All commands can be prefixed with one of "pausing ", "pausing_keep ", or
24 "pausing_toggle ". "pausing " tells MPlayer to pause as soon as possible
25 after processing the command. "pausing_keep " tells MPlayer to do so only if
26 it was already in paused mode. "pausing_toggle " tells MPlayer to do so
27 only if it was not already in paused mode. Please note that "as soon as
28 possible" can be before the command is fully executed.
29 As a temporary hack, there is also the _experimental_ "pausing_keep_force "
30 prefix, with which MPlayer will not exit the pause loop at all.
31 Like this you can avoid the "frame stepping" effect of "pausing_keep "
32 but most commands will either not work at all or behave in unexpected ways.
35 Available commands ('mplayer -input cmdlist' will print a list):
38 alt_src_step <value> (ASX playlist only)
39     When more than one source is available it selects the next/previous one.
41 audio_delay <value> [abs]
42     Set/adjust the audio delay.
43     If [abs] is not given or is zero, adjust the delay by <value> seconds.
44     If [abs] is nonzero, set the delay to <value> seconds.
46 [brightness|contrast|gamma|hue|saturation] <value> [abs]
47     Set/adjust video parameters.
48     If [abs] is not given or is zero, modifies parameter by <value>.
49     If [abs] is non-zero, parameter is set to <value>.
50     <value> is in the range [-100, 100].
52 change_rectangle <val1> <val2>
53     Change the position of the rectangle filter rectangle.
54         <val1>
55             Must be one of the following:
56                 0 = width
57                 1 = height
58                 2 = x position
59                 3 = y position
60         <val2>
61             If <val1> is 0 or 1:
62                 Integer amount to add/subtract from the width/height.
63                 Positive values add to width/height and negative values
64                 subtract from it.
65             If <val1> is 2 or 3:
66                 Relative integer amount by which to move the upper left
67                 rectangle corner. Positive values move the rectangle
68                 right/down and negative values move the rectangle left/up.
70 dvb_set_channel <channel_number> <card_number>
71     Set DVB channel.
73 dvdnav <button_name>
74     Press the given dvdnav button.
75         up
76         down
77         left
78         right
79         menu
80         select
81         prev
82         mouse
84 edl_mark
85     Write the current position into the EDL file.
87 frame_drop [value]
88     Toggle/set frame dropping mode.
90 get_audio_bitrate
91     Print out the audio bitrate of the current file.
93 get_audio_codec
94     Print out the audio codec name of the current file.
96 get_audio_samples
97     Print out the audio frequency and number of channels of the current file.
99 get_file_name
100     Print out the name of the current file.
102 get_meta_album
103     Print out the 'Album' metadata of the current file.
105 get_meta_artist
106     Print out the 'Artist' metadata of the current file.
108 get_meta_comment
109     Print out the 'Comment' metadata of the current file.
111 get_meta_genre
112     Print out the 'Genre' metadata of the current file.
114 get_meta_title
115     Print out the 'Title' metadata of the current file.
117 get_meta_track
118     Print out the 'Track Number' metadata of the current file.
120 get_meta_year
121     Print out the 'Year' metadata of the current file.
123 get_percent_pos
124     Print out the current position in the file, as integer percentage [0-100).
126 get_property <property>
127     Print out the current value of a property.
129 get_sub_visibility
130     Print out subtitle visibility (1 == on, 0 == off).
132 get_time_length
133     Print out the length of the current file in seconds.
135 get_time_pos
136     Print out the current position in the file in seconds, as float.
138 get_vo_fullscreen
139     Print out fullscreen status (1 == fullscreened, 0 == windowed).
141 get_video_bitrate
142     Print out the video bitrate of the current file.
144 get_video_codec
145     Print out the video codec name of the current file.
147 get_video_resolution
148     Print out the video resolution of the current file.
150 screenshot <value>
151     Take a screenshot. Requires the screenshot filter to be loaded.
152         0 Take a single screenshot.
153         1 Start/stop taking screenshot of each frame.
155 gui_[about|loadfile|loadsubtitle|play|playlist|preferences|skinbrowser|stop]
156     GUI actions
158 key_down_event <value>
159     Inject <value> key code event into MPlayer.
161 loadfile <file|url> <append>
162     Load the given file/URL, stopping playback of the current file/URL.
163     If <append> is nonzero playback continues and the file/URL is
164     appended to the current playlist instead.
166 loadlist <file> <append>
167     Load the given playlist file, stopping playback of the current file.
168     If <append> is nonzero playback continues and the playlist file is
169     appended to the current playlist instead.
171 loop <value> [abs]
172     Adjust/set how many times the movie should be looped. -1 means no loop,
173     and 0 forever.
175 menu <command>
176     Execute an OSD menu command.
177         up     Move cursor up.
178         down   Move cursor down.
179         ok     Accept selection.
180         cancel Cancel selection.
181         hide   Hide the OSD menu.
183 set_menu <menu_name>
184     Display the menu named <menu_name>.
186 mute [value]
187     Toggle sound output muting or set it to [value] when [value] >= 0
188     (1 == on, 0 == off).
190 osd [level]
191     Toggle OSD mode or set it to [level] when [level] >= 0.
193 osd_show_property_text <string> [duration] [level]
194     Show an expanded property string on the OSD, see -playing-msg for a
195     description of the available expansions. If [duration] is >= 0 the text
196     is shown for [duration] ms. [level] sets the minimum OSD level needed
197     for the message to be visible (default: 0 - always show).
199 osd_show_text <string> [duration] [level]
200     Show <string> on the OSD.
202 panscan <-1.0 - 1.0> | <0.0 - 1.0> <abs>
203     Increase or decrease the pan-and-scan range by <value>, 1.0 is the maximum.
204     Negative values decrease the pan-and-scan range.
205     If <abs> is != 0, then the pan-and scan range is interpreted as an
206     absolute range.
208 pause
209     Pause/unpause the playback.
211 frame_step
212     Play one frame, then pause again.
214 pt_step <value> [force]
215     Go to the next/previous entry in the playtree. The sign of <value> tells
216     the direction.  If no entry is available in the given direction it will do
217     nothing unless [force] is non-zero.
219 pt_up_step <value> [force]
220     Similar to pt_step but jumps to the next/previous entry in the parent list.
221     Useful to break out of the inner loop in the playtree.
223 quit [value]
224     Quit MPlayer. The optional integer [value] is used as the return code
225     for the mplayer process (default: 0).
227 radio_set_channel <channel>
228     Switch to <channel>. The 'channels' radio parameter needs to be set.
230 radio_set_freq <frequency in MHz>
231     Set the radio tuner frequency.
233 radio_step_channel <-1|1>
234     Step forwards (1) or backwards (-1) in channel list. Works only when the
235     'channels' radio parameter was set.
237 radio_step_freq <value>
238     Tune frequency by the <value> (positive - up, negative - down). 
240 seek <value> [type]
241     Seek to some place in the movie.
242         0 is a relative seek of +/- <value> seconds (default).
243         1 is a seek to <value> % in the movie.
244         2 is a seek to an absolute position of <value> seconds.
246 seek_chapter <value> [type]
247     Seek to the start of a chapter.
248         0 is a relative seek of +/- <value> chapters (default).
249         1 is a seek to chapter <value>.
251 switch_angle <value>
252     Switch to the angle with the ID [value]. Cycle through the
253     available angles if [value] is omitted or negative.
255 set_mouse_pos <x> <y>
256     Tells MPlayer the coordinates of the mouse in the window.
257     This command doesn't move the mouse!
259 set_property <property> <value>
260     Set a property.
262 speed_incr <value>
263     Add <value> to the current playback speed.
265 speed_mult <value>
266     Multiply the current speed by <value>.
268 speed_set <value>
269     Set the speed to <value>.
271 step_property <property> [value] [direction]
272     Change a property by value, or increase by a default if value is
273     not given or zero. The direction is reversed if direction is less
274     than zero.
276 stop
277     Stop playback.
279 sub_alignment [value]
280     Toggle/set subtitle alignment.
281         0 top alignment
282         1 center alignment
283         2 bottom alignment
285 sub_delay <value> [abs]
286     Adjust the subtitle delay by +/- <value> seconds or set it to <value>
287     seconds when [abs] is nonzero.
289 sub_load <subtitle_file>
290     Loads subtitles from <subtitle_file>.
292 sub_log
293     Logs the current or last displayed subtitle together with filename
294     and time information to ~/.mplayer/subtitle_log. Intended purpose
295     is to allow convenient marking of bogus subtitles which need to be
296     fixed while watching the movie.
298 sub_pos <value> [abs]
299     Adjust/set subtitle position.
301 sub_remove [value]
302     If the [value] argument is present and non-negative, removes the subtitle
303     file with index [value]. If the argument is omitted or negative, removes
304     all subtitle files.
306 sub_select [value]
307     Display subtitle with index [value]. Turn subtitle display off if
308     [value] is -1 or greater than the highest available subtitle index.
309     Cycle through the available subtitles if [value] is omitted or less
310     than -1. Supported subtitle sources are -sub options on the command
311     line, VOBsubs, DVD subtitles, and Ogg and Matroska text streams.
312     This command is mainly for cycling all subtitles, if you want to set
313     a specific subtitle, use sub_file, sub_vob, or sub_demux.
315 sub_source [source]
316     Display first subtitle from [source]. Here [source] is an integer:
317     SUB_SOURCE_SUBS   (0) for file subs
318     SUB_SOURCE_VOBSUB (1) for VOBsub files
319     SUB_SOURCE_DEMUX  (2) for subtitle embedded in the media file or DVD subs.
320     If [source] is -1, will turn off subtitle display. If [source] less than -1,
321     will cycle between the first subtitle of each currently available sources.
323 sub_file [value]
324     Display subtitle specifid by [value] for file subs. The [value] is
325     corresponding to ID_FILE_SUB_ID values reported by '-identify'.
326     If [value] is -1, will turn off subtitle display. If [value] less than -1,
327     will cycle all file subs.
329 sub_vob [value]
330     Display subtitle specifid by [value] for vobsubs. The [value] is
331     corresponding to ID_VOBSUB_ID values reported by '-identify'.
332     If [value] is -1, will turn off subtitle display. If [value] less than -1,
333     will cycle all vobsubs.
335 sub_demux [value]
336     Display subtitle specifid by [value] for subtitles from DVD or embedded
337     in media file. The [value] is corresponding to ID_SUBTITLE_ID values
338     reported by '-identify'. If [value] is -1, will turn off subtitle display.
339     If [value] less than -1, will cycle all DVD subs or embedded subs.
341 sub_scale <value> [abs]
342     Adjust the subtitle size by +/- <value> or set it to <value> when [abs]
343     is nonzero.
345 vobsub_lang
346     This is a stub linked to sub_select for backwards compatibility.
348 sub_step <value>
349     Step forward in the subtitle list by <value> steps or backwards if <value>
350     is negative.
352 sub_visibility [value]
353     Toggle/set subtitle visibility.
355 forced_subs_only [value]
356     Toggle/set forced subtitles only.
358 switch_audio [value] (currently MPEG*, AVI, Matroska and streams handled by libavformat)
359     Switch to the audio track with the ID [value]. Cycle through the
360     available tracks if [value] is omitted or negative.
362 switch_angle [value] (DVDs only)
363     Switch to the DVD angle with the ID [value]. Cycle through the
364     available angles if [value] is omitted or negative.
366 switch_ratio [value]
367     Change aspect ratio at runtime. [value] is the new aspect ratio expressed
368     as a float (e.g. 1.77778 for 16/9).
369     There might be problems with some video filters.
371 switch_title [value] (DVDNAV only)
372     Switch to the DVD title with the ID [value]. Cycle through the
373     available titles if [value] is omitted or negative.
375 switch_vsync [value]
376     Toggle vsync (1 == on, 0 == off). If [value] is not provided,
377     vsync status is inverted.
379 teletext_add_digit <value>
380     Enter/leave teletext page number editing mode and append given digit to
381     previously entered one.
382     0..9 - Append apropriate digit. (Enables editing mode if called from normal
383            mode, and switches to normal mode when third digit is entered.)
384     -    - Delete last digit from page number. (Backspace emulation, works only
385            in page number editing mode.)
387 teletext_go_link <1-6>
388     Follow given link on current teletext page.
390 tv_start_scan
391     Start automatic TV channel scanning.
393 tv_step_channel <channel>
394     Select next/previous TV channel.
396 tv_step_norm
397     Change TV norm.
399 tv_step_chanlist
400     Change channel list.
402 tv_set_channel <channel>
403     Set the current TV channel.
405 tv_last_channel
406     Set the current TV channel to the last one.
408 tv_set_freq <frequency in MHz>
409     Set the TV tuner frequency.
411 tv_step_freq <frequency offset in MHz>
412     Set the TV tuner frequency relative to current value.
414 tv_set_norm <norm>
415     Set the TV tuner norm (PAL, SECAM, NTSC, ...).
417 tv_set_brightness <-100 - 100> [abs]
418     Set TV tuner brightness or adjust it if [abs] is set to 0.
420 tv_set_contrast <-100 -100> [abs]
421     Set TV tuner contrast or adjust it if [abs] is set to 0.
423 tv_set_hue <-100 - 100> [abs]
424     Set TV tuner hue or adjust it if [abs] is set to 0.
426 tv_set_saturation <-100 - 100> [abs]
427     Set TV tuner saturation or adjust it if [abs] is set to 0.
429 use_master
430     Switch volume control between master and PCM.
432 vo_border [value]
433     Toggle/set borderless display.
435 vo_fullscreen [value]
436     Toggle/set fullscreen mode.
438 vo_ontop [value]
439     Toggle/set stay-on-top.
441 vo_rootwin [value]
442     Toggle/set playback on the root window.
444 volume <value> [abs]
445     Increase/decrease volume or set it to <value> if [abs] is nonzero.
448 The following commands are really only useful for OSD menu console mode:
450 help
451     Displays help text, currently empty.
453 exit
454     Exits from OSD menu console. Unlike 'quit', does not quit MPlayer.
456 hide
457     Hides the OSD menu console. Clicking a menu command unhides it. Other
458     keybindings act as usual.
460 run <value>
461     Run <value> as shell command. In OSD menu console mode stdout and stdin
462     are through the video output driver.
465 Available properties:
467 name               type      min     max     get set step comment
468 =================================================================
470 osdlevel           int       0       3       X   X   X    as -osdlevel
471 speed              float     0.01    100     X   X   X    as -speed
472 loop               int       -1              X   X   X    as -loop
473 pause              flag      0       1       X            1 if paused, use with pausing_keep_force
474 filename           string                    X            file playing wo path
475 path               string                    X            file playing
476 demuxer            string                    X            demuxer used
477 stream_pos         pos       0               X   X        position in stream
478 stream_start       pos       0               X            start pos in stream
479 stream_end         pos       0               X            end pos in stream
480 stream_length      pos       0               X            (end - start)
481 chapter            int       0               X   X   X    select chapter
482 chapters           int                       X            number of chapters
483 angle              int       0               X   X   X    select angle
484 length             time                      X            length of file in seconds
485 percent_pos        int       0       100     X   X   X    position in percent
486 time_pos           time      0               X   X   X    position in seconds
487 metadata           str list                  X            list of metadata key/value
488 metadata/*         string                    X            metadata values
489 volume             float     0       100     X   X   X    change volume
490 balance            float     -1      1       X   X   X    change audio balance
491 mute               flag      0       1       X   X   X
492 audio_delay        float     -100    100     X   X   X
493 audio_format       int                       X
494 audio_codec        string                    X
495 audio_bitrate      int                       X
496 samplerate         int                       X
497 channels           int                       X
498 switch_audio       int       -2      255     X   X   X    select audio stream
499 switch_angle       int       -2      255     X   X   X    select DVD angle
500 switch_title       int       -2      255     X   X   X    select DVD title
501 fullscreen         flag      0       1       X   X   X
502 deinterlace        flag      0       1       X   X   X
503 ontop              flag      0       1       X   X   X
504 rootwin            flag      0       1       X   X   X
505 border             flag      0       1       X   X   X
506 framedropping      int       0       2       X   X   X    1 = soft, 2 = hard
507 gamma              int       -100    100     X   X   X
508 brightness         int       -100    100     X   X   X
509 contrast           int       -100    100     X   X   X
510 saturation         int       -100    100     X   X   X
511 hue                int       -100    100     X   X   X
512 panscan            float     0       1       X   X   X
513 vsync              flag      0       1       X   X   X
514 video_format       int                       X
515 video_codec        string                    X
516 video_bitrate      int                       X
517 width              int                       X            "display" width
518 height             int                       X            "display" height
519 fps                float                     X
520 aspect             float                     X
521 switch_video       int       -2      255     X   X   X    select video stream
522 switch_program     int       -1      65535   X   X   X    (see TAB default keybind)
523 sub                int       -1              X   X   X    select subtitle stream
524 sub_source         int       -1      2       X   X   X    select subtitle source
525 sub_file           int       -1              X   X   X    select file subtitles
526 sub_vob            int       -1              X   X   X    select vobsubs
527 sub_demux          int       -1              X   X   X    select subs from demux
528 sub_delay          float                     X   X   X
529 sub_pos            int       0       100     X   X   X    subtitle position
530 sub_alignment      int       0       2       X   X   X    subtitle alignment
531 sub_visibility     flag      0       1       X   X   X    show/hide subtitles
532 sub_forced_only    flag      0       1       X   X   X
533 sub_scale          float     0       100     X   X   X    subtitles font size
534 tv_brightness      int       -100    100     X   X   X
535 tv_contrast        int       -100    100     X   X   X
536 tv_saturation      int       -100    100     X   X   X
537 tv_hue             int       -100    100     X   X   X
538 teletext_page      int       0       799     X   X   X
539 teletext_subpage   int       0       64      X   X   X
540 teletext_mode      flag      0       1       X   X   X    0 - off, 1 - on
541 teletext_format    int       0       3       X   X   X    0 - opaque,
542                                                           1 - transparent, 
543                                                           2 - opaque inverted,
544                                                           3 - transp. inv.
545 teletext_half_page int       0       2       X   X   X    0 - off, 1 - top half,
546                                                           2- bottom half