Skip to content

Commit c6c5a5f

Browse files
bjuncekdatumbox
andauthored
Add warning for files with corrupt containers (#3961)
Co-authored-by: Vasilis Vryniotis <[email protected]>
1 parent 21426dd commit c6c5a5f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

torchvision/io/video.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,9 @@ def read_video_timestamps(filename: str, pts_unit: str = "pts") -> Tuple[List[in
391391
except av.AVError:
392392
warnings.warn(f"Failed decoding frames for file {filename}")
393393
video_fps = float(video_stream.average_rate)
394-
except av.AVError:
395-
# TODO add a warning
396-
pass
394+
except av.AVError as e:
395+
msg = f"Failed to open container for {filename}; Caught error: {e}"
396+
warnings.warn(msg, RuntimeWarning)
397397

398398
pts.sort()
399399

0 commit comments

Comments
 (0)