Skip to content

Commit 72af0f5

Browse files
main : add csv header (#552)
1 parent af005d5 commit 72af0f5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

examples/main/main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,14 @@ bool output_csv(struct whisper_context * ctx, const char * fname) {
352352
fprintf(stderr, "%s: saving output to '%s'\n", __func__, fname);
353353

354354
const int n_segments = whisper_full_n_segments(ctx);
355+
fout << "start,end,text\n";
355356
for (int i = 0; i < n_segments; ++i) {
356357
const char * text = whisper_full_get_segment_text(ctx, i);
357358
const int64_t t0 = whisper_full_get_segment_t0(ctx, i);
358359
const int64_t t1 = whisper_full_get_segment_t1(ctx, i);
359360

360361
//need to multiply times returned from whisper_full_get_segment_t{0,1}() by 10 to get milliseconds.
361-
fout << 10 * t0 << ", " << 10 * t1 << ", \"" << text << "\"\n";
362+
fout << 10 * t0 << "," << 10 * t1 << ",\"" << text << "\"\n";
362363
}
363364

364365
return true;

0 commit comments

Comments
 (0)