[FFmpeg-devel] [PATCH] Whisper audio filter

Vittorio Palmisano vpalmisano at gmail.com
Tue Jul 15 10:44:48 EEST 2025


> > + at item gpu_device
> > +The GPU device to use.
> > +Default value: @code{"0"}
>
> is this always a number ?
> if so the documenattion could say that

Yes, it is the device index.

> > + at item destination
> > +If set, the transcription output will be sent to the specified file or URL
> > +(use one of the FFmpeg AVIO protocols); otherwise, the output will be logged as
> > +info messages.
> > +The output will also be set in the "lavfi.whisper.text" frame metadata.
>
> teh documenattion should elaborate on what happens if the destination already
> exists

Ok

> > + if (!av_strcasecmp(wctx->format, "srt")) {
> > + buf =
> > + av_asprintf
> > + ("%d\n%02ld:%02ld:%02ld.%03ld --> %02ld:%02ld:%02ld.%03ld\n%s\n\n",
> > + wctx->index, start_t / 3600000,
> > + (start_t / 60000) % 60, (start_t / 1000) % 60,
> > + start_t % 1000, end_t / 3600000, (end_t / 60000) % 60,
> > + (end_t / 1000) % 60, end_t % 1000, text_cleaned);
> > + } else if (!av_strcasecmp(wctx->format, "json")) {
> > + buf = av_asprintf("{\"start\":%ld,\"end\":%ld,\"text\":\"%s\"}\n",
> > start_t, end_t, text_cleaned);
> > + } else
> > + buf = av_strdup(text_cleaned);
>
> Do you think it would make sense to use avcodec_encode_subtitle() ?
> It would avoid hardcoding these "writers" and could use any we support

avcodec_encode_subtitle should be used to generate a subtitle track, right?
I'm checking how it is used.

> also please make sure to attach the next attach in a way that doesnt corrupt it.
> (i used the forgejo pr to test and read most of this but i think my reply
>  is not very readable as i replied to the mail)

Ok I will use git send-email.
Feel free to comment on
https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/17/files too.
Thanks


More information about the ffmpeg-devel mailing list