There are many tools out there that allow you to merge files, but here I describe one of the easiest and fastest ways to do so.
=>Open your terminal and install mplayer2 and ffmpeg by typing:
sudo apt-get install mplayer2 ffmpeg
=>Open the file explorer (Nautilus) and browse to the folder in which the audio files are kept. Right click on it, and click Open in Terminal. For this tutorial, the dummy files are named 1.mp3,2.mp3 and 3.mp3.
=>Listen to the song and find out the starting position from where you want to cut it. Now type the following command:
mplayer -quiet <input file>.mp3 -ao pcm:fast:file=<output file>.wav -vc dummy -vo null -channels 2 -ss <starting time> -endpos <duration>

Replace <input file> with the original (input) file name, <output file> with the target (output) file name, <starting time> with the time from where you want to extract the sound and <duration> with the duration of target file from starting time. For instance, to cut 1.mp3 from 0:29 to 1:02 and store it in output1.wav, the starting time will be 0:29 and duration will be 0:33 seconds. So the command would be:
mplayer -quiet 1.mp3 -ao pcm:fast:file=output1.wav -vc dummy -vo null -channels 2 -ss 0:29 -endpos 0:33

=>Cut the other required files in a similar way. Then, merge the files by typing the following command:
ffmpeg -i output1.wav -i output2.wav -i output3.wav -filter_complex '[0:0][1:0][2:0]concat=n=3:v=0:a=1[out]' -map '[out]' output.wav


This command will merge output1.wav, output2.wav and output3.wav one after the other (in the same order) and save it in output.wav. If you want to merge, say 2 files, replace concat=n=3 with concat=n=2 and [0:0][1:0][2:0] with [0:0][1:0].
=>If you want to convert the output file from .wav to .mp3 format, just type:
avconv -i output.wav finalOutput.mp3
And that is it! If you have some queries or doubts, please tell us in the comments below! :)
No comments:
Post a Comment