Made precise ASS timings a setting
This commit is contained in:
parent
f9a29ab800
commit
52efe64f40
|
@ -4,6 +4,7 @@ import (
|
|||
"fmt"
|
||||
"git.gammaspectra.live/WeebDataHoarder/swf2ass-go/ass/tag"
|
||||
asstime "git.gammaspectra.live/WeebDataHoarder/swf2ass-go/ass/time"
|
||||
"git.gammaspectra.live/WeebDataHoarder/swf2ass-go/settings"
|
||||
"git.gammaspectra.live/WeebDataHoarder/swf2ass-go/types"
|
||||
"git.gammaspectra.live/WeebDataHoarder/swf2ass-go/types/shapes"
|
||||
"regexp"
|
||||
|
@ -123,10 +124,12 @@ func (l *EventLine) Encode(frameDuration time.Duration) string {
|
|||
|
||||
text := make([]string, 0, 1+len(l.Tags))
|
||||
|
||||
eventTimeTags := eventTime.Encode()
|
||||
if settings.GlobalSettings.ASSPreciseTiming {
|
||||
eventTimeTags := eventTime.Encode()
|
||||
|
||||
if len(eventTimeTags) > 0 {
|
||||
text = append(text, eventTimeTags)
|
||||
if len(eventTimeTags) > 0 {
|
||||
text = append(text, eventTimeTags)
|
||||
}
|
||||
}
|
||||
|
||||
for _, t := range l.Tags {
|
||||
|
|
|
@ -118,7 +118,6 @@ func (t EventTime) GetDurationFromEndOffset(frameOffset int64) time.Duration {
|
|||
func (t EventTime) Encode() string {
|
||||
if t.Start.AdjustedMillisecondError != 0 || t.End.AdjustedMillisecondError != 0 {
|
||||
//Adjust frame precision exactly to frame boundaries. This is necessary due to low ASS timing precision
|
||||
//TODO: Maybe use fade?
|
||||
frameStartTime := t.GetDurationFromStartOffset(0).Milliseconds()
|
||||
frameEndTime := t.GetDurationFromEndOffset(0).Milliseconds()
|
||||
//TODO: maybe needs to be -1?
|
||||
|
|
|
@ -8,6 +8,11 @@ type Settings struct {
|
|||
// Note that at high ASSDrawingScale >= 5 this will be brought down to 0 regardless
|
||||
ASSDrawingPrecision int
|
||||
|
||||
// ASSPreciseTiming Enables precise timing via \fade transitions for each event.
|
||||
// libass is only precise to 1/100th of a second, causing issues with higher framerate content
|
||||
// Additionally extra \err annotations will be placed to note the current error adjusted
|
||||
ASSPreciseTiming bool
|
||||
|
||||
// VideoRateMultiplier Adjusts the viewport scale. All operations and transforms will be adjusted accordingly
|
||||
// For example, VideoScaleMultiplier = 2 will make a 640x480 viewport become 1280x960
|
||||
VideoScaleMultiplier float64
|
||||
|
@ -49,6 +54,7 @@ const DefaultASSDrawingPrecision = 2
|
|||
var GlobalSettings = Settings{
|
||||
ASSDrawingScale: DefaultASSDrawingScale,
|
||||
ASSDrawingPrecision: DefaultASSDrawingPrecision,
|
||||
ASSPreciseTiming: true,
|
||||
VideoScaleMultiplier: 1,
|
||||
VideoRateMultiplier: 1,
|
||||
|
||||
|
|
Loading…
Reference in a new issue