Description
get_safe_default_video_backend() promotes torchcodec to the default video backend whenever importlib.util.find_spec("torchcodec") succeeds. But installed is not the same as loadable: torchcodec links against FFmpeg shared libraries at runtime, which are commonly absent on Windows (and on minimal Linux images). find_spec still sees the package, the default becomes torchcodec, and every dataset video decode then crashes with a DLL-load RuntimeError unless the user knows to pass video_backend="pyav" explicitly.
Reproduction
- Windows machine without FFmpeg shared libraries on PATH
pip install "lerobot[dataset]" (installs the torchcodec wheel fine)
- Load any video dataset with defaults:
LeRobotDataset("lerobot/pusht")[0]
- Crash at first decode; workaround is
video_backend="pyav"
Expected behavior
The safe default should verify the backend actually loads (e.g., probe torchcodec.decoders, which decoding imports anyway) and fall back to pyav with an actionable warning. PR attached.
Description
get_safe_default_video_backend()promotes torchcodec to the default video backend wheneverimportlib.util.find_spec("torchcodec")succeeds. But installed is not the same as loadable: torchcodec links against FFmpeg shared libraries at runtime, which are commonly absent on Windows (and on minimal Linux images).find_specstill sees the package, the default becomestorchcodec, and every dataset video decode then crashes with a DLL-loadRuntimeErrorunless the user knows to passvideo_backend="pyav"explicitly.Reproduction
pip install "lerobot[dataset]"(installs the torchcodec wheel fine)LeRobotDataset("lerobot/pusht")[0]video_backend="pyav"Expected behavior
The safe default should verify the backend actually loads (e.g., probe
torchcodec.decoders, which decoding imports anyway) and fall back to pyav with an actionable warning. PR attached.