Skip to content

Commit bd03cc3

Browse files
authored
Update video.py (#185)
Fix for `AttributeError: 'av.video.frame.VideoFrame' object has no attribute 'index'` error {frame.index} only exist in packet and container streams and not in decoded frames. Implemented manual counter.
1 parent 56551e1 commit bd03cc3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/video.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ def main():
3535

3636
clip = av.open(video_path)
3737

38-
for frame in clip.decode(video=0):
39-
print(f'{frame.index} ------')
38+
for i, frame in enumerate(clip.decode(video=0)):
39+
print(f'{i} ------')
4040

4141
img = frame.to_image()
4242
if img.width != device.width or img.height != device.height:

0 commit comments

Comments
 (0)