What command-line tools do I need in order to concatenate several audio files and output them as one ogg (and/or mp3)?
If you can provide the complete command to concatenate and output to ogg, that would be awesome.
Edit: Input files (in my case, currently) are in wma
format, but ideally it should be flexible enough to support a wide range of popular formats.
Edit2: Just to clarify, I don't want to merge all wma
s in a certain directory, I just want to concatenate 2 or 3 files into one.
Thanks for the proposed solutions, but they all seem to require creating temporary files, if possible at all, I'd like to avoid that.
Best Answer
Here's my suggestion: Use mplayer and oggenc connected with a named pipe.
Use
mplayer
to decode the audio. It can play back a wide variety of audio (and video) formats, and it also can play multiple files.Use
oggenc
to encode the audio to Ogg Vorbis.To eliminate the need for a temporary file, use a named pipe to transfer the data between encoder and decoder.
Putting that into a script:
Explained:
-really-quiet -slave -nolirc
are there to disable messages and to make it not read the keyboard or the remote. Options-vc null -vo null
are there to disable video encoding and output. The-ao
option directs it to output the audio in WAV format to the named write pipe.Stuff to left to improve: Terminating the script early if one of the commands fails (use
set -e
), but still properly cleaning up the fifo (trap the necessary signals).