Update inference_utils.py

Improves accuracy of frame rate. See https://github.com/PyAV-Org/PyAV/issues/580
pull/227/head
David Young 2 years ago committed by GitHub
parent 81a10937c7
commit 3d94959014
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -31,7 +31,7 @@ class VideoReader(Dataset):
class VideoWriter: class VideoWriter:
def __init__(self, path, frame_rate, bit_rate=1000000): def __init__(self, path, frame_rate, bit_rate=1000000):
self.container = av.open(path, mode='w') 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.pix_fmt = 'yuv420p'
self.stream.bit_rate = bit_rate self.stream.bit_rate = bit_rate

Loading…
Cancel
Save