dotfiles

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

video.lua (3991B)


      1 -- local function aesthetic_record()
      2 --     local current_file = vim.fn.expand("%:t")
      3 --     local time = os.date("%H-%M")
      4 --     local output_filename = string.format('%s(%s).mp4', current_file, time)
      5 --     local full_path = vim.fn.expand("~/Movies/") .. output_filename
      6 --
      7 --     local cmd = string.format(
      8 --         [[ffmpeg -y -f avfoundation -r 30 -i "3:none" -filter:v "crop=1920:1080:(in_w-1920)/2:(in_h-1080)/2,unsharp=5:5:1.0:5:5:0.0" -preset ultrafast "%s"]],
      9 --         full_path
     10 --     )
     11 --
     12 --     print("Recording to: " .. full_path)
     13 --
     14 --     local job_id = vim.fn.jobstart(cmd, { detach = true })
     15 --     vim.g.recording_job_id = job_id
     16 -- end
     17 --
     18 -- local function aesthetic_screenshot()
     19 --     local current_file = vim.fn.expand("%:t")
     20 --     local time = os.date("%H-%M")
     21 --     local output_filename = string.format('%s(%s).png', current_file, time)
     22 --     local full_path = vim.fn.expand("~/Pictures/") .. output_filename
     23 --
     24 --     local cmd = string.format(
     25 --         [[ffmpeg -y -f avfoundation -frames:v 1 -i "3" -filter:v "crop=1920:1080:(in_w-1920)/2:(in_h-1080)/2,unsharp=5:5:1.0:5:5:0.0" "%s"]],
     26 --         full_path
     27 --     )
     28 --
     29 --
     30 --     local result = vim.fn.system(cmd)
     31 --     local exit_code = vim.v.shell_error
     32 --
     33 --     if exit_code ~= 0 then
     34 --         vim.notify("Failed to take screenshot:\n" .. result, vim.log.levels.ERROR)
     35 --     else
     36 --         vim.notify("Screenshot saved to: " .. full_path, vim.log.levels.INFO)
     37 --     end
     38 -- end
     39 --
     40 --
     41 --
     42 -- local function aesthetic_record_hq()
     43 --     local current_file = vim.fn.expand("%:t")
     44 --     local time = os.date("%H-%M")
     45 --     local output_filename = string.format('%s(%s)_hq.mp4', current_file, time)
     46 --     local full_path = vim.fn.expand("~/Movies/") .. output_filename
     47 --
     48 --     local cmd = string.format(
     49 --         [[ffmpeg -y -f avfoundation -r 60 -i "3:none" -filter:v "crop=1920:1080:(in_w-1920)/2:(in_h-1080)/2,unsharp=7:7:1.0:7:7:0.0" -crf 18 -preset veryslow "%s"]],
     50 --         full_path
     51 --     )
     52 --
     53 --     print("High quality recording to: " .. full_path)
     54 --
     55 --     local job_id = vim.fn.jobstart(cmd, { detach = true })
     56 --     vim.g.recording_job_id = job_id
     57 -- end
     58 --
     59 -- local function stop_record()
     60 --     if vim.g.recording_job_id then
     61 --         vim.fn.jobstop(vim.g.recording_job_id)
     62 --         print("Recording stopped.")
     63 --         vim.g.recording_job_id = nil
     64 --     else
     65 --         print("No active recording!")
     66 --     end
     67 -- end
     68 --
     69 -- vim.api.nvim_create_user_command("Screenshot", aesthetic_screenshot, {})
     70 -- vim.api.nvim_create_user_command("RecordStop", stop_record, {})
     71 -- vim.api.nvim_create_user_command("Record", aesthetic_record, {})
     72 -- vim.api.nvim_create_user_command("RecordHQ", aesthetic_record_hq, {})
     73 --
     74 --
     75 -- local pickers = require "telescope.pickers"
     76 -- local finders = require "telescope.finders"
     77 -- local conf = require("telescope.config").values
     78 -- local actions = require "telescope.actions"
     79 -- local action_state = require "telescope.actions.state"
     80 --
     81 --
     82 -- local recording_actions = {
     83 --     "Screenshot",
     84 --     "RecordStop",
     85 --     "Record",
     86 --     "RecordHQ",
     87 -- }
     88 --
     89 -- local function record_picker()
     90 --     pickers.new({}, {
     91 --         prompt_title = "Select Recording Action",
     92 --         finder = finders.new_table {
     93 --             results = recording_actions,
     94 --         },
     95 --         sorter = conf.generic_sorter({}),
     96 --         attach_mappings = function(prompt_bufnr, map)
     97 --             actions.select_default:replace(function()
     98 --                 actions.close(prompt_bufnr)
     99 --                 local selection = action_state.get_selected_entry()
    100 --                 local cmd = selection[1]
    101 --                 if cmd then
    102 --                     vim.cmd(cmd)
    103 --                 else
    104 --                     vim.notify("No selection made!", vim.log.levels.WARN)
    105 --                 end
    106 --             end)
    107 --             return true
    108 --         end,
    109 --     }):find()
    110 -- end
    111 --
    112 -- vim.api.nvim_create_user_command("RecordPicker", record_picker, {})