mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-24 10:16:09 +00:00
feat(video): alias "av1" to "libsvtav1" for backward compat
This commit is contained in:
@@ -138,6 +138,12 @@ class VideoEncoderConfig:
|
|||||||
also silently rewritten to ``libsvtav1`` so encoding never hard-fails on
|
also silently rewritten to ``libsvtav1`` so encoding never hard-fails on
|
||||||
a host missing the requested encoder.
|
a host missing the requested encoder.
|
||||||
"""
|
"""
|
||||||
|
# Backward compatibility: older datasets persist ``vcodec="av1"`` in
|
||||||
|
# ``info.json``. Rewrite to the canonical encoder name *before* the
|
||||||
|
# validation check below so loading those datasets keeps working.
|
||||||
|
if self.vcodec == "av1":
|
||||||
|
self.vcodec = "libsvtav1"
|
||||||
|
|
||||||
if self.vcodec not in VALID_VIDEO_CODECS:
|
if self.vcodec not in VALID_VIDEO_CODECS:
|
||||||
raise ValueError(f"Invalid vcodec '{self.vcodec}'. Must be one of: {sorted(VALID_VIDEO_CODECS)}")
|
raise ValueError(f"Invalid vcodec '{self.vcodec}'. Must be one of: {sorted(VALID_VIDEO_CODECS)}")
|
||||||
if self.vcodec == "auto":
|
if self.vcodec == "auto":
|
||||||
|
|||||||
@@ -311,6 +311,18 @@ class TestEncoderDetection:
|
|||||||
assert "h264_videotoolbox" in VALID_VIDEO_CODECS
|
assert "h264_videotoolbox" in VALID_VIDEO_CODECS
|
||||||
assert "h264_nvenc" in VALID_VIDEO_CODECS
|
assert "h264_nvenc" in VALID_VIDEO_CODECS
|
||||||
|
|
||||||
|
def test_av1_alias_resolves_to_libsvtav1(self):
|
||||||
|
"""Older datasets persist ``vcodec="av1"``; backward-compat alias must keep them loadable."""
|
||||||
|
cfg = VideoEncoderConfig(vcodec="av1")
|
||||||
|
assert cfg.vcodec == "libsvtav1"
|
||||||
|
|
||||||
|
def test_av1_alias_persisted_after_resolve(self):
|
||||||
|
"""Repeated calls to ``resolve_vcodec`` should be idempotent (alias only fires once)."""
|
||||||
|
cfg = VideoEncoderConfig(vcodec="av1")
|
||||||
|
assert cfg.vcodec == "libsvtav1"
|
||||||
|
cfg.resolve_vcodec()
|
||||||
|
assert cfg.vcodec == "libsvtav1"
|
||||||
|
|
||||||
|
|
||||||
ARTIFACTS = Path(__file__).parent.parent / "fixtures" / "artifacts" / "videos"
|
ARTIFACTS = Path(__file__).parent.parent / "fixtures" / "artifacts" / "videos"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user