Skip to content

Commit

Permalink
fix:The timestamps for the second and subsequent segments are incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
caiwuu committed Aug 29, 2024
1 parent d57c5b4 commit 3c9e49e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions faster_whisper/transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -2085,9 +2085,11 @@ def restore_speech_timestamps(
)

else:
middle = (segment.start + segment.end) / 2
chunk_index = ts_map.get_chunk_index(middle)
segment = segment._replace(
start=ts_map.get_original_time(segment.start),
end=ts_map.get_original_time(segment.end),
start=ts_map.get_original_time(segment.start, chunk_index),
end=ts_map.get_original_time(segment.end, chunk_index),
)

yield segment
Expand Down

0 comments on commit 3c9e49e

Please sign in to comment.