### Example config file for options Source: https://mpv.io/manual/master Configuration files are stored in script-opts/identifier.conf. Lines starting with # are comments. Boolean values can be yes/no. ```text # comment optionA=Hello World optionB=9999 optionC=no ``` -------------------------------- ### Example: Play DVD from Device Source: https://mpv.io/manual/master Example command to play a DVD using the specified device path. ```bash mpv dvd:// --dvd-device=/path/to/dvd/ ``` -------------------------------- ### Example: Play Blu-ray from Device Source: https://mpv.io/manual/master Example command to play a Blu-ray disc using the specified device path. ```bash mpv bd:// --bluray-device=/path/to/bd/ ``` -------------------------------- ### Example: Slice from 100 MiB to End Source: https://mpv.io/manual/master Starts reading from 'cap.ts' after seeking 100 MiB, then reads until end of file. ```mpv mpv slice://100m@appending://cap.ts ``` -------------------------------- ### Get Edition List Metadata Structure (Lua Example) Source: https://mpv.io/manual/master Illustrates the structure of edition metadata when queried using MPV's native node format in Lua. ```lua MPV_FORMAT_NODE_ARRAY MPV_FORMAT_NODE_MAP (for each edition) "id" MPV_FORMAT_INT64 "title" MPV_FORMAT_STRING ``` -------------------------------- ### Menu Button Left Command Example Source: https://mpv.io/manual/master Configures the command executed when the menu button is clicked with the left mouse button. This example hides the OSC after opening a menu. ```text menu_mbtn_left_command=script-binding select/menu; script-message-to osc osc-hide ``` -------------------------------- ### Run a command using subprocess (basic example) Source: https://mpv.io/manual/master A basic example of using the 'subprocess' command. This command offers more control over process execution than 'run' and does not detach by default. ```mpv script subprocess args=["/bin/sh", "-c", "echo ${title} > /tmp/playing"] ``` -------------------------------- ### Example: Slice from 1 GiB to 2 GiB Source: https://mpv.io/manual/master Starts reading from 'cap.ts' after seeking 1 GiB, then reads until reaching 2 GiB or end of file. ```mpv mpv slice://1g-2g@cap.ts ``` -------------------------------- ### Playlist Next Button Right Command Example Source: https://mpv.io/manual/master Configures the command for the next playlist button when clicked with the right mouse button. This example hides the OSC after selecting a playlist item. ```text playlist_next_mbtn_right_command=script-binding select/select-playlist; script-message-to osc osc-hide ``` -------------------------------- ### Example: Slice from 1 GiB with Offset Source: https://mpv.io/manual/master Starts reading from 'cap.ts' after seeking 1 GiB, then reads until reaching 3 GiB (1 GiB + 2 GiB) or end of file. ```mpv mpv slice://1g-+2g@cap.ts ``` -------------------------------- ### Example: Use Latin 2 Codepage Source: https://mpv.io/manual/master Example of specifying a codepage for subtitle files when input is not UTF-8. ```bash --sub-codepage=latin2 ``` -------------------------------- ### Example Configuration File Source: https://mpv.io/manual/master Demonstrates basic configuration options like autofit, hardware decoding, and OSD messages. Options can be set with values or implied. ```bash # Don't allow new windows to be larger than the screen. autofit-larger=100%x100% # Enable hardware decoding if available, =yes is implied. hwdec # Spaces don't have to be escaped. osd-playing-msg=File: ${filename} ``` -------------------------------- ### Example MPV Config File with Profiles Source: https://mpv.io/manual/master Illustrates how to define and use profiles for different configurations. Profiles can include other profiles and extend existing ones. ```bash # normal top-level option fullscreen=yes # a profile that can be enabled with --profile=big-cache [big-cache] cache=yes demuxer-max-bytes=512MiB demuxer-readahead-secs=20 [network] profile-desc="profile for content over network" force-window=immediate # you can also include other profiles profile=big-cache [reduce-judder] video-sync=display-resample interpolation=yes # using a profile again extends it [network] demuxer-max-back-bytes=512MiB # reference a builtin profile profile=low-latency ``` -------------------------------- ### Example command-line options Source: https://mpv.io/manual/master Command-line options are passed via the --script-opts parameter, with keys prefixed by the identifier. Multiple options can be comma-separated. ```text --script-opts=myscript-optionA=TEST,myscript-optionB=0,myscript-optionC=yes ``` -------------------------------- ### MPV Profile Restore Example Source: https://mpv.io/manual/master Demonstrates the behavior of the `copy-equal` profile restore mode with a sequence of commands. It shows how the `vf` property changes and is restored. ```bash set vf vflip apply-profile something vf add hflip apply-profile something # vf == vflip,rotate=PI/2,hflip,rotate=PI/2 apply-profile something restore # vf == vflip ``` -------------------------------- ### Command with Optional Arguments Example Source: https://mpv.io/manual/master Illustrates how optional arguments are indicated in command descriptions. If not provided, they default to a specific value. ```text vf add [] ``` -------------------------------- ### Start mpv with IPC Server (Windows) Source: https://mpv.io/manual/master Starts mpv with a named pipe for JSON IPC communication on Windows. Note that standard Windows command prompt tools have limitations in reading replies. ```bash mpv file.mkv --input-ipc-server=\\.\pipe\mpvsocket ``` -------------------------------- ### Rebase Start Time Option Source: https://mpv.io/manual/master Control whether the file start time is reset to 00:00:00 using `--rebase-start-time`. Default is 'yes'. ```bash --rebase-start-time= ``` -------------------------------- ### Example of Property Expansion in input.conf Source: https://mpv.io/manual/master This snippet demonstrates how to use property expansion to display the filename when the 'i' key is pressed. It requires the 'input.conf' file. ```input.conf i show-text "Filename: ${filename}" ``` -------------------------------- ### Play Raw YUV Sample Source: https://mpv.io/manual/master Example demonstrating how to play a raw YUV video file using the `rawvideo` demuxer, specifying its width and height. ```bash mpv sample-720x576.yuv --demuxer=rawvideo \ --demuxer-rawvideo-w=720 --demuxer-rawvideo-h=576 ``` -------------------------------- ### Start mpv with IPC Server (Linux) Source: https://mpv.io/manual/master Starts mpv with a Unix domain socket for JSON IPC communication. This allows external programs to control the player. ```bash mpv file.mkv --input-ipc-server=/tmp/mpvsocket ``` -------------------------------- ### Set Playlist Start Entry Source: https://mpv.io/manual/master Use `--playlist-start` to specify the initial entry in the playlist. Accepts 'auto', 'no' (deprecated), or an index. ```bash --playlist-start= ``` ```bash mpv playlist.m3u --playlist-start=123 ``` -------------------------------- ### Get Video Filter Help Source: https://mpv.io/manual/master Prints parameter names and value ranges for a specific video filter. ```bash --vf==help ``` -------------------------------- ### Example HTTP Request with Custom Headers Source: https://mpv.io/manual/master Illustrates the HTTP request generated when custom headers are specified. ```http GET / HTTP/1.0 Host: localhost:1234 User-Agent: MPlayer Icy-MetaData: 1 Field1: value1 Field2: value2 Connection: close ``` -------------------------------- ### Fullscreen Button Left Command Example Source: https://mpv.io/manual/master Configures the command executed when the fullscreen button is clicked with the left mouse button. This toggles fullscreen mode. ```text fullscreen_mbtn_left_command="cycle fullscreen" ``` -------------------------------- ### Rebind Playlist Selection Source: https://mpv.io/manual/master Example of how to rebind the playlist selection script binding in input.conf. ```ini Ctrl+p script-binding select/select-playlist ``` -------------------------------- ### Audio Track Wheel Up Command Example Source: https://mpv.io/manual/master Configures the command executed when the audio track when the mouse wheel is scrolled up. This cycles down through audio tracks. ```text audio_track_wheel_up_command=cycle audio down ``` -------------------------------- ### mp.utils.subprocess Source: https://mpv.io/manual/master Starts a subprocess with the given table of options. ```APIDOC ## mp.utils.subprocess ### Description Starts a subprocess with the given table of options. ### Method `mp.utils.subprocess(t)` ### Parameters #### Path Parameters - **t** (table) - Table containing subprocess options. ``` -------------------------------- ### mp.input.get Source: https://mpv.io/manual/master Gets input from the user. ```APIDOC ## mp.input.get ### Description Gets input from the user. ### Method `mp.input.get(obj)` ### Parameters #### Path Parameters - **obj** (any) - Input object. ``` -------------------------------- ### Example: Play MKV from ZIP Archive Source: https://mpv.io/manual/master Plays 'video.mkv' located inside the 'file.zip' archive. ```mpv mpv "archive://file.zip|video.mkv" ``` -------------------------------- ### Raw Property Example (avsync) Source: https://mpv.io/manual/master Retrieves the unformatted, raw value of the 'avsync' property. ```text ${=avsync} ``` -------------------------------- ### Start Playback Paused Source: https://mpv.io/manual/master Use the `--pause` option to initiate playback in a paused state. ```bash --pause ``` -------------------------------- ### Volume Wheel Up Command Example Source: https://mpv.io/manual/master Sets the command for the volume when the mouse wheel is scrolled up. This increases the volume by 5. ```text volume_wheel_up_command=add volume 5 ``` -------------------------------- ### Display-Resample Mode Example Source: https://mpv.io/manual/master Enables a timing mode that tries to avoid skipping or repeating frames by resampling audio to match the video and compensating for drift. ```bash --video-sync=display-resample ``` -------------------------------- ### Get User Path Source: https://mpv.io/manual/master Use mp.utils.get_user_path() to expand mpv meta-paths like ~~desktop/foo. ```javascript local expanded_path = mp.utils.get_user_path("~~desktop/myfile.txt") mp.msg.info("Expanded path: " .. expanded_path) ``` -------------------------------- ### JACK Autostart Daemon Source: https://mpv.io/manual/master Automatically start the JACK daemon if necessary. This option is often unreliable and can produce verbose output. ```bash --jack-autostart= ``` -------------------------------- ### Set Custom Playing Message with Property Expansion Source: https://mpv.io/manual/master Print a custom string after playback starts, with support for property expansion. For example, to display the filename. ```bash mpv --term-playing-msg='file: ${filename}' ``` -------------------------------- ### Play/Pause Button Left Command Example Source: https://mpv.io/manual/master Sets the command for the play/pause button when clicked with the left mouse button. This toggles the pause state. ```text play_pause_mbtn_left_command=cycle pause ``` -------------------------------- ### Getting Demuxer Cache Seekable Ranges Source: https://mpv.io/manual/master Retrieve information about seekable regions in the demuxer cache, including start and end timestamps, using the 'demuxer-cache-state' property. ```c #include // ... mpv_handle initialization ... mpv_node state_node; int ret = mpv_get_property(handle, "demuxer-cache-state", MPV_FORMAT_NODE_MAP, &state_node); if (ret == MPV_ERROR_SUCCESS && state_node.format == MPV_FORMAT_NODE_MAP) { // Process the state_node which contains seekable ranges // ... mpv_node_free(&state_node); } ``` -------------------------------- ### Example lavfi filter graph with named parameters Source: https://mpv.io/manual/master Demonstrates using named parameters for filters within the libavfilter graph for clarity and explicit configuration. ```bash '--vf=lavfi=graph="gradfun=radius=30:strength=20,vflip"' ``` -------------------------------- ### Volume Wheel Down Command Example Source: https://mpv.io/manual/master Configures the command executed when the volume when the mouse wheel is scrolled down. This decreases the volume by 5. ```text volume_wheel_down_command=add volume -5 ``` -------------------------------- ### Example: Incorrect Color Matrix Source: https://mpv.io/manual/master Demonstrates setting a color matrix that may result in incorrect colors if the source file was tagged correctly. ```bash mpv test.mkv --vf=format:colormatrix=ycgco ``` -------------------------------- ### Get Time in Milliseconds Source: https://mpv.io/manual/master Use mp.get_time_ms() to get the current playback time in milliseconds. ```javascript local time_ms = mp.get_time_ms() mp.msg.info("Current time in ms: " .. time_ms) ``` -------------------------------- ### Flat Command Syntax Example Source: https://mpv.io/manual/master Illustrates the general structure of a command in input.conf, including optional prefixes, the command name, and arguments. Arguments with spaces or special characters require quoting. ```text ::= [] ()* ::= ( | " " | ' ' | `X X`) ``` -------------------------------- ### Get Script Option Source: https://mpv.io/manual/master Retrieves a setting defined in the --script-opts option. Be mindful of potential name collisions with other scripts. ```lua mp.get_opt(key) ``` -------------------------------- ### Get Current Time Source: https://mpv.io/manual/master Use mp.get_time() to get the current playback time in seconds. ```javascript local current_time = mp.get_time() mp.msg.info("Current time: " .. current_time) ``` -------------------------------- ### Example: Force Recoding to CP1250 Source: https://mpv.io/manual/master Example of forcing recoding to a specific codepage, bypassing autodetection. ```bash --sub-codepage=+cp1250 ``` -------------------------------- ### Fullscreen Button Right Command Example Source: https://mpv.io/manual/master Sets the command for the fullscreen button when clicked with the right mouse button. This toggles window maximization. ```text fullscreen_mbtn_right_command="cycle window-maximized" ``` -------------------------------- ### Load Configuration File Source: https://mpv.io/manual/master Loads options from a specified configuration file, similar to the --include option. ```bash load-config-file ``` -------------------------------- ### Get Current Working Directory Source: https://mpv.io/manual/master Use mp.utils.getcwd() to get the current working directory. Check mp.last_error() for success. ```javascript local cwd = mp.utils.getcwd() if mp.last_error() ~= "" then mp.msg.error("Failed to get CWD: " .. mp.last_error()) else mp.msg.info("Current directory: " .. cwd) end ``` -------------------------------- ### MPV Input Test Mode Source: https://mpv.io/manual/master Starts MPV in input test mode to display key bindings and commands without executing them. ```bash mpv --input-test --force-window --idle ``` -------------------------------- ### Get File Information Source: https://mpv.io/manual/master Use mp.utils.file_info() to get information about a file. Note that meta-paths are not expanded. Check mp.last_error() for success. ```javascript local info = mp.utils.file_info("/path/to/file.txt") if mp.last_error() ~= "" then mp.msg.error("Failed to get file info: " .. mp.last_error()) else mp.msg.info("File size: " .. info.size) end ``` -------------------------------- ### Audio Track Button Left Command Example Source: https://mpv.io/manual/master Configures the command executed when the audio track button is clicked with the left mouse button. This cycles through available audio tracks. ```text audio_track_mbtn_left_command=cycle audio ``` -------------------------------- ### Subtitle Track Wheel Down Command Example Source: https://mpv.io/manual/master Configures the command executed when the subtitle track when the mouse wheel is scrolled down. This cycles through available subtitle tracks. ```text sub_track_wheel_down_command=cycle sub ``` -------------------------------- ### Array Command Syntax Example (C libmpv) Source: https://mpv.io/manual/master Illustrates calling commands via arrays in the C libmpv client API using mpv_command() or mpv_command_node(). Arguments are passed as separate strings or native values. ```c mpv_command(handle, "set", "volume", "50"); mpv_command_node(handle, MPV_FORMAT_NODE_ARRAY, (const void*[]){ MPV_NODE_STRING("set"), MPV_NODE_STRING("volume"), MPV_NODE_INT(50), NULL }); ``` -------------------------------- ### Get Property for OSD Display Source: https://mpv.io/manual/master Use mp.get_property_osd to get a property value formatted for OSD display. Returns an empty string if the property is missing. ```lua local time_osd = mp.get_property_osd("time-pos") ``` -------------------------------- ### Getting Approximate Demuxer Cache Duration Source: https://mpv.io/manual/master Get an approximate duration of buffered video in the demuxer, in seconds, using 'demuxer-cache-duration'. This value is often unreliable. ```c #include // ... mpv_handle initialization ... mpv_node duration_node; int ret = mpv_get_property(handle, "demuxer-cache-duration", MPV_FORMAT_DOUBLE, &duration_node); if (ret == MPV_ERROR_SUCCESS && duration_node.format == MPV_FORMAT_DOUBLE) { double duration = duration_node.data.d_double; // Use the duration value // ... mpv_node_free(&duration_node); } ``` -------------------------------- ### Configure Raw Video Format Source: https://mpv.io/manual/master Set the color space for raw video demuxing. Use `--demuxer-rawvideo-mp-format=help` to see available formats. ```bash --demuxer-rawvideo-format= ``` ```bash --demuxer-rawvideo-mp-format= ``` -------------------------------- ### Title Button Left Command Example Source: https://mpv.io/manual/master Sets the command for the title button when clicked with the left mouse button. This example binds it to display page 5 of the stats. ```text title_mbtn_left_command=script-binding stats/display-page-5 ``` -------------------------------- ### Example lavfi filter graph with shell quoting Source: https://mpv.io/manual/master Same as the previous example, but uses shell-safe quoting for the filter graph string, ensuring compatibility across different shells. ```bash '--vf=lavfi="gradfun=20:30,vflip"' ``` -------------------------------- ### Specify clipboard backends Source: https://mpv.io/manual/master Define a priority list of clipboard backends for native clipboard support. Use 'help' to list available backends. Native support is enabled by default. ```bash --clipboard-backends= ``` -------------------------------- ### Play/Pause Button Mid Command Example Source: https://mpv.io/manual/master Configures the command executed when the play/pause button is clicked with the middle mouse button. This cycles through loop modes (playlist, infinite, none). ```text play_pause_mbtn_mid_command=cycle-values loop-playlist inf no ``` -------------------------------- ### Example of input.set_log with styled text Source: https://mpv.io/manual/master Demonstrates how to replace the log buffer with custom text, including styled and terminal-formatted messages. Use this to display rich log content. ```lua input.set_log({ "regular text", { text = "error text", style = "{\c&H7a77f2&}", terminal_style = "\027[31m", } }) ``` -------------------------------- ### Example of Decimate Filter with IVTC Mode Source: https://mpv.io/manual/master This example demonstrates using the decimate filter in conjunction with the d3d11vpp filter in IVTC mode. The format must be nv12 to download frames to the CPU for decimation. ```bash --vf=d3d11vpp="deint:mode=ivtc,format=nv12,decimate=5" ``` -------------------------------- ### Play/Pause Button Right Command Example Source: https://mpv.io/manual/master Sets the command for the play/pause button when clicked with the right mouse button. This cycles through file loop modes (infinite, none). ```text play_pause_mbtn_right_command=cycle-values loop-file inf no ``` -------------------------------- ### Configure Initial Audio Synchronization Source: https://mpv.io/manual/master Control whether mpv modifies the audio stream to align its start timestamp with video. Disabling this option mimics older mpv behavior where both streams start immediately. ```bash --initial-audio-sync=yes --initial-audio-sync=no ``` -------------------------------- ### Per-File Options with Markers Source: https://mpv.io/manual/master Shows how to use `--{` and `--}` markers to apply options to specific files. Options between these markers only affect the files listed immediately after the opening marker and before the closing marker. ```bash mpv --a file1.mkv --b --\{ --c file2.mkv --d file3.mkv --e --\} file4.mkv --f ``` -------------------------------- ### Compute Shader Dispatch Example Source: https://mpv.io/manual/master Illustrates the dispatch of compute shaders with specified block and work group sizes for tiling over an output. This example shows how `bw`, `bh`, `tw`, and `th` parameters define the compute grid. ```glsl COMPUTE [ ] ``` -------------------------------- ### Array Command Syntax Example (Lua) Source: https://mpv.io/manual/master Shows how to call commands using arrays in Lua scripting with mp.commandv() or mp.command_native(). Prefixes, command name, and arguments are passed as separate array items. ```lua mp.commandv("set", "volume", 50) mp.command_native({"set", "volume", 50}) ``` -------------------------------- ### Enable MKV Start Time Probing Source: https://mpv.io/manual/master Determines whether to check the start time of Matroska files by reading the first cluster timestamps. Default is 'yes'. Disabling may slightly increase latency by one frame. ```bash --demuxer-mkv-probe-start-time= ``` -------------------------------- ### Named Arguments Syntax Example (C libmpv) Source: https://mpv.io/manual/master Shows how to use named arguments in the C libmpv client API with mpv_command_node() and MPV_FORMAT_NODE_MAP. The command name is a string field, and arguments are map entries. ```c mpv_command_node(handle, MPV_FORMAT_NODE_MAP, (const void*[]){ MPV_NODE_STRING("_name"), MPV_NODE_STRING("set"), MPV_NODE_STRING("volume"), MPV_NODE_INT(50), NULL }); ``` -------------------------------- ### Read configuration options Source: https://mpv.io/manual/master Use options.read_options to load configuration from a table, config file, and command line. Default values in the table are important for type conversion. Provide a unique identifier to avoid collisions. ```lua local options = { optionA = "defaultvalueA", optionB = -0.5, optionC = true, } require "mp.options".read_options(options, "myscript") print(options.optionA) ``` -------------------------------- ### mp.utils.subprocess_detached Source: https://mpv.io/manual/master Starts a subprocess in detached mode. ```APIDOC ## mp.utils.subprocess_detached ### Description Starts a subprocess in detached mode. ### Method `mp.utils.subprocess_detached(t)` ### Parameters #### Path Parameters - **t** (table) - Table containing subprocess options. ``` -------------------------------- ### Configure null audio output untimed benchmarking Source: https://mpv.io/manual/master Use with the null audio output driver for benchmarking without timing. ```bash --ao-null-untimed ``` -------------------------------- ### Read Environment Variable Source: https://mpv.io/manual/master Use mp.utils.getenv() to get the value of an environment variable. ```javascript local user_home = mp.utils.getenv("HOME") if user_home then mp.msg.info("User home directory: " .. user_home) else mp.msg.warn("HOME environment variable not set.") end ``` -------------------------------- ### Chapter Next Button Mid Command Example Source: https://mpv.io/manual/master Configures the command executed when the next chapter button is clicked with the middle mouse button. It displays the chapter list. ```text chapter_next_mbtn_mid_command=show-text ${chapter-list} 3000 ``` -------------------------------- ### Formatted Property Example Source: https://mpv.io/manual/master Retrieves the human-readable formatted value of the 'time-pos' property. ```text ${time-pos} ``` -------------------------------- ### mp.utils.getpid Source: https://mpv.io/manual/master Gets the current process ID. Use mp.last_error() to check for success or failure. ```APIDOC ## mp.utils.getpid ### Description Gets the current process ID. Use `mp.last_error()` to check for success or failure. ### Method `mp.utils.getpid()` ``` -------------------------------- ### mp.utils.getcwd Source: https://mpv.io/manual/master Gets the current working directory. Use mp.last_error() to check for success or failure. ```APIDOC ## mp.utils.getcwd ### Description Gets the current working directory. Use `mp.last_error()` to check for success or failure. ### Method `mp.utils.getcwd()` ``` -------------------------------- ### Audio Track Button Right Command Example Source: https://mpv.io/manual/master Configures the command executed when the audio track button is clicked with the right mouse button. This hides the OSC after selecting an audio device. ```text audio_track_mbtn_right_command=script-binding select/select-audio-device; script-message-to osc osc-hide ``` -------------------------------- ### DRM Connector Selection Source: https://mpv.io/manual/master Select the DRM connector (monitor) to use. Use 'help' to list available connectors. Defaults to the first available connector if empty or 'auto'. ```bash --drm-connector= ``` -------------------------------- ### Get Property Command Source: https://mpv.io/manual/master Retrieves the value of a specified property. The response contains the data and status. ```json { "command": ["get_property", "volume"] } ``` ```json { "data": 50.0, "error": "success" } ``` -------------------------------- ### Volume Button Left Command Example Source: https://mpv.io/manual/master Configures the command executed when the volume button is clicked with the left mouse button. This toggles mute without showing the OSD. ```text volume_mbtn_left_command=no-osd cycle mute ``` -------------------------------- ### Get Number Property Source: https://mpv.io/manual/master Use mp.get_property_number() to retrieve a property as a number. Check mp.last_error() for success. ```javascript local num_value = mp.get_property_number("some.number.property", 0) if mp.last_error() ~= "" then mp.msg.error("Failed to get number property: " .. mp.last_error()) end ``` -------------------------------- ### load-input-conf Source: https://mpv.io/manual/master Loads an input configuration file. ```APIDOC ## load-input-conf ### Description Load an input configuration file, similar to the `--input-conf` option. ### Parameters #### Path Parameters - **filename** (string) - Required - The path to the input configuration file. ``` -------------------------------- ### Get Boolean Property Source: https://mpv.io/manual/master Use mp.get_property_bool() to retrieve a property as a boolean. Check mp.last_error() for success. ```javascript local bool_value = mp.get_property_bool("some.bool.property", false) if mp.last_error() ~= "" then mp.msg.error("Failed to get boolean property: " .. mp.last_error()) end ``` -------------------------------- ### Raw Property Example Source: https://mpv.io/manual/master Retrieves the unformatted, raw value of the 'time-pos' property, including milliseconds. ```text ${=time-pos} ``` -------------------------------- ### playlist-play-index Source: https://mpv.io/manual/master Starts or restarts playback of a specific playlist index, with options to preserve file-local settings. ```APIDOC ## playlist-play-index [preserve-options] ### Description Start (or restart) playback of the given playlist index. Supports specific values like 'current' and 'none' for playback control. ### Arguments * **index**: An integer representing the playlist entry index, or 'current' to replay the current entry, or 'none' to stop playback. * **preserve-options**: A flag (MPV_FORMAT_FLAG) to prevent resetting file-local options when restarting playback. ``` -------------------------------- ### Enable Wayland Presentation Protocol Source: https://mpv.io/manual/master Enables Wayland's presentation time protocol for accurate frame presentation if supported by the compositor. Requires '--video-sync=display-...' to have an effect. ```bash --wayland-present= ``` -------------------------------- ### Set Raw Audio Sample Format Source: https://mpv.io/manual/master Defines the sample format for the `rawaudio` demuxer. Use `--demuxer-rawaudio-format=help` for a list of supported formats. The default is `s16le`. ```bash --demuxer-rawaudio-format= ``` -------------------------------- ### Get Current Script File Name Source: https://mpv.io/manual/master Use mp.get_script_file() to retrieve the filename of the currently executing script. ```javascript local script_name = mp.get_script_file() mp.msg.info("Current script: " .. script_name) ``` -------------------------------- ### Specify Playlist File Source: https://mpv.io/manual/master Use the `--playlist` option to load playback from a specified playlist file. ```bash --playlist= ``` -------------------------------- ### Get Process ID Source: https://mpv.io/manual/master Use mp.utils.getpid() to retrieve the current process ID. Check mp.last_error() for success. ```javascript local pid = mp.utils.getpid() if mp.last_error() ~= "" then mp.msg.error("Failed to get PID: " .. mp.last_error()) else mp.msg.info("Process ID: " .. pid) end ``` -------------------------------- ### Configure youtube-dl executable path Source: https://mpv.io/manual/master Set the path to the youtube-dl executable or a compatible fork. Paths are separated by ':' on Unix and ';' on Windows. mpv searches in PATH and the config directory. Defaults include 'yt-dlp', 'yt-dlp_x86', and 'youtube-dl'. On Windows, only '.exe' is accepted. ```ini ytdl_path=youtube-dl ``` -------------------------------- ### Getting the Number of Metadata Entries Source: https://mpv.io/manual/master Retrieve the total count of metadata entries using the 'metadata/list/count' property. ```c #include // ... mpv_handle initialization ... mpv_node count_node; int ret = mpv_get_property(handle, "metadata/list/count", MPV_FORMAT_INT64, &count_node); if (ret == MPV_ERROR_SUCCESS && count_node.format == MPV_FORMAT_INT64) { int64_t count = count_node.data.i_int64; // Use the count // ... mpv_node_free(&count_node); } ``` -------------------------------- ### Get Property String Command Source: https://mpv.io/manual/master Retrieves the value of a specified property as a string. The response contains the data and status. ```json { "command": ["get_property_string", "volume"] } ``` ```json { "data": "50.000000", "error": "success" } ``` -------------------------------- ### Configure PipeWire buffer size Source: https://mpv.io/manual/master Set the audio buffer size in milliseconds for PipeWire. Higher values reduce underruns but increase reaction time. ```bash --pipewire-buffer=<1-2000|native> ``` -------------------------------- ### Get Script Directory Source: https://mpv.io/manual/master Returns the directory path for scripts packaged as directories. Returns nothing for single-file scripts. ```lua mp.get_script_directory() ``` -------------------------------- ### Basic Per-File Options Source: https://mpv.io/manual/master Demonstrates how command-line options affect all files by default. This is the standard behavior before using per-file markers. ```bash mpv --a file1.mkv --b file2.mkv --c ```