some frame count logs

This commit is contained in:
Zen 2021-05-05 21:11:08 +03:00
parent c9f8c4a7bf
commit a93d1ac566
2 changed files with 11 additions and 2 deletions

View file

@ -31,7 +31,10 @@ def frame_probe_ffmpeg(source: Path):
matches = re.findall(
r"frame=\s*([0-9]+)\s", r.stderr.decode("utf-8") + r.stdout.decode("utf-8")
)
return int(matches[-1])
total = int(matches[-1])
log("Get frame count with ffmpeg")
log(f"Frame count: {total}")
return total
def get_frametypes(file: Path) -> List:

View file

@ -10,6 +10,7 @@ import hashlib
from av1an.ffmpeg import frame_probe_ffmpeg
from av1an.vapoursynth import frame_probe_vspipe, is_vapoursynth
from av1an.logger import log
def terminate():
@ -22,8 +23,10 @@ def hash_path(s: str) -> int:
:param s: string
"""
assert isinstance(s, str)
file_hash = str(hashlib.sha3_512(s.encode()).hexdigest())[-8:]
log(f"File hash: {file_hash}")
return str(hashlib.sha3_512(s.encode()).hexdigest())[-8:]
return file_hash
def get_cq(command):
@ -71,11 +74,14 @@ def frame_probe_fast(source: Path, is_vs: bool = False):
total = core.lsmas.LWLibavSource(
source.as_posix(), cache=False
).num_frames
log("Get frame count with lsmash")
log(f"Frame count: {total}")
return total
except:
video = cv2.VideoCapture(source.as_posix())
total = int(video.get(cv2.CAP_PROP_FRAME_COUNT))
video.release()
log("Can't open input with Pyscenedetect OpenCV")
if is_vs or total < 1:
total = frame_probe(source)