Skip to content

How to get sentence-level timestamps? #54

Description

@Disonantemus

parakeet output is word-level timestamped, but is friendly/traditional to make a subtitle for a video/audio transcription. Is possible to get sentence-level output? There is a local tool that can do it?

I was able to get word-level transcription with:

parakeet-cli transcribe --model tdt-0.6b-v3-q4_k.gguf --input in.wav --json > out.json

And with this shell script I was able to convert to WebVTT subtitle:

#!/bin/sh
jq -r '
  def format_time:
    . as $s |
    ($s / 3600 | floor) as $h |
    (($s % 3600) / 60 | floor) as $m |
    ($s % 60 | floor) as $sec |
    ($s * 1000 | floor % 1000) as $ms |
    "\(if $h < 10 then "0" else "" end)\($h):\(if $m < 10 then "0" else "" end)\($m):\(if $sec < 10 then "0" else "" end)\($sec).\(if $ms < 10 then "00" elif $ms < 100 then "0" else "" end)\($ms)";

  "WEBVTT\n\n" + ([.words[] | "\(.start | format_time) --> \(.end | format_time)\n\(.w)"] | join("\n\n")) + "\n"
' "$1"
  • The output is one word per subtitle line, that is not very friendly to create a subtitle for a video or audio recording.
  • Do you know a way to convert the transcription in a more traditional (sentence-level timestamps) subtitle?

Workaround

Using Word Timestamp to Subtitles online tool, I was able to get an expected formatted subtitle from JSON output (from parakeet), but I'm searching a local/offline tool, because privacy.

This should work but give me errors, and I'm not a programmer to fix that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions