Skip to content

Commit

Permalink
Update inference_utils.py
Browse files Browse the repository at this point in the history
Improves accuracy of frame rate. See PyAV-Org/PyAV#580
  • Loading branch information
dcyoung authored Mar 10, 2023
1 parent 81a1093 commit 3d94959
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions inference_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __getitem__(self, idx):
class VideoWriter:
def __init__(self, path, frame_rate, bit_rate=1000000):
self.container = av.open(path, mode='w')
self.stream = self.container.add_stream('h264', rate=round(frame_rate))
self.stream = self.container.add_stream('h264', rate=f'{frame_rate:.4f}')
self.stream.pix_fmt = 'yuv420p'
self.stream.bit_rate = bit_rate

Expand Down Expand Up @@ -85,4 +85,4 @@ def write(self, frames):

def close(self):
pass


0 comments on commit 3d94959

Please sign in to comment.