Closed pizzaisdavid closed 6 months ago
The easiest way to do this from within Aegisub is probably to use Subtitle > Split by Karaoke, delete the first line, and then Join the lines as karaoke again. Alternatively, this could easily be done with an automation script, though I don't know off-hand if there already exists a script for that somewhere.
Thanks for the insights. It has pushed me towards making my first Lua script.
While figuring out how to precede, so far, I think I found some easy manual steps which achieve the goal:
Time/Frame
radio input is set to Time
.Start Time
input.k
tag.I always use a whole number of centiseconds because I am not sure how to handle the rounding for the k
tag.
Here's what I came up with, it seems to work well for my usecase:
--[[
ORIGINAL:
{
"start_time": 1360, (1360 milliseconds / 136 centiseconds)
"end_time": 2590,
"text": "{\\k10}{\\k43}Hey,{\\k8} {\\k26}Ihr{\\k5} {\\k21}da.{\\k10}",
...
}
SHIFTED VIA THE AUTOMATION (THE GOAL):
{
"start_time": 1370, <== added 10
"end_time": 2590,
"text": "{\\k9}{\\k43}Hey,{\\k8} {\\k26}Ihr{\\k5} {\\k21}da.{\\k10}"
... ^== subtracted 1
}
]]
script_name='Remove lead-in without affecting karaoke'
script_description='works best when you set it to a hotkey'
script_author='pizzaisdavid'
script_version='1.0'
function macro_function(
subtitles,
selected_line_indices,
active
)
for _, selected_line_index in ipairs(selected_line_indices) do
local line = subtitles[selected_line_index]
line.start_time = line.start_time + 10
line.text=line.text:gsub(
'\\k(%d+)',
function(duration)
duration = tonumber(duration)
duration = duration - 1
new_tag = string.format('\\k%d', duration)
return new_tag
end,
1
)
subtitles[selected_line_index] = line
end
return selected
end
aegisub.register_macro(
script_name,
script_description,
macro_function
)
Filename is: remove-lead-in-without-affecting-karaoke
Then copying it into the autoload folder and setting a free hot key. I did CTRL-SHIFT-.
as it contains the >
on my keyboard.
I am making subtitles with the karaoke effect.
Here is an example:
Sometimes I want to experiment with the amount of lead time for a line.
Here I added an exaggerated amount of time (using the C hotkey.)
Then committing, turning off karaoke mode, and dragging the red line back to near where it started results the rest of the timings being squished. See here:
And here is a comparison for easy viewing:
In my mind, the karaoke timings would be tied to the audio timing and not relative to the start of a line. -- As shifting a line does not change when an dialogue is said. I understand the ASS format may specify it that way, but the program could do something cool to avoid this problem.
Does anyone have any ideas or work-around?
Here is the files used: unexpected_behaviour.txt https://pixabay.com/sound-effects/welcomestranger-34421/