Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Here's the setup:
I'm attempting to create a low-tech streaming server, using only mplayer, ssh and a few standard Unix tools.
I have mplayer (running on host home1) dumping an mp3 stream from a shoutcast server into a fifo called stream.dump.
I can then use 'ssh user@home1 "cat stream.dump" > mpg123' to listen to the stream on a different machine (work1). This works just fine.
If I try to run 'ssh user@home1 "cat stream.dump" > mpg123' on another machine (work2), the stream to work1 gets interrupted (sometimes this causes mpg123 on work1 to stop, sometimes it just causes a blip in sound).
I would like to know why the stream is interrupted at all. I was under the impression that cat'ing twice from a file (in this case a fifo) should work fine.
Any ideas? Any suggestions for other ways to do this (only using mplayer, ssh and the usual Unix setup)?
Could depend on varied things, e.g. the CPU load on the
streaming machine. ssh (specially when used with compression)
can start off with a nasty CPU spike, particularly if the CPU
isn't very grunty ;}).
The machine is idle (as in load avg 0.01), and the same thing happens with 'CompressionLevel 9' and with 'Compression no'.
It's an Athlon 2500...
The sound blip also happens if I cat from the stream.dump fifo on the local (home1) machine, so it's definitely just the act of cat'ing which is causing the problem.
I got
Code:
Illegal Audio-MPEG-Header 0x4c353740 at offset 0xfffffffb.
Skipped 272 bytes in input.
Illegal Audio-MPEG-Header 0x91977aec at offset 0xfffffffb.
Skipped 272 bytes in input.
mpg123: Can't rewind stream by 37 bits!
Illegal Audio-MPEG-Header 0x657a355c at offset 0xfffffffb.
Skipped 272 bytes in input.
Illegal Audio-MPEG-Header 0x89844381 at offset 0xfffffffb.
Skipped 292 bytes in input.
Illegal Audio-MPEG-Header 0x520f3500 at offset 0xfffffffb.
Skipped 104 bytes in input.
In summary:
You have one process dumping to a fifo, start another
process reading that fifo, all is good. You add a third process reading the same fifo and get mp3 errors.
I suspect the problem is the third process does not get to read the first few blocks from the fifo and so the MP3 data stream is a bit off.
To test, start the two readers first so they block waiting for data, then start the writer. If both are happy, then this is most likely your issue.
It seems cat'ing the same FIFO to two audio players causes corruption for both streams (I'm doing this locally on my home machine now). I think that plan will have to go out the window.
Anyone got any ideas? Is it possible to have two instances of netcat (nc) listening to the same IP port for some loopback network streaming?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.