How to achieve a backward cycle hotkey in mpv?

Abstract: Configure mpv to cycle backward through the playlist by adding P cycle-values playlist-pos -1 to input.conf.

Created: 2026-09-26 by
To create a backward cycle hotkey in mpv, you must edit the input.conf file and use the valid command cycle-values with the property playlist-pos, specifying the direction as -1. This configuration allows you to jump to the previous file in your playlist or directory sequence using a custom keyboard shortcut, effectively reversing the default forward navigation behavior without relying on incorrect syntax like cycle backwards.

Understanding MPV Input Configuration

MPV handles all user interactions through its input configuration system. Unlike many graphical applications that offer a settings menu for every feature, mpv relies on a text-based configuration file named input.conf. This file is located in the mpv configuration directory, which varies by operating system. On Linux and macOS, this is typically ~/.config/mpv/input.conf, while on Windows it is found at %APPDATA%\mpv\input.conf.

The structure of each line in this file follows a simple pattern: KEY COMMAND [args]. The key defines the physical button or combination on your keyboard, and the command tells mpv what action to perform. By adding a new line to this file, you can override default bindings or add entirely new functionality. It is crucial to understand that mpv commands are case-sensitive and specific. Using generic terms or incorrect command names will result in errors or ignored inputs.

The Correct Command Syntax

A common misconception among users is that there is a built-in command called "cycle backwards." However, mpv does not recognize this phrase. Instead, you must use the cycle-values command combined with the playlist-pos property. The playlist-pos property represents the index of the currently playing file in the playlist, starting from zero. By cycling this value in the negative direction, you move to the previous item.

The correct syntax is:

KEY cycle-values playlist-pos -1

Here, KEY is the shortcut you wish to assign (for example, p or P). The cycle-values command iterates through the possible values of the specified property. The argument -1 instructs mpv to decrement the playlist position. If you are at the first file (position 0), pressing the key will wrap around to the last file in the playlist, creating a seamless loop. This approach is robust because it works regardless of how many files are in your playlist or whether they are local files or remote streams.

Step-by-Step Implementation

To implement this feature, follow these precise steps. First, locate your mpv configuration directory. You can find the exact path by running mpv --print-path=scriptdir in your terminal or command prompt, although the standard paths mentioned earlier work for most users. Once you have located the directory, open or create the input.conf file. If the file does not exist, create it as a plain text file.

  1. Open input.conf in your preferred text editor.
  2. Add a new line at the end of the file with the syntax discussed above. For example, to use the 'P' key (shift+p), you would write: P cycle-values playlist-pos -1.
  3. Save the file and close the editor.
  4. Restart mpv or reload the configuration by pressing Ctrl+R inside the player if it is already running.

After restarting, test the key. When you press your chosen shortcut, the player should jump to the previous file. If nothing happens, check the mpv console output for error messages. Common issues include typos in the command name or incorrect file permissions preventing mpv from reading the configuration.

Alternative Navigation Methods

If you prefer not to modify the configuration file, you can also use the built-in prev and next commands, though these behave slightly differently. The prev command jumps to the previous file but does not support wrapping around from the first to the last file in the same seamless manner as cycle-values with playlist-pos. Therefore, for a true backward cycle effect, the cycle-values method is superior. Additionally, you can explore other input configurations to enhance your workflow. For instance, if you are interested in optimizing your overall media player experience, you might look into related topics such as FFmpeg Causing Sort Conflict with MPV: Script Issue to ensure your environment is stable.

Troubleshooting Common Issues

Sometimes, even after adding the correct line, the hotkey may not work. The first thing to check is whether another configuration file is overriding your changes. MPV loads configurations from multiple locations, including mpv.conf and scripts. Ensure that no script is binding the same key to a different action. You can verify active bindings by pressing ? in mpv, which displays a list of current key bindings. Look for your chosen key in this list; if it shows a different command, you need to either change your key choice or remove the conflicting binding.

Another potential issue is the scope of the playlist. If you are playing a single file without a playlist, playlist-pos remains at 0. In this scenario, pressing the backward key will wrap to the last item in the internal playlist, which might be empty or contain only the current file. To avoid confusion, ensure you have loaded a directory or multiple files into mpv before testing the backward cycle feature. This ensures that the playlist has multiple positions to cycle through.

Frequently Asked Questions

What is the difference between prev and cycle-values playlist-pos?

The prev command simply moves to the previous index without wrapping around from the start to the end. In contrast, cycle-values playlist-pos -1 wraps around seamlessly, allowing you to go from the first file to the last. This makes it ideal for continuous playback sessions where you want to revisit earlier files easily.

Can I use a mouse button for this backward cycle?

Yes, you can bind any supported mouse button in input.conf. Use the format MBTN_BACK or MBTN_FORWARD instead of a keyboard key. For example, MBTN_BACK cycle-values playlist-pos -1 would make the back mouse button trigger the backward cycle. This provides an alternative navigation method for users who prefer mouse gestures.

Why does my hotkey not work when I press it?

This usually happens due to a typo in the command name or a conflict with another binding. Check the mpv console for errors and ensure you used cycle-values and playlist-pos exactly. Also, verify that no other script or configuration is intercepting the key. Pressing ? in mpv helps identify existing bindings.

Does this work with network streams?

Yes, as long as the streams are added to the playlist. If you load multiple URLs into mpv, they become part of the playlist, and playlist-pos tracks their order. Navigating backward will switch to the previous URL in the list. However, if you are streaming a single live feed, this feature is less relevant since there is no prior item to cycle to.

How do I reset my input.conf to defaults?

To revert to default bindings, simply delete or rename your input.conf file. MPV will then fall back to its built-in defaults. Be aware that this removes all custom shortcuts you have created, so keep a backup if you want to restore them later. You can also clear specific bindings by commenting out lines with a # character at the start.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More