Get ffmpeg version identifier, or None if ffmpeg is not found. Uses `get_ffmpeg_path()`.
()
| 278 | |
| 279 | |
| 280 | def get_ffmpeg_version() -> str | None: |
| 281 | """Get ffmpeg version identifier, or None if ffmpeg is not found. Uses `get_ffmpeg_path()`.""" |
| 282 | ffmpeg_path = get_ffmpeg_path() |
| 283 | if ffmpeg_path is None: |
| 284 | return None |
| 285 | # If get_ffmpeg_path() returns a value, the path it returns should be invocable. |
| 286 | output = subprocess.check_output(args=[ffmpeg_path, "-version"], text=True) |
| 287 | output_split = output.split() |
| 288 | if len(output_split) >= 3 and output_split[1] == "version": |
| 289 | return output_split[2] |
| 290 | # If parsing the version fails, return the entire first line of output. |
| 291 | return output.splitlines()[0] |
| 292 | |
| 293 | |
| 294 | def get_mkvmerge_path() -> str | None: |
no test coverage detected