0

I was trying to stream mp3 music through gnuradio using vlc and mpg123 player. Following this site's example http://www.opendigitalradio.org/Simple_FM_transmitter_using_gnuradio

The commands are:

$ mkfifo stream_32k.fifo
$ mpg123 -r32000 -m -s  http://maxxima.mine.nu:8000 >stream_32k.fifo

Using my own mp3 stream, I followed the example, however there was one time I FORGOT to put

$ mkfifo stream_32k.fifo

to the terminal and instead only typed

$ mpg123 -r32000 -m -s  http://localhost:8080/mp3 >stream_32k.fifo

directly to the terminal. The result was a .fifo file that is not highlighted (like the one created with mkfifo)

When using it with gnuradio, the fifo file made with mkfifo could only be played once and its size would always return back to 0 bytes.

While the one I accidentally created without using mkfifo kept the bytes for a long time and i could access it anytime i wanted which proved more beneficial to me.

Is there a disadvantage in making fifos this way? Also can somebody please tell me what I actually did?

Thank you so much!

1 Answers1

0

You just created a regular file. As such it kept the bytes on the disk, where the real FIFO has nothing to do with permanent disk storage, it's essentially a buffer in memory which you give a "disk name" so that file oriented commands can work with it. The disadvantage is that when you're writing a permanent disk file you can not read from it at the same time (generally speaking, it depends how writing program actually writes, but you can not rely on it).

If you think that having .fifo in the file name makes it a FIFO then it's not right. mkfifo utility is what makes a filename attached to a FIFO.

If you want to keep the file and play the stream at the same time you can use an utility like tee:

mkfifo stream.fifo
mpg123 ...... | tee saved_stream.mp3 > stream.fifo

And then play from stream.fifo like you always do. Tee will 'capture' the bytes passing through it and save them to disk.

kikap
  • 832
  • 11
  • 14