how do i divide/copy one stream into two streams through a named pipe???

how do i divide/copy one stream into two streams through a named pipe???

Post by Andreas Krin » Tue, 31 Dec 2002 06:43:13



hallo,

i want to run mplayer on two monitors, but only one app can read from
/dev/video at the same time. So i tried to read from /dev/video with a
named pipe:

mkfifo /stream
cat /dev/video > /stream

When i now start the first mplayer it reads it data fine, but when i
start the second mlpayer, every mplayer gets only half of the stream.
So my problem is how to copy/divide one stream into two streams under
bash (with named pipes for example, or are they two slow??)??
(I'm using Debian Woddy)

Much thanks for your attention and help

Andreas Krings

 
 
 

how do i divide/copy one stream into two streams through a named pipe???

Post by Farley Ben » Tue, 31 Dec 2002 09:01:43




Quote:> hallo,

> i want to run mplayer on two monitors, but only one app can read from
> /dev/video at the same time. So i tried to read from /dev/video with a
> named pipe:

> mkfifo /stream
> cat /dev/video > /stream

> When i now start the first mplayer it reads it data fine, but when i
> start the second mlpayer, every mplayer gets only half of the stream.
> So my problem is how to copy/divide one stream into two streams under
> bash (with named pipes for example, or are they two slow??)??
> (I'm using Debian Woddy)

> Much thanks for your attention and help

> Andreas Krings

You might take a look at tee.  It is normally used to write output to the
monitor and a file simultaneously, but might work for you here.

`tee': Redirect output to multiple files
========================================

   The `tee' command copies standard input to standard output and also
to any files given as arguments.  This is useful when you want not only
to send some data down a pipe, but also to save a copy.  Synopsis:

     tee [OPTION]... [FILE]...

   If a file being written to does not already exist, it is created.
If a file being written to already exists, the data it previously
contained is overwritten unless the `-a' option is used.

   The program accepts the following options.  Also see *Note Common
options::.

`-a'
`--append'
     Append standard input to the given files rather than overwriting
     them.

`-i'
`--ignore-interrupts'
     Ignore interrupt signals.

That's info tee above

Farley

--
        Life is the strangest thing I've ever done.

littlefoot8 (at) earthlink
(dot)net

 
 
 

how do i divide/copy one stream into two streams through a named pipe???

Post by Andreas Krin » Wed, 01 Jan 2003 09:54:24





> > hallo,

> > i want to run mplayer on two monitors, but only one app can read from
> > /dev/video at the same time. So i tried to read from /dev/video with a
> > named pipe:

> > mkfifo /stream
> > cat /dev/video > /stream

> > When i now start the first mplayer it reads it data fine, but when i
> > start the second mlpayer, every mplayer gets only half of the stream.
> > So my problem is how to copy/divide one stream into two streams under
> > bash (with named pipes for example, or are they two slow??)??
> > (I'm using Debian Woddy)

> > Much thanks for your attention and help

> > Andreas Krings

> You might take a look at tee.  It is normally used to write output to the
> monitor and a file simultaneously, but might work for you here.

> `tee': Redirect output to multiple files
> ========================================

>    The `tee' command copies standard input to standard output and also
> to any files given as arguments.  This is useful when you want not only
> to send some data down a pipe, but also to save a copy.  Synopsis:

>      tee [OPTION]... [FILE]...

>    If a file being written to does not already exist, it is created.
> If a file being written to already exists, the data it previously
> contained is overwritten unless the `-a' option is used.

>    The program accepts the following options.  Also see *Note Common
> options::.

> `-a'
> `--append'
>      Append standard input to the given files rather than overwriting
>      them.

> `-i'
> `--ignore-interrupts'
>      Ignore interrupt signals.

> That's info tee above

> Farley

Hallo Farley,

first i want to say thanks for helping!!
But the tool "tee" does not work for me! When i try

"mkfifo /stream1 /stream2"

and then

"tee /stream1 < /dev/video > /stream2"

or

"tee /stream1 /stream2 < /dev/video > /dev/null"

a got the problem that in the first case i can only read from stream1
after i tried to read from stream2 (with getting no data). Without
reading
from stream2 first i can try to read from stream1 as much as i like
but did
not get any data. For getting the data i have to read from stream2
first (without getting data), and then from stream1 to get the data.
Furthermore when i get data from stream1 i cannot get data from
stream2 (it was not possible to get data from stream2 at any time for
me, even if i first tried stream1 and then stream2 or something like
that).
In the second try i only got data when i first red from stream1
(without sucess) and then red from stream2. In no other case i got
data from any stream!!!!
So i think, tee is not able to stream data into two named pipes at one
time, is this possible??!? Or is this a bug in tee??

- And if this the case, is there another way or another tool that can
copy or divide a stream into two streams or are there any other
videoprograms which can output their picture on two monitors (from a
mpeg2-ts stream)??

Thanks much and a happy new year!!!

Andreas Krings

PS: tee --version is 2.0.11 and I'm using bash --version 2.05b.0

 
 
 

how do i divide/copy one stream into two streams through a named pipe???

Post by Farley Ben » Wed, 01 Jan 2003 14:53:57




[....]

Quote:> Hallo Farley,

> first i want to say thanks for helping!!
> But the tool "tee" does not work for me! When i try

> "mkfifo /stream1 /stream2"

> and then

> "tee /stream1 < /dev/video > /stream2"

> or

> "tee /stream1 /stream2 < /dev/video > /dev/null"

> a got the problem that in the first case i can only read from stream1
> after i tried to read from stream2 (with getting no data). Without
> reading
> from stream2 first i can try to read from stream1 as much as i like
> but did
> not get any data. For getting the data i have to read from stream2
> first (without getting data), and then from stream1 to get the data.
> Furthermore when i get data from stream1 i cannot get data from
> stream2 (it was not possible to get data from stream2 at any time for
> me, even if i first tried stream1 and then stream2 or something like
> that).
> In the second try i only got data when i first red from stream1
> (without sucess) and then red from stream2. In no other case i got
> data from any stream!!!!
> So i think, tee is not able to stream data into two named pipes at one
> time, is this possible??!? Or is this a bug in tee??

> - And if this the case, is there another way or another tool that can
> copy or divide a stream into two streams or are there any other
> videoprograms which can output their picture on two monitors (from a
> mpeg2-ts stream)??

> Thanks much and a happy new year!!!

> Andreas Krings

> PS: tee --version is 2.0.11 and I'm using bash --version 2.05b.0

Andreas-

        How about writing a script that makes a copy of the mpeg, and
invokes 2 instances of the application that plays them, directing the
output into two different streams, then erases the copy?

Just a thought.....

Farley

--
        Life is the strangest thing I've ever done.

littlefoot8 (at) earthlink
(dot)net

 
 
 

how do i divide/copy one stream into two streams through a named pipe???

Post by Andreas Krin » Sat, 04 Jan 2003 10:56:03





> [....]

> > Hallo Farley,

> > first i want to say thanks for helping!!
> > But the tool "tee" does not work for me! When i try

> > "mkfifo /stream1 /stream2"

> > and then

> > "tee /stream1 < /dev/video > /stream2"

> > or

> > "tee /stream1 /stream2 < /dev/video > /dev/null"

> > a got the problem that in the first case i can only read from stream1
> > after i tried to read from stream2 (with getting no data). Without
> > reading
> > from stream2 first i can try to read from stream1 as much as i like
> > but did
> > not get any data. For getting the data i have to read from stream2
> > first (without getting data), and then from stream1 to get the data.
> > Furthermore when i get data from stream1 i cannot get data from
> > stream2 (it was not possible to get data from stream2 at any time for
> > me, even if i first tried stream1 and then stream2 or something like
> > that).
> > In the second try i only got data when i first red from stream1
> > (without sucess) and then red from stream2. In no other case i got
> > data from any stream!!!!
> > So i think, tee is not able to stream data into two named pipes at one
> > time, is this possible??!? Or is this a bug in tee??

> > - And if this the case, is there another way or another tool that can
> > copy or divide a stream into two streams or are there any other
> > videoprograms which can output their picture on two monitors (from a
> > mpeg2-ts stream)??

> > Thanks much and a happy new year!!!

> > Andreas Krings

> > PS: tee --version is 2.0.11 and I'm using bash --version 2.05b.0

> Andreas-

>    How about writing a script that makes a copy of the mpeg, and
> invokes 2 instances of the application that plays them, directing the
> output into two different streams, then erases the copy?

> Just a thought.....

> Farley

Hey Farley,

thanks for your idea but the main problem is that this video is must
be realtime, so it is not possible to record the video first to the
HDD and play them after recording! ;-( So I'm looking for a way to
stream one mpeg2 video from a capture card onto two monitors (one in
fullscreen und one with a smaller resolution). My other thought and
try was at the beginning to use the vls (videostreamserver from
www.videolan.org) and then use the local loopback to stream the mpeg2
stream onto two monitors. But the vls server can only read mpeg2-ps
and mpeg2-ts streams, but the only realtime stream i get in is
mpeg2-es and mpeg2-pes stream and i did not find a tool to convert the
stream in realtime, too! ;-(

Hope you understand what i try to explain! ;-)

Still any other idea or tip or anythins which could be usefull?????

Much thanks again & much greetings

Andreas

 
 
 

how do i divide/copy one stream into two streams through a named pipe???

Post by Farley Ben » Sat, 04 Jan 2003 13:33:30




[....]

At this point, Andreas, all I can do is wish you luck. There must be a way
to do this. If I run across an idea that looks like it might work, I will
post it here.

Farley

--
        Life is the strangest thing I've ever done.

littlefoot8 (at) earthlink
(dot)net ---- Registered LFS User #7328

 
 
 

1. copy/divide (video)stream into two streams

hallo,

i want to run mplayer on two monitors, but only one app can read from
/dev/video at the same time. So i tried to read from /dev/video with a
named pipe:

mkfifo /stream
cat /dev/video > /stream

When i now start the first mplayer it reads it data fine, but when i
start the second mlpayer, every mplayer gets only half of the stream.
So my problem is how to copy/divide one stream into two streams under
bash (with named pipes for example, or are they two slow??)??
(I'm using Debian Woddy)

Much thanks for your attention and help

Andreas Krings

2. How to configure sound card

3. How to pass control data to other process thru stream pipes

4. Reading other langauge in Solaris

5. Creating named streams pipes on SVR4

6. Bridging confuses ipf?

7. Need help with a STREAMS named pipe.

8. Creating /dev/null

9. redirection of one stream to two files (eg: file and stdout)

10. Two "streams" from one serial device?

11. Full-duplex pipes (STREAMS pipes)

12. Two streams from one serial device?

13. pipes vs stream pipes