[MPlayer-users] How do you play multiple audio files as a continuous stream?

Richard Bromley rbromley256 at gmail.com
Wed Jul 26 19:49:51 CEST 2006


On 7/25/06, Corey Hickey <bugfood-ml at fatooh.org> wrote:
> soxmix mixes the two files, which means you'll hear them both at once.
> What you want to do is concatenate them, which regular sox does.
>
> $ sox 1.mp3 2.mp3 - | mplayer -
>
> That still won't work, though, so don't expect the above command to
> work. sox silently errors out with an exit status 2, which isn't very
> helpful. The problem is, sox determines the output format based on the
> output filename you provide. If the filename is -, sox doesn't know if
> you want wav, ogg, or what. You can manually specify the format and make
> sox happy.
>
> $ sox 1.mp3 2.mp3 -t wav - | mplayer -
>
> ...however, now mplayer isn't happy. It wants to seek when opening the
> file, but can't do that when reading from stdin, so the above command
> will fail too. There might be some way to make that work, but it's
> probably not worth it, since you still won't be able to seek when you
> want to. As long as you have the disk space, just write a temporary file:
>
> $ sox 1.mp3 2.mp3 out.wav ; mplayer out.wav ; rm out.wav
>
> Now, I've been assuming this whole time that you're going to be joining
> files with the same sample rate and format. If they were all made as
> part of a matching set, then that is almost certainly the case, but if
> they aren't then sox will get mad. Working around that is kind of a
> headache, so unless anybody needs me to explain, I'd just as soon leave
> that issue alone.
>
> -Corey
> _______________________________________________
> MPlayer-users mailing list
> MPlayer-users at mplayerhq.hu
> http://lists.mplayerhq.hu/mailman/listinfo/mplayer-users

Thanks very much for your solution. Actually, using the method of
piping sox's output to mplayer worked fine for me, aside from one
warning printed by sox. Of course, since MPlayer reads the audio from
stdin, no keystrokes are recognized, but that's not a problem when I
just want to listen to the stream from beginning to end.

The temporary file solution I could perhaps implement as a shell script.

Thanks again for your help.



More information about the MPlayer-users mailing list