Last active
September 6, 2025 10:29
-
-
Save natyusha/18f9e52a91bc873b8207cf6ed06accd4 to your computer and use it in GitHub Desktop.
An Aegisub macro which automatically compresses timestamps for 23.976fps sources that have been converted to 24fps
This file contains hidden or 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
script_name = "23.976fps to 24fps Subtitles" | |
script_description = "Automatically compress timestamps for 23.976fps sources that have been converted to 24fps" | |
script_author = "natyusha" | |
script_version = "1.0" | |
function f23_976fps_to_24fps(subs) | |
-- Scale factor for 23.976fps to 24fps conversion (23.976 / 24) | |
local scale_factor = 23.976 / 24 -- Approximately 0.999 (999 / 1000) | |
-- Process all subtitle lines | |
for i = 1, #subs do | |
local line = subs[i] | |
if line.class == "dialogue" then | |
-- Apply time compression (in milliseconds) | |
line.start_time = line.start_time * scale_factor | |
line.end_time = line.end_time * scale_factor | |
subs[i] = line | |
end | |
end | |
aegisub.set_undo_point(script_name) | |
end | |
function check_subtitle_exists(subs) | |
return #subs > 0 | |
end | |
aegisub.register_macro(script_name, script_description, f23_976fps_to_24fps, check_subtitle_exists) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment