Tuesday, 14 January 2020

linux - ffmpeg command for concatenate two mp3 files


I am using ffmpeg for Concatenating two MP3 files together,


I use this command :


ffmpeg -y -i first.mp3 -i second.mp3 -filter_complex "[0:0][1:0] amix=inputs=2:duration=longest" -c:a libmp3lame output.mp3

It works, but there is a little problem, the overlay together!


I want first song plays, and when it finished, second file starts (in output file)


But now they starts at the same time.


How can i change that command, to have a output that contains first song then when the first finished, second plays ?


Plus, I've tried concat command but not worked, I just can use something like what i sent.



Answer



To skip re-encoding, use the concat demuxer:


Create a text file


file '/path/to/first.mp3'
file '/path/to/second.mp3'

and then


ffmpeg -f concat -i list.txt -c copy out.mp3



If re-encoding is fine,


ffmpeg -i first.mp3 -i second.mp3 -filter_complex [0:a][1:a]concat=n=2:v=0:a=1 out.mp3

No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...