Skip to content

Effort free video editing!

Export srtTime from src/lib/srttime.nim

WyattBlue3a668147cdf1
diff --git a/src/lib/srttime.nim b/src/lib/srttime.nim
new file mode 100644
index 00000000..72379a69
--- /dev/null
+++ b/src/lib/srttime.nim
@@ -0,0 +1,5 @@
+import std/strformat
+
+func srtTime*(ms: int64): string =
+ ## An SRT cue time, `HH:MM:SS,mmm`, for a nonnegative `ms`.
+ &"{ms div 3600000:02}:{(ms div 60000) mod 60:02}:{(ms div 1000) mod 60:02},{ms mod 1000:03}"
diff --git a/src/transcribe.nim b/src/transcribe.nim
index ad07a71b..0fd93443 100644
--- a/src/transcribe.nim
+++ b/src/transcribe.nim
@@ -1,6 +1,7 @@
import std/[os, json, strformat, strutils, typedthreads]
import ./[av, ffmpeg, log]
import ./util/lang
+import ./lib/srttime
type
WhisperCtx = pointer
@@ -221,9 +222,6 @@ type OutCtx = object
index: int
segStartMs: int64
-func srtTime(ms: int64): string =
- &"{ms div 3600000:02}:{(ms div 60000) mod 60:02}:{(ms div 1000) mod 60:02},{ms mod 1000:03}"
-
# Called by whisper_stream.c per text segment, on this (main) thread, so Nim GC
# and File writes are safe.
proc segCb(user: pointer, text: cstring, t0ms, t1ms: int64) {.cdecl.} =