LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 01-15-2006, 12:10 PM   #1
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
cat, fifos, and mp3 streams


Hi all.

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)?

Cheers.

Dave
 
Old 01-15-2006, 01:16 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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 ;}).


Cheers,
Tink
 
Old 01-15-2006, 02:06 PM   #3
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Original Poster
Rep: Reputation: 97
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.
from mpg123 last time I tried this.

Dave
 
Old 01-15-2006, 06:11 PM   #4
JuddRogers
LQ Newbie
 
Registered: Nov 2004
Location: Austin, Texas
Distribution: Gentoo
Posts: 4

Rep: Reputation: 0
Lightbulb

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.
 
Old 01-16-2006, 11:49 AM   #5
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Original Poster
Rep: Reputation: 97
Hmmm.

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?

Dave
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
chat program using fifos and pipes questioner Programming 8 05-04-2006 08:20 AM
using FIFOS in C programs aru_04 Programming 2 05-13-2005 01:46 AM
Semaphore Library using Pipes / Fifos erdemilhan Programming 2 11-27-2004 04:18 PM
IPC (Message Queues vs. FIFOs vs. Unix-domain Sockets) TedMaul Programming 0 03-18-2004 04:53 AM
tv streams acid_kewpie Linux - Networking 0 09-05-2001 11:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration