Skip to content

Commit

Permalink
length and timestamps kinda fixed (audio buggy)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsetareh committed Aug 2, 2023
1 parent e2af95a commit d81a803
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/encode.moon
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ get_playback_options = ->

return ret

-- not gonna try to fix this, but it would be the better method
get_speed_flags = ->
ret = {}
speed = mp.get_property_native("speed")
Expand Down Expand Up @@ -199,8 +200,8 @@ get_video_encode_flags = (format, region) ->
append(flags, {
"--vf-add=#{f}"
})

append(flags, get_speed_flags!)
-- old (better) method
-- append(flags, get_speed_flags!)
return flags

calculate_bitrate = (active_tracks, format, length) ->
Expand Down
7 changes: 4 additions & 3 deletions src/util.moon
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ seconds_to_time_string = (seconds, no_ms, full) ->
if seconds < 0
return "unknown"
ret = ""
ret = string.format(".%03d", seconds * 1000 % 1000) unless no_ms
ret = string.format("%02d:%02d%s", math.floor(seconds / 60) % 60, math.floor(seconds) % 60, ret)
normalized_seconds = seconds / options.video_speed
ret = string.format(".%03d", normalized_seconds * 1000 % 1000) unless no_ms
ret = string.format("%02d:%02d%s", math.floor(normalized_seconds / 60) % 60, math.floor(normalized_seconds) % 60, ret)
if full or seconds > 3600
ret = string.format("%d:%s", math.floor(seconds / 3600), ret)
ret = string.format("%d:%s", math.floor(normalized_seconds / 3600), ret)
ret

-- correct clip length by subtracting 1 frames worth of time as best we can
Expand Down

0 comments on commit d81a803

Please sign in to comment.