Datasets:
re-encode 16 corrupted videos in droid_1.0.1
1. Issues
16 video files contain invalid AV1 packets. They are partially readable but decoding eventually fails mid-stream on an invalid packet. Affected files are shown as follow. decoded/total is the number of frames TorchCodec 0.11.1 read before failing.
| # | video path | size (bytes) | decoded/total |
|---|---|---|---|
| 1 | videos/observation.images.exterior_1_left/chunk-000/file-175.mp4 |
484544908 | 8192/90962 |
| 2 | videos/observation.images.exterior_1_left/chunk-000/file-237.mp4 |
503276179 | 62976/95236 |
| 3 | videos/observation.images.exterior_2_left/chunk-000/file-049.mp4 |
486206971 | 67584/89928 |
| 4 | videos/observation.images.wrist_left/chunk-000/file-001.mp4 |
523279020 | 78336/155693 |
| 5 | videos/observation.images.wrist_left/chunk-000/file-003.mp4 |
495201568 | 41984/152115 |
| 6 | videos/observation.images.wrist_left/chunk-000/file-033.mp4 |
481159525 | 4096/147049 |
| 7 | videos/observation.images.wrist_left/chunk-000/file-054.mp4 |
517431576 | 45056/152496 |
| 8 | videos/observation.images.wrist_left/chunk-000/file-094.mp4 |
479142040 | 50688/148504 |
| 9 | videos/observation.images.wrist_left/chunk-000/file-100.mp4 |
518580159 | 73216/160411 |
| 10 | videos/observation.images.wrist_left/chunk-000/file-106.mp4 |
501605293 | 76288/152955 |
| 11 | videos/observation.images.wrist_left/chunk-000/file-114.mp4 |
504551107 | 103936/150721 |
| 12 | videos/observation.images.wrist_left/chunk-000/file-122.mp4 |
505020279 | 73728/152591 |
| 13 | videos/observation.images.wrist_left/chunk-000/file-126.mp4 |
520542826 | 66048/155866 |
| 14 | videos/observation.images.wrist_left/chunk-000/file-148.mp4 |
497680234 | 41472/148508 |
| 15 | videos/observation.images.wrist_left/chunk-000/file-161.mp4 |
505502458 | 57344/152727 |
| 16 | videos/observation.images.wrist_left/chunk-000/file-175.mp4 |
511899902 | 83456/155622 |
Dataset version:
- repo:
lerobot/droid_1.0.1(dataset),codebase_versionv3.0 - revision:
bd92a2c4d6c85f9e16bd7c1f9729f5496d8be672 - video features: 180Γ320, fps 15, cameras
observation.images.{wrist_left, exterior_1_left, exterior_2_left}
2. Reproduction
The failure reproduces across PyAV, TorchCodec and the FFmpeg CLI, on both the FFmpeg 7 and FFmpeg 8 library series:
| Decoder stack | Result |
|---|---|
| PyAV 17.0.1, bundled FFmpeg 8 libs | 16/16 fail β InvalidDataError at avcodec_send_packet() |
PyAV 15.1.0, bundled FFmpeg 7 libs (lerobot-main av>=15,<16) |
16/16 fail β InvalidDataError at avcodec_send_packet() |
| TorchCodec 0.10.0, torch 2.10.0+cu128 | 16/16 fail β Could not push packet to decoder |
| TorchCodec 0.11.1, torch 2.11.0+cu128 (lerobot-main lock) | 16/16 fail β Could not push packet to decoder |
FFmpeg 7.0.2 CLI (imageio-ffmpeg==0.6.0) |
exit 0, but Error submitting packet to decoder: Invalid data found when processing input on stderr for every file |
Reference reproduction environment (PyAV path): Python 3.12.12, torch==2.11.0+cu128, torchvision==0.26.0+cu128, torchcodec==0.11.1, av==15.1.0, imageio-ffmpeg==0.6.0 (PyAV-bundled libavcodec 61.19.101 / libavformat 61.7.100).
Minimal PyAV reproduction:
import av
from huggingface_hub import hf_hub_download
repo_id = "lerobot/droid_1.0.1"
revision = "bd92a2c4d6c85f9e16bd7c1f9729f5496d8be672"
filename = "videos/observation.images.wrist_left/chunk-000/file-033.mp4"
path = hf_hub_download(repo_id=repo_id, repo_type="dataset", revision=revision, filename=filename)
with av.open(path) as container:
stream = container.streams.video[0]
for _ in container.decode(stream): # fails partway through
pass
Observed error:
av.error.InvalidDataError: [Errno 1094995529] Invalid data found when processing input: 'avcodec_send_packet()'
Minimal TorchCodec reproduction:
from huggingface_hub import hf_hub_download
from torchcodec.decoders import VideoDecoder
repo_id = "lerobot/droid_1.0.1"
revision = "bd92a2c4d6c85f9e16bd7c1f9729f5496d8be672"
filename = "videos/observation.images.wrist_left/chunk-000/file-033.mp4"
path = hf_hub_download(repo_id=repo_id, repo_type="dataset", revision=revision, filename=filename)
decoder = VideoDecoder(path, device="cpu", seek_mode="exact", dimension_order="NHWC")
for start in range(0, len(decoder), 512):
end = min(start + 512, len(decoder))
decoder.get_frames_at(list(range(start, end))) # fails on the bad GOP
Observed error:
Could not push packet to decoder: Invalid data found when processing input
3. Fix
3.1 Source of replacement frames. The original RLDS DROID 1.0.1 dataset (gs://gresearch/robotics/droid/1.0.1, TFDS, 2048 tfrecord shards, 95 658 episodes).
3.2 Index the corresponding episode in the RLDS.
the LeRobot
episode_indexdoes not match the RLDS canonical (shard) order β the dataset build reordered episodes. So a naive index β index lookup is wrong.
We instead match episodes with the lossless actions: every LeRobot frame's action.joint_position equals exactly one RLDS step's action_dict/joint_position in the same episode. For each target episode, we read the RLDS in canonical order, match a distinctive middle-frame joint key, and confirm with a full subsequence check:
- action: per-frame
joint_positionmax-abs-diff β 0; - episode length: RLDS step count
T== LeRobot episode lengthL; - pixels: decode the original LeRobot video and compare to the RLDS frames β aligned PSNR β 37.5 dB (the expected AV1 loss)
All 7753 episodes matched (~2.26 M frames total), every one with an identity step mapping (L == T, contiguous)
3.3 Encode the correct frames back to video
For each file, in episode order, the matched RLDS JPEG frames are decoded to RGB and re-encoded into a single .mp4 with libsvtav1, yuv420p, fps 15, g=2, crf=30, matching the rest of the dataset. Each episode's exact frame count and order is preserved, so the existing meta/episodes parquet from/to timestamps stay valid and no metadata is changed. Re-encode quality is PSNR 36.3β41.0 dB, on par with the originals (35.5β40.0 dB).
4. Verification
Passes on all 16 updated files (no InvalidDataError, exact frame count):
import av
def full_decode(path: str) -> int:
"""Return the number of decoded frames; raises on any invalid packet."""
n = 0
with av.open(path) as container:
for _ in container.decode(container.streams.video[0]):
n += 1
return n
# Each of the 16 updated files now decodes completely, e.g.:
# videos/observation.images.wrist_left/chunk-000/file-033.mp4 -> 147049 (== total)
# videos/observation.images.wrist_left/chunk-000/file-114.mp4 -> 150721 (== total)
for rel, total in AFFECTED_FILES: # (path, expected frame count)
assert full_decode(local_path(rel)) == total
Amazing, thanks you so much for the fix !