HaomingSong commited on
Commit
ba788f7
·
verified ·
1 Parent(s): bd92a2c

re-encode 16 corrupted videos in `lerobot/droid_1.0.1`

Browse files

## Problem

16 video files in this dataset contain **invalid AV1 packets**. They are
partially readable but decoding eventually fails mid-stream on an invalid packet.
Because LeRobot v3.0 packs many episodes back-to-back into each `.mp4`, a single
bad packet makes the surrounding frames undecodable and **crashes dataset
iteration / training** when a sampled frame range touches the bad region. This is
not a local-cache issue: the files were re-downloaded from the Hub at revision
`bd92a2c4d6c85f9e16bd7c1f9729f5496d8be672` and reproduced byte-for-byte, and every
decoder stack tested fails on the same packets.

Affected files (`decoded/total` = frames TorchCodec 0.11.1 read before failing):

| video path | decoded/total |
|---|---:|
| `videos/observation.images.exterior_1_left/chunk-000/file-175.mp4` | 8192/90962 |
| `videos/observation.images.exterior_1_left/chunk-000/file-237.mp4` | 62976/95236 |
| `videos/observation.images.exterior_2_left/chunk-000/file-049.mp4` | 67584/89928 |
| `videos/observation.images.wrist_left/chunk-000/file-001.mp4` | 78336/155693 |
| `videos/observation.images.wrist_left/chunk-000/file-003.mp4` | 41984/152115 |
| `videos/observation.images.wrist_left/chunk-000/file-033.mp4` | 4096/147049 |
| `videos/observation.images.wrist_left/chunk-000/file-054.mp4` | 45056/152496 |
| `videos/observation.images.wrist_left/chunk-000/file-094.mp4` | 50688/148504 |
| `videos/observation.images.wrist_left/chunk-000/file-100.mp4` | 73216/160411 |
| `videos/observation.images.wrist_left/chunk-000/file-106.mp4` | 76288/152955 |
| `videos/observation.images.wrist_left/chunk-000/file-114.mp4` | 103936/150721 |
| `videos/observation.images.wrist_left/chunk-000/file-122.mp4` | 73728/152591 |
| `videos/observation.images.wrist_left/chunk-000/file-126.mp4` | 66048/155866 |
| `videos/observation.images.wrist_left/chunk-000/file-148.mp4` | 41472/148508 |
| `videos/observation.images.wrist_left/chunk-000/file-161.mp4` | 57344/152727 |
| `videos/observation.images.wrist_left/chunk-000/file-175.mp4` | 83456/155622 |

## Reproduction

All decoder stacks fail (PyAV 17.0.1/FFmpeg 8, PyAV 15.1.0/FFmpeg 7,
TorchCodec 0.10.0, TorchCodec 0.11.1; the FFmpeg 7.0.2 CLI exits 0 but logs an
invalid-packet error per file).

```python
import av
from huggingface_hub import hf_hub_download

path = hf_hub_download(
repo_id="lerobot/droid_1.0.1", repo_type="dataset",
revision="bd92a2c4d6c85f9e16bd7c1f9729f5496d8be672",
filename="videos/observation.images.wrist_left/chunk-000/file-033.mp4",
)
with av.open(path) as container:
for _ in container.decode(container.streams.video[0]): # fails partway through
pass
# av.error.InvalidDataError: [Errno 1094995529] Invalid data found when processing input: 'avcodec_send_packet()'
```

TorchCodec shows `Could not push packet to decoder: Invalid data found when processing input`.

## Fix

Replacement frames come from the original RLDS DROID 1.0.1
(`gs://gresearch/robotics/droid/1.0.1`), where the three camera observations are
stored as 180x320 JPEG — exactly this dataset's video resolution — so frames are
decoded and re-encoded with no resizing.

1. **Locate the episodes.** In v3.0 each video file holds a contiguous block of
episodes packed back-to-back (within a file, video order == increasing
`episode_index`, frames are seamless, and `sum(episode length) == video frame
count`). The whole file is rebuilt (all its episodes) so no latent bad packet
survives.
2. **Index the correct RLDS episode.** The LeRobot `episode_index` does **not**
match the RLDS canonical (shard) order, so episodes are content-joined on the
lossless `action.joint_position` (each LeRobot frame equals exactly one RLDS
step's `action_dict/joint_position`, as a subsequence). Each match is verified
by exact action diff, episode length, and pixel PSNR vs the readable head of
the original video. All matched episodes have an identity step mapping.
3. **Re-encode.** RLDS JPEG frames are decoded to RGB and re-encoded as
**libsvtav1, yuv420p, fps 15, g=2, crf=30** (the LeRobot v3.0 RGB-camera
defaults). Each episode's exact frame count and order is preserved, so the
`meta/episodes` parquet `from/to` timestamps stay valid (no metadata changes).
Re-encode PSNR (36.3-41.0 dB) is on par with the originals.

## Verification

Running the §Reproduction decode loop as a full decode over every frame now
passes on all 16 updated files (no `InvalidDataError`, exact frame counts), and
`LeRobotDataset` iterating all 9023 frames of the 16 previously-failing episodes
raises no exception.

videos/observation.images.exterior_1_left/chunk-000/file-175.mp4 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:6a63194968b8797c6db56c7066c1d59ddef21b6d416297237d7d17be10b9453a
3
- size 484544908
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5de4ff57a2e870e815a49b1ca55c7131d7781d77c198f1f188418f106bc2a5a9
3
+ size 497541072
videos/observation.images.exterior_1_left/chunk-000/file-237.mp4 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:e63d93a8b0eb299cf0b7f3a68e028f5da83358b1436b924b2fa4a47bb0cb668c
3
- size 503276179
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a5f05b92df51dfca1ec5b354e7716fc8c5bd16c4faa0563dfcfe99d0f23cd913
3
+ size 516881396
videos/observation.images.exterior_2_left/chunk-000/file-049.mp4 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:2ec67756937fc8f7ae26934b60a78edbd6a6af664c67469a3a0fc3524b252d43
3
- size 486206971
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c6888364cdbf84a0a9c01d055925bbe27e0487085109ee54a5a9ec3774009eee
3
+ size 500173202
videos/observation.images.wrist_left/chunk-000/file-001.mp4 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:719ada8325ee7277a84942649b3bb2fd77721adbc43730c61a8c0810777884dc
3
- size 523279020
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5b556ba1b6186c3d810538ba4a651df421a3b566abfb48931a2139968ce9c6ff
3
+ size 544261119
videos/observation.images.wrist_left/chunk-000/file-003.mp4 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:a86a32d55173d8140388c7afb2997131fe83d97032f6a0a4a95f6e80b47164a3
3
- size 495201568
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:47ec60063403353dcbc660291dcd238ea0f78eaeffcd87b83f04d356fc7b3cc4
3
+ size 515450480
videos/observation.images.wrist_left/chunk-000/file-033.mp4 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ee595317428ad0793b4323fc2ae3eaf13961f67f9eb19390c1d4139a7a299e87
3
- size 481159525
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ca81f7221477b443a1c339386d2a343d4c3c0cd3d980a287886bb628380dd64e
3
+ size 499609015
videos/observation.images.wrist_left/chunk-000/file-054.mp4 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:385bbdbfdf51dbd17fbebd53b56dbfb696f7a78dfd02760359a18a648237a24c
3
- size 517431576
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8952c0499728528278ebbedc40dcf0b5973f33ec5e2e8ef7a2fb11c46b0f41bd
3
+ size 537768302
videos/observation.images.wrist_left/chunk-000/file-094.mp4 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:366532907b8023d7eeae2a425bf08c2f94be481cf975d353ccaddd7ba042b60b
3
- size 479142040
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:da6f8c14b1176fb8ff360c82e97a75e854b727314c0d0400460bc09b388a3bd1
3
+ size 497644024
videos/observation.images.wrist_left/chunk-000/file-100.mp4 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:b07eb53280925704a642a7ef01fa736f66cee35b4113c194f9cc5bf306a051e0
3
- size 518580159
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c0698375e357b26ce41865be7b4d2c9c99ea3ae6f6b93595cb8b9afb29cf5971
3
+ size 539546368
videos/observation.images.wrist_left/chunk-000/file-106.mp4 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:a31081292e5ffe900e067ab4b3891a0c3c0335209b56ad3dabe51c0e1d3d4325
3
- size 501605293
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:11bf74e7c04a6869fdeaa73c5d92c0f3fddaff3734e742142dc67df06309d8cd
3
+ size 520774584
videos/observation.images.wrist_left/chunk-000/file-114.mp4 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d80630766ebe07a3c22179a5e95629c2c99a4418dea538bcb062aeacd0f4a883
3
- size 504551107
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f772b31bc4324375fc93b79119f882a51a18da569d37142f560849fea5d5e3aa
3
+ size 524820490
videos/observation.images.wrist_left/chunk-000/file-122.mp4 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:1affccaaae7946ae68f95a4d8ba8e37aac592ef5d96f463794c03bc436500a47
3
- size 505020279
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:448655ba7dfde3bb6ba5a7fb65c649fa4b7f0440de48bae67e6bcb27600de082
3
+ size 524716113
videos/observation.images.wrist_left/chunk-000/file-126.mp4 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:0b609a751e0d9c55dfa1bf3dc4760ecd7ff1c87e08faf829efd7a0cf645921a9
3
- size 520542826
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6a4829cc1608d7024d662cf6afe2db1f5f32f5a960890254f83e46b6b0c6bfbc
3
+ size 540522132
videos/observation.images.wrist_left/chunk-000/file-148.mp4 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:6e73be6506f02c8a6e1361705edb0796bcd4c1c093baf8e4480e21f16c123b7d
3
- size 497680234
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4d4c96cc54c1afcad8e75687de8c3189b63d30759a34aba3f0b99bdc00528bc8
3
+ size 517503965
videos/observation.images.wrist_left/chunk-000/file-161.mp4 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:dbd152935eb5de08b402d13446902fb5be5c317c4533c23486da3bdc94ad92b9
3
- size 505502458
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:87f57f5329c0a4dc45915a63ec02b2bfe08eab00e6600884dd22d37c882385d0
3
+ size 525777029
videos/observation.images.wrist_left/chunk-000/file-175.mp4 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:f674e3de44500b78d5afbd4337dec04f69905bde2f7a77201da8cde9b1016618
3
- size 511899902
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:adf15e26e037ad6f6df1ecceb0955711604e5c5d12baa5414774dacc0434dfce
3
+ size 532580200