Skip to content

Commit e490845

Browse files
committed
Fix multisegment import not working properly with new SD format
1 parent 98bce8f commit e490845

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

encode.avs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ file = hd \
126126
: "logo.png"
127127
# file = !hd ? "logo34.png" : "hdlogo34.png"
128128

129-
prescaleFactor > 1 ? \
129+
prescaleFactor > 1 && !hd ? \
130130
PointResize(last.width * prescaleFactor, last.height * prescaleFactor) : 0
131131

132132
# Aspect ratio correction for SD encodes
@@ -164,7 +164,7 @@ resized = hd \
164164
: Lanczos4Resize(width, height)
165165

166166
# If ms enabled, we use parameters of "resized" to apply to all segments
167-
resized = ms ? resized.AppendSegment(ms_base, ms_start, ms_end, ms_format, resizer, pixelType).ConvertToRGB32() : resized
167+
resized = ms ? resized.AppendSegment(ms_base, ms_start, ms_end, ms_format, resizer, hd, pixelType).ConvertToRGB32() : resized
168168

169169
# Logo
170170
logoVideo = ImageSource(file=file, start=0, end=int((resized.FrameRate * 2) - 1), fps=resized.FrameRate) \

programs/functions.avsi

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,26 @@ function AppendSegment(
66
\ int last_val,
77
\ string format,
88
\ string resizer,
9+
\ bool hd,
910
\ string pix_type
1011
\){
1112
filename = base + string(first_val, format) + ".avi"
12-
result = AviSource(filename, pixel_type=pix_type).Eval(resizer + """Resize(sample.width, sample.height)""")
13-
return (first_val < last_val) \
14-
? result + sample.AppendSegment(base, first_val+1, last_val, format, resizer, pix_type) \
13+
result = AviSource(filename, pixel_type=pix_type)
14+
15+
if (hd) {
16+
result = result.Eval(resizer + """Resize(sample.width, sample.height)""")
17+
return (first_val < last_val) \
18+
? result + sample.AppendSegment(base, first_val+1, last_val, format, resizer, hd, pix_type) \
1519
: result
20+
} else {
21+
scaler = sample.height / result.height
22+
temp_width = result.width * scaler
23+
result = result.PointResize(temp_width, sample.height)
24+
result = result.Lanczos4Resize(sample.width, sample.height)
25+
return (first_val < last_val) \
26+
? result + sample.AppendSegment(base, first_val+1, last_val, format, resizer, hd, pix_type) \
27+
: result
28+
}
1629
}
1730

1831
function Remove(

0 commit comments

Comments
 (0)