I have the following script to convert a big bunch of .MOD and .XM files into Wave format:


for f in ./XM.* ./MOD.*
    xmp $f -d wav -o - | ffmpeg -i - -acodec libmp3lame -ab 320k "$f.mp3"

But it doesn't work as expected. The program just hang up. It creates the .wav file but nothing more.(Doesn't write in it) Even the -vvv switch doesn't give any information. The strange thing is: if I prepend "strace", it's working fine.

Any ideas/workarounds?

  • What if you lose the pipe and just write to a temp file and have ffmpeg encode that?
    – ckhan
    Nov 23, 2012 at 8:15
  • The problem is, that xmp doesn't respond if it's called in a shell script at all.
    – Noir
    Nov 23, 2012 at 8:56
  • Run the script with -x to display the actual commands on stderr (e.g. bash -x convert.sh or place set -x somewhere in the script before the call to xmp). Or just print the commands instead of executing them (you'll have to escape the | of course). Then try to run the printed commands directly and get back to us with the results.
    – peterph
    Nov 24, 2012 at 21:21

1 Answer 1


Perhaps xmp gets confused because stdin is not a tty? You could try:

xmp $f -d wav -o - </dev/null | ffmpeg -i - -acodec libmp3lame -ab 320k "$f.mp3"

Also, I would imagine that the order of arguments needs to be

xmp -d wav -o - "$f" </dev/null | ffmpeg -i - -acodec libmp3lame -ab 320k "$f.mp3"

On Ubuntu 14.04 with xmp 4.0.6 and avconv instead of ffmpeg, the order needs to be with the -d wav option later, or raw gets used

xmp -o - -d wav "$f" | avconv -i - -b 320k "$f.mp3"

You must log in to answer this question.

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