I want to loop an audio file infinitely. The -stream_loop -1 option adds a small pause / jerk between the loops, as also mentioned in this question with no solution. The same question mentions that filter loop works fine without delay. But I am unable to get the filter loop to work. The below code along with rest of the command:

 -filter_complex "[1:a]aloop=loop=-1"

gives a warning:

[Parsed_aloop_0 @ 0x55d83e516b80] Number of samples to loop is not set!

What is the correct way to loop an audio endlessly using filter loop? I am trying to merge a video and audio, having them both independently loop infinitely. I have got that part to work using -stream_loop -1 but it has a minor delay between loops as I mentioned. I am looking for a solution using either filter_complex or any other way if possible. Thanks!

Note, I have also noticed that ffplay -loop 0 plays the loop smoothly without adding this pause.

1 Answer 1


I found a workaround for this here! Using wav file as input instead of mp3 works.

Also in my trials, I found that even aac files suffer from this delay, somehow, wav files do not!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.