def get_frame_vectors(file): crop = get_crop(file) sigfile = basename(file) + ".xml" folder = dirname(file) if crop: vf = "{},signature=format=xml:filename={}".format(crop, sigfile) else: vf = "signature=format=xml:filename={}".format(sigfile) with cd(folder): cmd = [ffmpeg.exe_path(), "-i", file, "-vf", vf, "-f", "null", "-"] subprocess.run(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) tree = etree.parse(sigfile) root = tree.getroot() os.remove(sigfile) frames = [] frame_els = root.xpath("//a:FrameSignature", namespaces=NSMAP) for frame_el in frame_els: frames.append(tuple(int(t) for t in frame_el.text.split())) return tuple(frames)
def test_ffmpeg_exists(): assert os.path.exists(ffmpeg.exe_path())
def test_ffmpeg_executable(): assert os.access(ffmpeg.exe_path(), os.X_OK)
def test_exe_path(): assert "ffmpeg" in ffmpeg.exe_path()