jianfch / stable-ts

Transcription, forced alignment, and audio indexing with OpenAI's Whisper
MIT License
1.59k stars 177 forks source link

How I get timestamp as paring audio file #328

Closed david-95 closed 7 months ago

david-95 commented 7 months ago

Thank you for your efforts to look into my issue.

I am trying to parse a wav file, to find clip to match my text. firstly I call transcribe to get WhisperResult then call result.segments to get all segments tranverse segments to get the segment which text match my text but the segment.start and segment.end I cannot understand, I want to find the start-end timestamps , so I can cut the wav by calling "ffmpeg -i src.wav -ss start_timestamp -to end_timestamp -c copy tar.wav" but failed, the rootcause is segment.star and segment.end is not the timestamp, Can you please tell me how to get a segment's timestamp pair?