Skip to content

Commit

Permalink
Fixed frame number generation in _gen_frames by using round to roun…
Browse files Browse the repository at this point in the history
…d to nearest rather than `int` to round down.
  • Loading branch information
Britefury committed Mar 10, 2021
1 parent df3d7d8 commit 615e833
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pims/pyav_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _gen_frames(demuxer, time_base, frame_rate=1., first_pts=0):
"Unable to read video: frames contain no timestamps. "
"Please use PyAVReaderIndexed.")
t = (timestamp - first_pts) * time_base
i = int(t * frame_rate)
i = int(round(t * frame_rate))
yield WrapPyAvFrame(frame, frame_no=i,
metadata=dict(timestamp=timestamp, t=float(t)))

Expand Down

0 comments on commit 615e833

Please sign in to comment.