I want to Merge two mp3 files with a silence in between two mp3 files. I can now merge Songs with my code, but i need to add silence of 'x' seconds between songs. and the 'x' needed to be a value user can change.. So the only thing i needed is a code to Create a silence mp3 file that have a duration of 'x' seconds ...
Asked
Active
Viewed 2,896 times
2 Answers
5
You can use the FFmpeg anullsrc source filter:
ffmpeg -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 -t 5 out.mp3
The -t
option defines the duration. This example will make a 5 second output.

llogan
- 121,796
- 28
- 232
- 243
2
To merge in between, basic syntax is
ffmpeg -i first.mp3 -i second.mp3 -f lavfi -i aevalsrc=0:d=x \
-filter_complex "[0][2][1]concat=n=3:v=0:a=1" merged.mp3
where x
should be replaced with the duration of the silence (in seconds).

Gyan
- 85,394
- 9
- 169
- 201