0

I’ve got 3 opus audio files and I need to merge them into 1 opus audio file in the following order and length:

  • File1.opus is 1 second long
  • 1 second silent gap
  • File2.opus is 2 seconds long
  • 1/2 second silent gap
  • File3.opus is 1 second long
  • 1/2 second silent gap

How would I do this using ffmpeg?

enter image description here

Many thanks

1 Answer 1

1

Given you already have File1.opus, File2.opus and File3.opus you can use this ffmpeg command to achieve this task. To merge the three Opus audio files with the specified gaps, you'll need to use the filter function to insert silence and the concat demuxer to concatenate the audio files. Here's the command you can use:

ffmpeg -i File1.opus -f lavfi -t 1 -i anullsrc=r=48000:cl=stereo -i File2.opus -f lavfi -t 0.5 -i anullsrc=r=48000:cl=stereo -i File3.opus -f lavfi -t 0.5 -i anullsrc=r=48000:cl=stereo -filter_complex "[0:a][1:a][2:a][3:a][4:a][5:a]concat=n=6:v=0:a=1[a]" -map "[a]" output.opus
  • -f lavfi -t 1 -i anullsrc=r=48000:cl=stereo – generates a 1-second silent audio segment
  • -filter_complex "[0:a][1:a][2:a][3:a][4:a][5:a]concat=n=6:v=0:a=1[a]" – complex filter chain to concatenate the audio streams while taking care of the specified gaps
  • -map "[a]" – maps the concatenated audio stream to the output
  • output.opus – output filename

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .