Compare commits

...

No commits in common. "3304cf1d21720eef737431709ff4e3bced5f71f6" and "f50eb8649ad827ab818b13a2456b199c87de4571" have entirely different histories.

6 changed files with 13 additions and 122 deletions

10
LICENSE Normal file
View File

@ -0,0 +1,10 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>

View File

@ -1,4 +0,0 @@
install:
cp gifify ~/.local/bin/gifify
chmod +x ~/.local/bin/gifify
cp *.lua ~/.config/mpv/scripts

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# videotools
A collection of scripts and MPV plugins for extracting images from video files.

View File

@ -1,73 +0,0 @@
local mp = require "mp"
local utils = require "mp.utils"
local nextfile = require "nextfile"
local config = {
directory = "/home/viciouscirce/pix/testshots/" -- Change this to your target directory
}
local function get_loop_timestamps()
local a = mp.get_property_number("ab-loop-a")
local b = mp.get_property_number("ab-loop-b")
return a, b
end
local function clear_loop()
mp.set_property("ab-loop-a", "no")
mp.set_property("ab-loop-b", "no")
end
local function get_video_filename()
local path = mp.get_property("path")
if path[1] == "/" then
return path
end
local workdir = mp.get_property("working-directory")
return workdir .. "/" .. path
end
local function get_output_filename(prompt)
local suggested_filename = nextfile.nextfile(config.directory, "gif")
if not prompt then
return config.directory .. suggested_filename
end
local cmd = "echo " .. suggested_filename .. " | dmenu -p Filename:"
local name = string.gsub(io.popen(cmd):read('*a'), '\n$', '')
if name == nil or #name == 0 then
return config.directory .. suggested_filename
end
return config.directory .. name
end
local function clip(prompt)
local a, b = get_loop_timestamps()
if a == nil or b == nil or (a == 0 and b == 0) then
mp.osd_message("AB Loop not set.")
return
end
local video_filename = get_video_filename()
local output_filename = get_output_filename(prompt)
io.popen("gifify " .. a .. " " .. b .. " " .. video_filename .. " " .. output_filename)
clear_loop()
end
local function clip_prompt()
clip(true)
end
local function clip_noprompt()
clip(false)
end
mp.add_key_binding(':', clip_prompt)
mp.add_key_binding(';', clip_noprompt)

View File

@ -1,43 +0,0 @@
local mp = require "mp"
local nextfile = require "nextfile"
local prevfile = require "prevfile"
local config = {
directory = "/home/viciouscirce/pix/testshots/" -- Change this to your target directory
}
local function get_output_filename(prompt)
local prev = prevfile.prevfile(config.directory)
mp.osd_message(prev)
local suggested_filename = nextfile.nextfile(config.directory, "jpg")
if not prompt then
return config.directory .. suggested_filename
end
local cmd = "echo " .. suggested_filename .. " | dmenu -p Filename:"
local name = string.gsub(io.popen(cmd):read('*a'), '\n$', '')
if name == nil or #name == 0 then
return config.directory .. suggested_filename
end
return config.directory .. name
end
local function clip(prompt)
local output_filename = get_output_filename(prompt)
mp.commandv("screenshot-to-file", output_filename)
end
local function clip_prompt()
clip(true)
end
local function clip_noprompt()
clip(false)
end
mp.add_key_binding("Alt+S", clip_prompt)
mp.add_key_binding("Alt+s", clip_noprompt)

2
gifify
View File

@ -1,2 +0,0 @@
#!/bin/sh
ffmpeg -ss "$1" -t "$2" -i "$3" -vf "fps=30,scale=650:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 "$4"