File size: 526 Bytes
627d3d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import subprocess
from functools import lru_cache


@lru_cache()
def ffmpeg_version():
    try:
        result = subprocess.check_output(
            ["ffmpeg", "-version"], shell=False, encoding="utf8"
        )
        version_info = result.split("\n")[0]
        version_info = version_info.split("ffmpeg version")[1].strip()
        version_info = version_info.split("Copyright")[0].strip()
        return version_info
    except Exception:
        return "<none>"


if __name__ == "__main__":
    print(ffmpeg_version())