Skip to content

Enable building torchvision with ffmpeg regardless of version on Linux #4413

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,14 +360,9 @@ def get_extensions():
has_ffmpeg = False
if has_ffmpeg:
try:
# this splits on both dots and spaces as the output format differs across versions / platforms
ffmpeg_version_str = str(subprocess.check_output(["ffmpeg", "-version"]))
ffmpeg_version = re.split(r"ffmpeg version |\.| |-", ffmpeg_version_str)[1:3]
ffmpeg_version = ".".join(ffmpeg_version)
if StrictVersion(ffmpeg_version) >= StrictVersion('4.3'):
print(f'ffmpeg {ffmpeg_version} not supported yet, please use ffmpeg 4.2.')
has_ffmpeg = False
except (subprocess.CalledProcessError, IndexError, ValueError):
# This is to check if ffmpeg is installed properly.
subprocess.check_output(["ffmpeg", "-version"])
except subprocess.CalledProcessError:
print('Error fetching ffmpeg version, ignoring ffmpeg.')
has_ffmpeg = False

Expand Down