Skip to content

Commit

Permalink
fixed issue #2470 (some windows support for ffmpeg calls)
Browse files Browse the repository at this point in the history
  • Loading branch information
David Traparic committed Sep 11, 2024
1 parent bfdd1f9 commit c93e865
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
15 changes: 11 additions & 4 deletions mmcv/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from importlib import import_module
from inspect import getfullargspec
from itertools import repeat
import platform


# From PyTorch internals
Expand Down Expand Up @@ -251,10 +252,16 @@ def _check_py_package(package):


def _check_executable(cmd):
if subprocess.call(f'which {cmd}', shell=True) != 0:
return False
else:
return True
if platform.system() == 'Linux':
if subprocess.call(f'which {cmd}', shell=True) != 0:
return False
else:
return True
if platform.system() == 'Windows':
if subprocess.call(f'where {cmd}', shell=True) != 0:
return False
else:
return True


def requires_package(prerequisites):
Expand Down
4 changes: 2 additions & 2 deletions mmcv/video/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def convert_video(in_file: str,
options.append(f'-loglevel {v}')
else:
options.append(f'-{k} {v}')
cmd = f'ffmpeg -y {pre_options} -i {in_file} {" ".join(options)} ' \
f'{out_file}'
cmd = f'ffmpeg -y {pre_options} -i "{in_file}" {" ".join(options)} ' \
f'"{out_file}"'
if print_cmd:
print(cmd)
subprocess.call(cmd, shell=True)
Expand Down

0 comments on commit c93e865

Please sign in to comment.