Skip to content

Commit ecc64f0

Browse files
author
arch
committed
ffmpeg do not log queue overruns
1 parent fa4909d commit ecc64f0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

funscript_editor/data/ffmpegstream.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class FFmpegStream:
3434
start_frame (int): start frame number
3535
queue_size (int): size of frame buffer
3636
watchdog_timeout (int): watchdog timeout in seconds
37+
log_queue_overrun (bool): log queue overruns
3738
"""
3839

3940
def __init__(self,
@@ -42,18 +43,20 @@ def __init__(self,
4243
skip_frames :int = 0,
4344
start_frame :int = 0,
4445
queue_size :int = 256,
45-
watchdog_timeout :int = 4):
46+
watchdog_timeout :int = 4,
47+
log_queue_overrun :bool = False):
4648

4749
self.video_path = video_path
4850
self.config = config
51+
self.skip_frames = skip_frames
4952
self.start_frame = start_frame
5053
self.queue_size = queue_size
54+
self.log_queue_overrun = log_queue_overrun
5155

5256
self.stopped = False
5357
self.timeout = False
5458
self.current_frame = 0
5559
self.sleep_time = 0.001
56-
self.skip_frames = skip_frames
5760

5861
self.video_info = self.get_video_info(video_path)
5962
self.frame_buffer = Queue(maxsize=queue_size)
@@ -372,7 +375,8 @@ def run(self) -> None:
372375
time.sleep(self.sleep_time)
373376
wait_counter += 1
374377
if self.current_frame - (self.skip_frames + 1)*self.queue_size > 3 and wait_counter == 2500:
375-
self.logger.error("FFmpeg Frame Buffer overrun!!!")
378+
if self.log_queue_overrun:
379+
self.logger.error("FFmpeg Frame Buffer overrun!!!")
376380

377381
if 'zoom' in self.config.keys():
378382
frame = frame[

0 commit comments

Comments
 (0)