@@ -590,7 +590,7 @@ def scan(self) -> Optional[DetectionResult]:
590590
591591 # Length of buffer we require in memory to keep track of all frames required for -l and -tb.
592592 buff_len = pre_event_len + min_event_len
593- event_end = FrameTimecode ( timecode = 0 , fps = self ._input .framerate )
593+ event_end = self ._input .position
594594 last_frame_above_threshold = 0
595595
596596 if self ._bounding_box :
@@ -847,14 +847,15 @@ def _draw_overlays(
847847 timecode : FrameTimecode ,
848848 frame_score : float ,
849849 bounding_box : Optional [Tuple [int , int , int , int ]],
850+ use_shift = True ,
850851 ):
851852 if not self ._timecode_overlay is None :
852853 self ._timecode_overlay .draw (frame , text = timecode .get_timecode ())
853854 if not self ._metrics_overlay is None :
854855 to_display = "Frame: %04d\n Score: %3.2f" % (timecode .get_frames (), frame_score )
855856 self ._metrics_overlay .draw (frame , text = to_display )
856857 if not self ._bounding_box is None and not bounding_box is None :
857- self ._bounding_box .draw (frame , bounding_box )
858+ self ._bounding_box .draw (frame , bounding_box , use_shift )
858859
859860 def _on_mask_event (self , event : MotionMaskEvent ):
860861 # Initialize the VideoWriter used for mask output.
@@ -863,7 +864,8 @@ def _on_mask_event(self, event: MotionMaskEvent):
863864 self ._mask_writer = self ._init_video_writer (self ._mask_file , resolution )
864865 # Write the motion mask to the output file.
865866 out_frame = cv2 .cvtColor (event .motion_mask , cv2 .COLOR_GRAY2BGR )
866- self ._draw_overlays (out_frame , event .timecode , event .score , event .bounding_box )
867+ self ._draw_overlays (
868+ out_frame , event .timecode , event .score , event .bounding_box , use_shift = False )
867869 self ._mask_writer .write (out_frame )
868870
869871 def _on_motion_event (self , event : MotionEvent ):
0 commit comments