summaryrefslogtreecommitdiffstats
path: root/DOCS/tech/slave.txt
blob: d95ef41d8403a7d2ca30da09b36a5c7cb731b2dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
SLAVE MODE PROTOCOL
-------------------

The -slave option switches on slave mode, in which MPlayer works as a backend
for other programs. Instead of intercepting keyboard events, MPlayer will read
commands separated by a newline (\n) from stdin.

To try slave mode out by hand, run

  mplayer -slave -quiet <movie>

and type slave commands into the console window.

You can also use a fifo file (named pipe):

  mkfifo </tmp/fifofile>
  mplayer -slave -input file=</tmp/fifofile> <movie>

Most slave mode commands are equivalent to command line options, though not
necessarily under the same name. Detailed descriptions can be found in the
man page.

NOTE: the following paragraph is mostly obsolete; tricky pause handling
was required in old MPlayer versions where all commands unpaused by default.
Now running commands does not require leaving pause state any more, and
the prefixes described here should not be required in normal use.
All commands can be prefixed with one of "pausing ", "pausing_keep ", or
"pausing_toggle ". "pausing " tells MPlayer to pause as soon as possible
after processing the command. "pausing_keep " tells MPlayer to do so only if
it was already in paused mode. "pausing_toggle " tells MPlayer to do so
only if it was not already in paused mode. Please note that "as soon as
possible" can be before the command is fully executed.
As a temporary hack, there is also the _experimental_ "pausing_keep_force "
prefix, with which MPlayer will not exit the pause loop at all.
Like this you can avoid the "frame stepping" effect of "pausing_keep "
but most commands will either not work at all or behave in unexpected ways.
For "set_mouse_pos" and "key_down_event", "pausing_keep_force" is the default
since other values do not make much sense for them.


Various tips and tricks (please help expand it!):

- To ensure the user can't control MPlayer "behind your back" use
  something like -input nodefault-bindings -noconfig all


Available commands ('mplayer -input cmdlist' will print a list):

af_add <filter_arguments_list>  (comma separated list of audio filters with parameters)
    (experimental) Load the given list of audio filters.

af_clr
    (experimental) Unload all loaded audio filters.

af_cmdline <filter_name> <filter_arguments>
    (experimental) Send new command-line options to a filter with the given name.

af_del <filter_name_list> (comma separated list of audio filter's names)
    (experimental) Unload the first occurrence of the filters, if loaded.

af_switch <filter_arguments_list> (comma separated list of audio filters with parameters)
    (experimental) Remove all the audio filters and replace them with the given list.

alt_src_step <value> (ASX playlist only)
    When more than one source is available it selects the next/previous one.

audio_delay <value> [abs]
    Set/adjust the audio delay.
    If [abs] is not given or is zero, adjust the delay by <value> seconds.
    If [abs] is nonzero, set the delay to <value> seconds.

[brightness|contrast|gamma|hue|saturation] <value> [abs]
    Set/adjust video parameters.
    If [abs] is not given or is zero, modifies parameter by <value>.
    If [abs] is non-zero, parameter is set to <value>.
    <value> is in the range [-100, 100].

capturing [value]
    Toggle/set capturing the primary stream like -dumpstream.
    Requires the -capture parameter to be given.

change_rectangle <val1> <val2>
    Change the position of the rectangle filter rectangle.
        <val1>
            Must be one of the following:
                0 = width
                1 = height
                2 = x position
                3 = y position
        <val2>
            If <val1> is 0 or 1:
                Integer amount to add/subtract from the width/height.
                Positive values add to width/height and negative values
                subtract from it.
            If <val1> is 2 or 3:
                Relative integer amount by which to move the upper left
                rectangle corner. Positive values move the rectangle
                right/down and negative values move the rectangle left/up.

dvb_set_channel <channel_number> <card_number>
    Set DVB channel.

dvdnav <button_name>
    Press the given dvdnav button.
        up
        down
        left
        right
        menu
        select
        prev
        mouse

edl_mark
    Write the current position into the EDL file.

frame_drop [value]
    Toggle/set frame dropping mode.

get_audio_bitrate
    Print out the audio bitrate of the current file.

get_audio_codec
    Print out the audio codec name of the current file.

get_audio_samples
    Print out the audio frequency and number of channels of the current file.

get_file_name
    Print out the name of the current file.

get_meta_album
    Print out the 'Album' metadata of the current file.

get_meta_artist
    Print out the 'Artist' metadata of the current file.

get_meta_comment
    Print out the 'Comment' metadata of the current file.

get_meta_genre
    Print out the 'Genre' metadata of the current file.

get_meta_title
    Print out the 'Title' metadata of the current file.

get_meta_track
    Print out the 'Track Number' metadata of the current file.

get_meta_year
    Print out the 'Year' metadata of the current file.

get_percent_pos
    Print out the current position in the file, as integer percentage [0-100).

get_property <property>
    Print out the current value of a property.

get_sub_visibility
    Print out subtitle visibility (1 == on, 0 == off).

get_time_length
    Print out the length of the current file in seconds.

get_time_pos
    Print out the current position in the file in seconds, as float.

get_vo_fullscreen
    Print out fullscreen status (1 == fullscreened, 0 == windowed).

get_video_bitrate
    Print out the video bitrate of the current file.

get_video_codec
    Print out the video codec name of the current file.

get_video_resolution
    Print out the video resolution of the current file.

screenshot <value>
    Take a screenshot. Requires the screenshot filter to be loaded.
        0 Take a single screenshot.
        1 Start/stop taking screenshot of each frame.

key_down_event <value>
    Inject <value> key code event into MPlayer.

loadfile <file|url> <append>
    Load the given file/URL, stopping playback of the current file/URL.
    If <append> is nonzero playback continues and the file/URL is
    appended to the current playlist instead.

loadlist <file> <append>
    Load the given playlist file, stopping playback of the current file.
    If <append> is nonzero playback continues and the playlist file is
    appended to the current playlist instead.

loop <value> [abs]
    Adjust/set how many times the movie should be looped. -1 means no loop,
    and 0 forever.

menu <command>
    Execute an OSD menu command.
        up     Move cursor up.
        down   Move cursor down.
        ok     Accept selection.
        cancel Cancel selection.
        hide   Hide the OSD menu.

set_menu <menu_name>
    Display the menu named <menu_name>.

mute [value]
    Toggle sound output muting or set it to [value] when [value] >= 0
    (1 == on, 0 == off).

osd [level]
    Toggle OSD mode or set it to [level] when [level] >= 0.

osd_show_progression
    Show the progression bar, the elapsed time and the total duration of the
    movie on the OSD.

osd_show_property_text <string> [duration] [level]
    Show an expanded property string on the OSD, see -playing-msg for a
    description of the available expansions. If [duration] is >= 0 the text
    is shown for [duration] ms. [level] sets the minimum OSD level needed
    for the message to be visible (default: 0 - always show).

osd_show_text <string> [duration] [level]
    Show <string> on the OSD.

panscan <-1.0 - 1.0> | <0.0 - 1.0> <abs>
    Increase or decrease the pan-and-scan range by <value>, 1.0 is the maximum.
    Negative values decrease the pan-and-scan range.
    If <abs> is != 0, then the pan-and scan range is interpreted as an
    absolute range.

pause
    Pause/unpause the playback (use "set_property pause X" to set a particular
    value regardless of whether the player is already paused or not).

frame_step
    Play one frame, then pause again.

pt_step <value> [force]
    Go to the next/previous entry in the playtree. The sign of <value> tells
    the direction.  If no entry is available in the given direction it will do
    nothing unless [force] is non-zero.

pt_up_step <value> [force]
    Similar to pt_step but jumps to the next/previous entry in the parent list.
    Useful to break out of the inner loop in the playtree.

quit [value]
    Quit MPlayer. The optional integer [value] is used as the return code
    for the mplayer process (default: 0).

radio_set_channel <channel>
    Switch to <channel>. The 'channels' radio parameter needs to be set.

radio_set_freq <frequency in MHz>
    Set the radio tuner frequency.

radio_step_channel <-1|1>
    Step forwards (1) or backwards (-1) in channel list. Works only when the
    'channels' radio parameter was set.

radio_step_freq <value>
    Tune frequency by the <value> (positive - up, negative - down).

seek <value> [type] [hr-seek]
    Seek to some place in the movie.
        type = 0 is a relative seek of +/- <value> seconds (default).
        type = 1 is a seek to <value> % in the movie.
        type = 2 is a seek to an absolute position of <value> seconds.
    The hr-seek parameter controls whether to use precise seeks (not limited
    to keyframe positions in video).
        hr-seek = 0 means use default set with option -hr-seek (default).
        hr-seek = 1 means force precise seek if possible.
        hr-seek = -1 means force non-precise seek.

seek_chapter <value> [type]
    Seek to the start of a chapter.
        0 is a relative seek of +/- <value> chapters (default).
        1 is a seek to chapter <value>.

switch_angle <value>
    Switch to the angle with the ID [value]. Cycle through the
    available angles if [value] is omitted or negative.

set_mouse_pos <x> <y>
    Tells MPlayer the coordinates of the mouse in the window.
    This command doesn't move the mouse!

set_property <property> <value>
    Set a property.

set_property_osd <property> <value>
    Same as above, but show the new value on the OSD in the standard
    manner defined for that property (if any).

speed_incr <value>
    Add <value> to the current playback speed.

speed_mult <value>
    Multiply the current speed by <value>.

speed_set <value>
    Set the speed to <value>.

step_property <property> [value] [direction]
    Change a property by value, or increase by a default if value is
    not given or zero. The direction is reversed if direction is less
    than zero.

step_property_osd <property> [value] [direction]
    Same as above, but show the new value on the OSD in the standard
    manner defined for that property (if any).

stop
    Stop playback.

sub_alignment [value]
    Toggle/set subtitle alignment.
        0 top alignment
        1 center alignment
        2 bottom alignment

sub_delay <value> [abs]
    Adjust the subtitle delay by +/- <value> seconds or set it to <value>
    seconds when [abs] is nonzero.

sub_load <subtitle_file>
    Loads subtitles from <subtitle_file>.

sub_log
    Logs the current or last displayed subtitle together with filename
    and time information to ~/.mplayer/subtitle_log. Intended purpose
    is to allow convenient marking of bogus subtitles which need to be
    fixed while watching the movie.

sub_pos <value> [abs]
    Adjust/set subtitle position.

sub_remove [value]
    If the [value] argument is present and non-negative, removes the subtitle
    file with index [value]. If the argument is omitted or negative, removes
    all subtitle files.

sub_select [value]
    Display subtitle with index [value]. Turn subtitle display off if
    [value] is -1 or greater than the highest available subtitle index.
    Cycle through the available subtitles if [value] is omitted or less
    than -1 (forward or backward respectively).
    Supported subtitle sources are -sub options on the command
    line, VOBsubs, DVD subtitles, and Ogg and Matroska text streams.
    This command is mainly for cycling all subtitles, if you want to set
    a specific subtitle, use sub_file, sub_vob, or sub_demux.

sub_source [source]
    Display first subtitle from [source]. Here [source] is an integer:
    SUB_SOURCE_SUBS   (0) for file subs
    SUB_SOURCE_VOBSUB (1) for VOBsub files
    SUB_SOURCE_DEMUX  (2) for subtitle embedded in the media file or DVD subs.
    If [source] is -1, will turn off subtitle display.
    If [value] is omitted or less than -1, will cycle between the first subtitle
    of each currently available source (forward or backward respectively).

sub_file [value]
    Display subtitle specifid by [value] for file subs. The [value] is
    corresponding to ID_FILE_SUB_ID values reported by '-identify'.
    If [value] is -1, will turn off subtitle display.
    If [value] is omitted or less than -1, will cycle all file subs
    (forward or backward respectively).

sub_vob [value]
    Display subtitle specifid by [value] for vobsubs. The [value] is
    corresponding to ID_VOBSUB_ID values reported by '-identify'.
    If [value] is -1, will turn off subtitle display.
    If [value] is omitted or less than -1, will cycle all vobsubs
    (forward or backward respectively).

sub_demux [value]
    Display subtitle specifid by [value] for subtitles from DVD or embedded
    in media file. The [value] is corresponding to ID_SUBTITLE_ID values
    reported by '-identify'. If [value] is -1, will turn off subtitle display.
    If [value] is omitted or less than -1, will cycle all DVD subs or embedded subs
    (forward or backward respectively).

sub_scale <value> [abs]
    Adjust the subtitle size by +/- <value> or set it to <value> when [abs]
    is nonzero.

vobsub_lang
    This is a stub linked to sub_select for backwards compatibility.

sub_step <value>
    Step forward in the subtitle list by <value> steps or backwards if <value>
    is negative.

sub_visibility [value]
    Toggle/set subtitle visibility.

forced_subs_only [value]
    Toggle/set forced subtitles only.

switch_audio [value] (currently MPEG*, AVI, Matroska and streams handled by libavformat)
    Switch to the audio track with the ID [value]. Cycle through the
    available tracks if [value] is omitted or negative.

switch_angle [value] (DVDs only)
    Switch to the DVD angle with the ID [value]. Cycle through the
    available angles if [value] is omitted or negative.

switch_ratio [value]
    Change aspect ratio at runtime. [value] is the new aspect ratio expressed
    as a float (e.g. 1.77778 for 16/9).
    There might be problems with some video filters.

switch_title [value] (DVDNAV only)
    Switch to the DVD title with the ID [value]. Cycle through the
    available titles if [value] is omitted or negative.

switch_vsync [value]
    Toggle vsync (1 == on, 0 == off). If [value] is not provided,
    vsync status is inverted.

teletext_add_digit <value>
    Enter/leave teletext page number editing mode and append given digit to
    previously entered one.
    0..9 - Append apropriate digit. (Enables editing mode if called from normal
           mode, and switches to normal mode when third digit is entered.)
    -    - Delete last digit from page number. (Backspace emulation, works only
           in page number editing mode.)

teletext_go_link <1-6>
    Follow given link on current teletext page.

tv_start_scan
    Start automatic TV channel scanning.

tv_step_channel <channel>
    Select next/previous TV channel.

tv_step_norm
    Change TV norm.

tv_step_chanlist
    Change channel list.

tv_set_channel <channel>
    Set the current TV channel.

tv_last_channel
    Set the current TV channel to the last one.

tv_set_freq <frequency in MHz>
    Set the TV tuner frequency.

tv_step_freq <frequency offset in MHz>
    Set the TV tuner frequency relative to current value.

tv_set_norm <norm>
    Set the TV tuner norm (PAL, SECAM, NTSC, ...).

tv_set_brightness <-100 - 100> [abs]
    Set TV tuner brightness or adjust it if [abs] is set to 0.

tv_set_contrast <-100 -100> [abs]
    Set TV tuner contrast or adjust it if [abs] is set to 0.

tv_set_hue <-100 - 100> [abs]
    Set TV tuner hue or adjust it if [abs] is set to 0.

tv_set_saturation <-100 - 100> [abs]
    Set TV tuner saturation or adjust it if [abs] is set to 0.

use_master
    Switch volume control between master and PCM.

vo_border [value]
    Toggle/set borderless display.

vo_fullscreen [value]
    Toggle/set fullscreen mode.

vo_ontop [value]
    Toggle/set stay-on-top.

vo_rootwin [value]
    Toggle/set playback on the root window.

volume <value> [abs]
    Increase/decrease volume or set it to <value> if [abs] is nonzero.


The following commands are really only useful for OSD menu console mode:

help
    Displays help text, currently empty.

exit
    Exits from OSD menu console. Unlike 'quit', does not quit MPlayer.

hide
    Hides the OSD menu console. Clicking a menu command unhides it. Other
    keybindings act as usual.

run <value>
    Run <value> as shell command. In OSD menu console mode stdout and stdin
    are through the video output driver.


Available properties:

name               type      min     max     get set step comment
=================================================================

osdlevel           int       0       3       X   X   X    as -osdlevel
speed              float     0.01    100     X   X   X    as -speed
loop               int       -1              X   X   X    as -loop
hr_seek            string                    X   X   X    as -hr-seek
pts_association_mode string                  X   X   X    as -pts-association-mode
pause              flag      0       1       X            1 if paused
filename           string                    X            file playing wo path
path               string                    X            file playing
demuxer            string                    X            demuxer used
stream_pos         pos       0               X   X        position in stream
stream_start       pos       0               X            start pos in stream
stream_end         pos       0               X            end pos in stream
stream_length      pos       0               X            (end - start)
stream_time_pos    time      0               X            present position in stream (in seconds)
chapter            int       0               X   X   X    select chapter
chapters           int                       X            number of chapters
angle              int       0               X   X   X    select angle
length             time                      X            length of file in seconds
percent_pos        int       0       100     X   X   X    position in percent
time_pos           time      0               X   X   X    position in seconds
metadata           str list                  X            list of metadata key/value
metadata/*         string                    X            metadata values
volume             float     0       100     X   X   X    change volume
balance            float     -1      1       X   X   X    change audio balance
mute               flag      0       1       X   X   X
audio_delay        float     -100    100     X   X   X
audio_format       int                       X
audio_codec        string                    X
audio_bitrate      int                       X
samplerate         int                       X
channels           int                       X
switch_audio       int       -2      255     X   X   X    select audio stream
switch_angle       int       -2      255     X   X   X    select DVD angle
switch_title       int       -2      255     X   X   X    select DVD title
capturing          flag      0       1       X   X   X    dump primary stream if enabled
fullscreen         flag      0       1       X   X   X
deinterlace        flag      0       1       X   X   X
ontop              flag      0       1       X   X   X
rootwin            flag      0       1       X   X   X
border             flag      0       1       X   X   X
framedropping      int       0       2       X   X   X    1 = soft, 2 = hard
gamma              int       -100    100     X   X   X
brightness         int       -100    100     X   X   X
contrast           int       -100    100     X   X   X
saturation         int       -100    100     X   X   X
hue                int       -100    100     X   X   X
panscan            float     0       1       X   X   X
vsync              flag      0       1       X   X   X
video_format       int                       X
video_codec        string                    X
video_bitrate      int                       X
width              int                       X            "display" width
height             int                       X            "display" height
fps                float                     X
aspect             float                     X
switch_video       int       -2      255     X   X   X    select video stream
switch_program     int       -1      65535   X   X   X    (see TAB default keybind)
sub                int       -1              X   X   X    select subtitle stream
sub_source         int       -1      2       X   X   X    select subtitle source
sub_file           int       -1              X   X   X    select file subtitles
sub_vob            int       -1              X   X   X    select vobsubs
sub_demux          int       -1              X   X   X    select subs from demux
sub_delay          float                     X   X   X
sub_pos            int       0       100     X   X   X    subtitle position
sub_alignment      int       0       2       X   X   X    subtitle alignment
sub_visibility     flag      0       1       X   X   X    show/hide subtitles
sub_forced_only    flag      0       1       X   X   X
sub_scale          float     0       100     X   X   X    subtitles font size
tv_brightness      int       -100    100     X   X   X
tv_contrast        int       -100    100     X   X   X
tv_saturation      int       -100    100     X   X   X
tv_hue             int       -100    100     X   X   X
teletext_page      int       0       799     X   X   X
teletext_subpage   int       0       64      X   X   X
teletext_mode      flag      0       1       X   X   X    0 - off, 1 - on
teletext_format    int       0       3       X   X   X    0 - opaque,
                                                          1 - transparent,
                                                          2 - opaque inverted,
                                                          3 - transp. inv.
teletext_half_page int       0       2       X   X   X    0 - off, 1 - top half,
                                                          2- bottom half