This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---user settings--- | |
local WaitTime = 0.1 --how long until we try to enter "fast" mode | |
local lookAhead = 5 --how far ahead to look for subtitles when trying to enter "fast" mode | |
local fast = 6 --how fast "fast" mode is by default | |
local rewind = 0.2 --how far to rewind when entering normal mode; note that if this is more than or equal to WaitTime + lookAhead you will probably enter an infinite loop | |
--- | |
local searchtimer | |
local checktimer | |
local waitTimer | |
local normal = mp.get_property("speed") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local api = "wasapi" | |
local deviceList = mp.get_property_native("audio-device-list") | |
local aid = 1 | |
local function cycle_adevice(s, e, d) | |
mp.enable_messages("error") | |
while s ~= e + d do -- until the loop would cycle back to the number we started on | |
if string.find(mp.get_property("audio-device"), deviceList[s].name, 1, true) then | |
while true do | |
if s + d == 0 then --the device list starts at 1; 0 means we iterated to far | |
s = #deviceList + 1 --so lets restart at the last device |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local sense=-20 | |
local speed = mp.get_property("speed") | |
local detect = false | |
function f(msg) | |
if string.find(msg.text, "silence_end") and detect then | |
mp.set_property("speed",speed) | |
endmsg=msg.text | |
detect = false | |
--print("end") | |
elseif string.find(msg.text, "silence_start") and detect==false then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lookahead = 5 --if the next subtitle appears after this threshold then speedup | |
speedup = 5 --the value that "speed" is set to during speedup | |
leadin = 1 --seconds to stop short of the next subtitle --range 0-2 | |
skipmode = false --instead of speeding up playback seek to the next known subtitle | |
maxskip = 5 --max seek distance (seconds) when skipmode is enabled | |
directskip = false --seek to next known subtitle no matter how far away | |
dropOnAVdesync = true --Because mpv syncs subtitles to audio it is possible that if | |
--audio processing lags behind video processing then normal playback may not resume | |
--in sync with the video. If "avsync" > leadin then this disables the audio so that | |
--we can ensure normal playback resumes on time. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local utils = require 'mp.utils' | |
local ytdlPath = mp.find_config_file("youtube-dl.exe") | |
local fileDuration = 0 | |
local function check_position() | |
if fileDuration==0 then | |
mp.unobserve_property(check_position) | |
return | |
end | |
local demuxEndPosition = mp.get_property("demuxer-cache-time") | |
if demuxEndPosition and |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmCenter = 1 | |
local defCenter = 1 | |
cmFront = 0.707 | |
local defFront = 0.707 | |
cmSide = 0.707 | |
local defSide = 0.707 | |
cmBack = 0.707 | |
local defBack = 0.707 | |
cmLFE = 0 | |
local defLFE = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--New child with start with the current 'aid' and 'audio-device' of the parent | |
-- non-Windows environments require the use of the 'socat' package | |
local platform_is_windows = (package.config:sub(1, 1) == "\\") | |
local options = require 'mp.options' | |
local o = { | |
pipe_template = platform_is_windows and "\\\\.\\pipe\\mpvDupedAudio" or "~/mpvDupedAudio", --windows format | |
new_child_key = 'Ctrl+A', --Start a new child: 'Ctrl+Shift+a' | |
cycle_child_control_key = 'Ctrl+Alt+A', --Cycle child control: 'Ctrl+Shift+Alt+a' | |
cycle_child_aid_key = 'Ctrl+Alt+a', --Cycle 'aid' of child: 'Ctrl+Alt+a' | |
child_increase_volume_key = 'Ctrl+Alt+WHEEL_UP', --Change volume of child: 'Ctrl+Alt+wheel' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---------------------- | |
-- #example ytdl_preload.conf | |
-- # make sure lines do not have trailing whitespace | |
-- # ytdl_opt has no sanity check and should be formatted exactly how it would appear in yt-dlp CLI, they are split into a key/value pair on whitespace | |
-- # at least on Windows, do not escape '\' in temp, just us a single one for each divider | |
-- #temp=R:\ytdltest | |
-- #ytdl_opt1=-r 50k | |
-- #ytdl_opt2=-N 5 | |
-- #ytdl_opt#=etc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local maxBytes = mp.get_property("demuxer-max-bytes") | |
local function stopCache() | |
local state = mp.get_property_native("demuxer-cache-state") | |
if state and state["cache-end"] and tonumber(state["cache-end"]) > tonumber(mp.get_property("end")) then | |
mp.set_property("demuxer-max-bytes",0) | |
print("stop") | |
mp.unobserve_property(stopCache) | |
end | |
end | |
local function look() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local optStart = 0 | |
function seekHandler(duration) | |
if mp.get_property_number("playlist-pos") > 0 then | |
optStart = mp.get_property("start") | |
mp.set_property("start", duration) | |
mp.command("playlist-prev") | |
end | |
end | |
mp.register_event("file-loaded", function() mp.set_property("start", optStart) end) |
OlderNewer