@@ -28,6 +28,7 @@ std::string to_timestamp(int64_t t) {
28
28
struct whisper_params {
29
29
int32_t seed = -1 ; // RNG seed, not used currently
30
30
int32_t n_threads = std::min(4 , (int32_t ) std::thread::hardware_concurrency());
31
+ int32_t offset_ms = 0 ;
31
32
32
33
bool verbose = false ;
33
34
bool translate = false ;
@@ -55,6 +56,8 @@ bool whisper_params_parse(int argc, char ** argv, whisper_params & params) {
55
56
params.seed = std::stoi (argv[++i]);
56
57
} else if (arg == " -t" || arg == " --threads" ) {
57
58
params.n_threads = std::stoi (argv[++i]);
59
+ } else if (arg == " -o" || arg == " --offset" ) {
60
+ params.offset_ms = std::stoi (argv[++i]);
58
61
} else if (arg == " -v" || arg == " --verbose" ) {
59
62
params.verbose = true ;
60
63
} else if (arg == " --translate" ) {
@@ -95,6 +98,7 @@ void whisper_print_usage(int argc, char ** argv, const whisper_params & params)
95
98
fprintf (stderr, " -h, --help show this help message and exit\n " );
96
99
fprintf (stderr, " -s SEED, --seed SEED RNG seed (default: -1)\n " );
97
100
fprintf (stderr, " -t N, --threads N number of threads to use during computation (default: %d)\n " , params.n_threads );
101
+ fprintf (stderr, " -o N, --offset N offset in milliseconds (default: %d)\n " , params.offset_ms );
98
102
fprintf (stderr, " -v, --verbose verbose output\n " );
99
103
fprintf (stderr, " --translate translate from source language to english\n " );
100
104
fprintf (stderr, " -ps, --print_special print special tokens\n " );
@@ -203,6 +207,7 @@ int main(int argc, char ** argv) {
203
207
wparams.translate = params.translate ;
204
208
wparams.language = params.language .c_str ();
205
209
wparams.n_threads = params.n_threads ;
210
+ wparams.offset_ms = params.offset_ms ;
206
211
207
212
if (whisper_full (ctx, wparams, pcmf32.data (), pcmf32.size ()) != 0 ) {
208
213
fprintf (stderr, " %s: failed to process audio\n " , argv[0 ]);
0 commit comments