コード例 #1
0
ファイル: video_id.py プロジェクト: pombredanne/iscc-cli
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)
コード例 #2
0
def test_ffmpeg_exists():
    assert os.path.exists(ffmpeg.exe_path())
コード例 #3
0
def test_ffmpeg_executable():
    assert os.access(ffmpeg.exe_path(), os.X_OK)
コード例 #4
0
def test_exe_path():
    assert "ffmpeg" in ffmpeg.exe_path()