[Libav-user] How to modify the start time of an audio stream?

Gustav González xtingray at gmail.com
Sun Apr 24 19:47:18 EEST 2022

The best way to modify the start time of any audio stream using the Libav
API is by implementing a "adelay" filter. Here is a little piece of code
showing how to use it:

AVFilterContext *adelay_ctx;
const AVFilter  *adelay;
char args[512]; // This variable contains the filter parameters
int error;

adelay = avfilter_get_by_name("adelay");
if (!adelay) {
    av_log(NULL, AV_LOG_ERROR, "Could not find the adelay filter.\n");

int delay_time = 8000; // delay in milliseconds
snprintf(args, sizeof(args), "delays=%d:all=1", delay_time);
error = avfilter_graph_create_filter(&adelay_ctx, adelay, "adelay", args,
                                     NULL, filter_graph);
if (error < 0) {
    av_log(NULL, AV_LOG_ERROR, "Cannot create audio adelay filter\n");
    return error;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20220424/99a1f83b/attachment.htm>

More information about the Libav-user mailing list