How to transform the timestamps output by the model to seconds? #1184
Answered
by
LauraGPT
My-captain
asked this question in
Q&A
|
How to transform the timestamps output by the model to seconds? |
Answered by
LauraGPT
Jul 15, 2026
Replies: 2 comments
|
看了源码,请问是否÷1000就可以了? |
0 replies
|
Yes. For the standard FunASR For character/word timestamps: result = model.generate(input="audio.wav")
item = result[0]
timestamps_seconds = [
[start_ms / 1000.0, end_ms / 1000.0]
for start_ms, end_ms in item.get("timestamp", [])
]For VAD/speaker sentence segments: sentences_seconds = [
{
**segment,
"start": segment["start"] / 1000.0,
"end": segment["end"] / 1000.0,
}
for segment in item.get("sentence_info", [])
]For example, Current source references: |
0 replies
Answer selected by
LauraGPT
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes. For the standard FunASR
AutoModel.generate()result, timestamps are in milliseconds, so divide both boundaries by1000.0.For character/word timestamps:
For VAD/speaker sentence segments:
For example,
[1230, 2480]becomes[1.23, 2.48]seconds. Keep the original millisecond values if you need integer subtitle or alignment …