You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Actually enable SIMD for scenecut detection. Oops.
- Always use the VapoursynthDecoder instead of piping to reduce memory
bandwidth overhead.
- Use the default cachepath behavior (place the cache file next to the
video), this avoids needing to re-cache if av1an's input hash changes,
and for some reason is just faster.
@@ -33,61 +23,22 @@ if not os.path.exists(source):
33
23
# Import video
34
24
match (chunk_method): # type: ignore
35
25
case "lsmash":
36
-
video = core.lsmas.LWLibavSource(source, cachefile=cache_file)
26
+
video = core.lsmas.LWLibavSource(source)
37
27
case "ffms2":
38
-
video = core.ffms2.Source(source, cachefile=cache_file)
28
+
video = core.ffms2.Source(source)
39
29
case "dgdecnv":
40
30
video = core.dgdecodenv.DGSource(source)
41
31
case "bestsource":
42
-
# Different versions of BestSource have different behaviors on Windows
43
-
# Versions R1 and older support absolute paths just as Av1an originally expected (with .json extension)
44
-
# Versions R8 and newer support absolute paths for cache files, but require setting cachemode to 4
45
-
# Versions since ~R2 attempt to create a path stemming from CWD but using the path of the source and also appends the track index and a .bsindex extension, which is unexpected for Av1an
46
-
# Unfortunately, BestSource is not keeping the reported version number updated properly so we cannot reliably determine if it supports absolute paths or not
47
-
# At best, we can wrap an attempt in a try/except block as previous versions of BestSource should throw an exception if an invalid cachemode value is provided
48
-
try:
49
-
video = core.bs.VideoSource(source, cachepath=cache_file, cachemode=4)
50
-
except Exception:
51
-
# Installed BestSource version does not support absolute paths, fallback to default behavior
52
-
video = core.bs.VideoSource(source, cachepath=cache_file)
53
-
54
-
# Scene Detection
55
-
# Bicubic is based on FFmpeg defaults. See https://ffmpeg.org/ffmpeg-scaler.html#toc-Scaler-Options
56
-
scaler_function = core.resize.Bicubic
57
-
# Map scaler parameter to equivalent vapoursynth scaler. See https://www.vapoursynth.com/doc/functions/video/resize.html#resize
58
-
if scaler is not None:
59
-
match (scaler.lower()):
60
-
case "fast_bilinear" | "bilinear": scaler_function = core.resize.Bilinear
61
-
case "neighbor": scaler_function = core.resize.Point
62
-
case _: scaler_function = core.resize.Bicubic
63
-
64
-
# Map pixel format to equivalent vapoursynth pixel format (Needs expansion)
65
-
if pixel_format is not None:
66
-
match (pixel_format.lower()):
67
-
case "yuv420p": pixel_format = vapoursynth.YUV420P8
68
-
case "yuv420p10le": pixel_format = vapoursynth.YUV420P10
69
-
case _: pixel_format = None
32
+
# bestsource has the default behavior to store its index files in a user-specific directory
33
+
# but for consistency, this setting makes it store the index file next to the video
34
+
# as all the other source filters do
35
+
video = core.bs.VideoSource(source, cachepath="/")
70
36
71
-
# Apply Scene Detection Processing
72
-
if perform_scene_detection is not None:
73
-
if downscale_height is not None or pixel_format is not None:
74
-
# Ensure downscale_height is not greater than video height
0 commit comments