Skip to content

Commit ccf2484

Browse files
fix(encoders): adding pyav supported hevc encoder instead of h265
1 parent dbe4cc1 commit ccf2484

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

benchmarks/video/run_video_benchmark.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ def main(
416416
"--vcodec",
417417
type=str,
418418
nargs="*",
419-
default=["libx264", "libx265", "libsvtav1"],
419+
default=["libx264", "hevc", "libsvtav1"],
420420
help="Video codecs to be tested",
421421
)
422422
parser.add_argument(
@@ -446,7 +446,7 @@ def main(
446446
# nargs="*",
447447
# default=[0, 1],
448448
# help="Use the fastdecode tuning option. 0 disables it. "
449-
# "For libx264 and libx265, only 1 is possible. "
449+
# "For libx264 and libx265/hevc, only 1 is possible. "
450450
# "For libsvtav1, 1, 2 or 3 are possible values with a higher number meaning a faster decoding optimization",
451451
# )
452452
parser.add_argument(

lerobot/common/datasets/video_utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,19 @@ def encode_video_frames(
255255
overwrite: bool = False,
256256
) -> None:
257257
"""More info on ffmpeg arguments tuning on `benchmark/video/README.md`"""
258+
# Check encoder availability
259+
if vcodec not in ["h264", "hevc", "libsvtav1"]:
260+
raise ValueError(f"Unsupported video codec: {vcodec}. Supported codecs are: h264, hevc, libsvtav1.")
261+
258262
video_path = Path(video_path)
259263
imgs_dir = Path(imgs_dir)
260264

261265
video_path.parent.mkdir(parents=True, exist_ok=overwrite)
262266

263267
# Encoders/pixel formats incompatibility check
264-
if vcodec == "libsvtav1" and pix_fmt == "yuv444p":
268+
if (vcodec == "libsvtav1" or vcodec == "hevc") and pix_fmt == "yuv444p":
265269
logging.warning(
266-
"Incompatible pixel format 'yuv444p' for codec 'libsvtav1', auto-selecting format 'yuv420p'"
270+
f"Incompatible pixel format 'yuv444p' for codec {vcodec}, auto-selecting format 'yuv420p'"
267271
)
268272
pix_fmt = "yuv420p"
269273

0 commit comments

Comments
 (0)