mirror of
https://github.com/master-of-zen/Av1an.git
synced 2024-11-24 18:18:06 +00:00
added optional fast probe fs vapoursynth lsmash installed
This commit is contained in:
parent
25825bf341
commit
38ddec4954
1 changed files with 9 additions and 4 deletions
|
@ -8,6 +8,7 @@ import cv2
|
|||
import numpy as np
|
||||
import hashlib
|
||||
|
||||
|
||||
from av1an.commandtypes import Command
|
||||
from av1an.ffmpeg import frame_probe_ffmpeg
|
||||
from av1an.vapoursynth import frame_probe_vspipe, is_vapoursynth
|
||||
|
@ -63,10 +64,13 @@ def frame_probe_fast(source: Path, is_vs: bool = False):
|
|||
"""
|
||||
total = 0
|
||||
if not is_vs:
|
||||
video = cv2.VideoCapture(source.as_posix())
|
||||
total = int(video.get(cv2.CAP_PROP_FRAME_COUNT))
|
||||
video.release()
|
||||
|
||||
try:
|
||||
from vapoursynth import core
|
||||
total = core.lsmas.LWLibavSource(source.as_posix(), cache=False)
|
||||
except ImportError:
|
||||
video = cv2.VideoCapture(source.as_posix())
|
||||
total = int(video.get(cv2.CAP_PROP_FRAME_COUNT))
|
||||
video.release()
|
||||
if is_vs or total < 1:
|
||||
total = frame_probe(source)
|
||||
|
||||
|
@ -82,4 +86,5 @@ def frame_probe(source: Path):
|
|||
"""
|
||||
if is_vapoursynth(source):
|
||||
return frame_probe_vspipe(source)
|
||||
|
||||
return frame_probe_ffmpeg(source)
|
||||
|
|
Loading…
Reference in a new issue