Skip to content

Commit cd18188

Browse files
authored
Added warning message for unsupported ffmpeg version (#4041)
* Added warning message for unsupported ffmpeg version * Replaced os.popen with subprocess.run * Removed capture_true argument
1 parent 9766f23 commit cd18188

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

setup.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import subprocess
77
import distutils.command.clean
88
import distutils.spawn
9+
from distutils.version import StrictVersion
910
import glob
1011
import shutil
1112

@@ -346,6 +347,19 @@ def get_extensions():
346347

347348
ffmpeg_exe = distutils.spawn.find_executable('ffmpeg')
348349
has_ffmpeg = ffmpeg_exe is not None
350+
if has_ffmpeg:
351+
try:
352+
ffmpeg_version = subprocess.run(
353+
'ffmpeg -version | head -n1', shell=True,
354+
stdout=subprocess.PIPE).stdout.decode('utf-8')
355+
ffmpeg_version = ffmpeg_version.split('version')[-1].split()[0]
356+
if StrictVersion(ffmpeg_version) >= StrictVersion('4.3'):
357+
print(f'ffmpeg {ffmpeg_version} not supported yet, please use ffmpeg 4.2.')
358+
has_ffmpeg = False
359+
except (IndexError, ValueError):
360+
print('Error fetching ffmpeg version, ignoring ffmpeg.')
361+
has_ffmpeg = False
362+
349363
print("FFmpeg found: {}".format(has_ffmpeg))
350364

351365
if has_ffmpeg:

0 commit comments

Comments
 (0)