본문 바로가기
파이썬

파이썬 How to get the duration of a video in Python?

by º기록 2020. 11. 1.
반응형


 

해결 방법

 


import subprocess

def get_length(filename):
    result = subprocess.run(["ffprobe", "-v", "error", "-show_entries",
                             "format=duration", "-of",
                             "default=noprint_wrappers=1:nokey=1", filename],
        stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT)
    return float(result.stdout)

 

참조 페이지 https://stackoverflow.com/questions/3844430

 

 

반응형

댓글