0

I have a folder filled with songs. I would like to make ONE mp3 file containing a mashup of 10 seconds of each song.

I have found that FFMPEG is an easy software to do so.

I found how to cut a single file : ffmpeg -ss 0 -t 10 -i file.mp3 file.wav

And how to write a loop for multiple steps : for i in *.mp3; do ...

But I am not sure how to mix the two into only 1 file. If it's not possible, I guess I can also make a separate 10 sec file for each and then regroup.

Maude
  • 512
  • 3
  • 8
  • 23
  • I think your suggestion at the end is easy and straightforward. 1. Create the 10 seconds clips for each file 2. Join them. – Yeikel Dec 25 '18 at 23:54

2 Answers2

0

In Windows

Step 1 : Go into the folder with the songs

Step 2 : Paste the following line

FOR /F "tokens=*" %G IN ('dir /b *.mp3') DO ffmpeg -ss 15 -t 10 -i "%G" -acodec mp3 "%~nG_10s.mp3"

Step 3 : Put the 10s songs into another folder (or modify the regex) and paste

copy /b *.mp3 E:\combined.mp3
Maude
  • 512
  • 3
  • 8
  • 23
0

You can avoid the intermediate files by using ffmpeg's concat demuxer

#1 Create the concat text file

FOR /F "tokens=*" %G IN ('dir /b *.mp3') DO (echo file '%G' >> list.txt & echo inpoint X >> list.txt & echo outpoint Y >> list.txt)

X and Y are the start and end times, in seconds.

#2 Combine the selected portions

ffmpeg -f concat -i list.txt -c copy -vn out.mp3
Gyan
  • 85,394
  • 9
  • 169
  • 201