Skip to content
Open
Changes from 1 commit
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
8 changes: 8 additions & 0 deletions src/torchcodec/_core/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ def load_torchcodec_shared_libraries() -> tuple[int, str]:
def expose_ffmpeg_dlls(): # noqa: F811
ffmpeg_dir = Path(ffmpeg_path).parent
return os.add_dll_directory(str(ffmpeg_dir)) # that's the actual CM

if chocolateyInstall := os.environ.get("ChocolateyInstall"):
# Chocolatey creates shim so we need to get the actual path to the FFmpeg executable.
chocolateyInstallPath = Path(chocolateyInstall)
if Path(ffmpeg_path).parent.parent == chocolateyInstallPath and (chocolateyFFmpegSharedPaths := list(chocolateyInstallPath.rglob("lib/ffmpeg-shared/tools/ffmpeg-*-shared/bin"))):
Comment thread
bcw222 marked this conversation as resolved.
Outdated
chocolateyFFmpegSharedPath = chocolateyFFmpegSharedPaths[0]
def expose_ffmpeg_dlls(): # noqa: F811
return os.add_dll_directory(str(chocolateyFFmpegSharedPath))


with expose_ffmpeg_dlls():
Expand Down