all repos — dotfiles @ fe04a2700e9267b3117cc096e6ca61fa4f402ce7

linux dotfiles

update slicing mpv script
Prithu Goswami prithugoswami524@gmail.com
Thu, 16 Apr 2020 10:39:55 +0530
commit

fe04a2700e9267b3117cc096e6ca61fa4f402ce7

parent

691008e28a62c36659ab85370ed4b2b3971e85e0

1 files changed, 21 insertions(+), 15 deletions(-)

jump to
M mpv/scripts/slicing.luampv/scripts/slicing.lua

@@ -5,15 +5,16 @@

local cut_pos = nil local copy_audio = true local o = { - target_dir = "~", - vcodec = "rawvideo", - acodec = "pcm_s16le", + target_dir = "./", + vcodec = "x264", + acodec = "aac", prevf = "", - vf = "format=yuv444p16$hqvf,scale=in_color_matrix=$matrix,format=bgr24", + -- vf = "format=yuv444p16$hqvf,scale=in_color_matrix=$matrix,format=bgr24", + vf = "", hqvf = "", postvf = "", opts = "", - ext = "avi", + ext = "mp4", command_template = [[ ffmpeg -v warning -y -stats -ss $shift -i "$in" -t $duration

@@ -41,14 +42,18 @@ return os.getenv("HOME") or os.getenv("USERPROFILE") or ""

end function log(str) - local logpath = utils.join_path( - o.target_dir:gsub("~", get_homedir()), - "mpv_slicing.log") - f = io.open(logpath, "a") - f:write(string.format("# %s\n%s\n", - os.date("%Y-%m-%d %H:%M:%S"), - str)) + -- local logpath = utils.join_path( + -- o.target_dir:gsub("~", get_homedir()), + -- "mpv_slicing.log") + local logpath = utils.join_path(utils.getcwd(), + "mpv_slice_cmd.log") + f = io.open(logpath, "w") + -- f:write(string.format("# %s\n%s\n", + -- os.date("%Y-%m-%d %H:%M:%S"), + -- str)) + f:write(str) f:close() + return logpath end function escape(str)

@@ -90,7 +95,7 @@ local inpath = escape(utils.join_path(

utils.getcwd(), mp.get_property("stream-path"))) local outpath = escape(utils.join_path( - o.target_dir:gsub("~", get_homedir()), + utils.getcwd(), get_outname(shift, endpos))) cmd = cmd:gsub("$shift", shift)

@@ -110,8 +115,9 @@ cmd = cmd:gsub("$out", outpath)

cmd = cmd:gsub("$in", inpath, 1) msg.info(cmd) - log(cmd) - os.execute(cmd) + local logpath = log(cmd) + -- os.execute(cmd) + os.execute(string.format("cat %s | xsel -ib",logpath)) end function toggle_mark()