[MPlayer-users] Re: Reading raw audio/video streams

D Richard Felker III dalias at aerifal.cx
Thu Aug 14 08:42:25 CEST 2003


On Wed, Aug 13, 2003 at 08:42:35PM -0500, Geoffrey Hausheer wrote:
> [Automatic answer: RTFM (read DOCS, FAQ), also read DOCS/bugreports.html]
> Richard Felker wrote:
> >> Does anyone have a suggestion as to how I can make this work without
> >> generating intermediate files (either using fifos or a muxed stream to
> >> stdout?).  I don't want to deal with the complexity of adding a
> >> container...that is what I'm using mencoder for in the first place.
> >
> >Uhh, why not just use -audiofile audout.fifo instead of a file?!?!
> 
> Well, the problem is that mencoder reads from -audiofile at a different
> rate than stdin.
> So if I have a program writing to two fifos, and mencoder reading from
> two fifos, and since fifos are always blocking, eventually mencoder ends
> up blocking on a read from one stream, while the writer ends up blocking
> on writing to the other stream, and everything deadlocks.  I was able to
> partially alleviate this problem using multiple threads and caches in my
> writing program, but eventually, I always run into the same problem.
> 
> So it appears that I either need mencoder to read from both streams at
> the same rate, or I need to find a way to mux/demux the raw data and send
> it on a single stream.

Easiest approach would be muxing raw video and pcm audio in a simple
container, perhaps avi. Otherwise you just need to be smart in your
program writing the data -- use select() to find out when you can
write to each fifo, and buffer data up when you can't write!

Rich



More information about the MPlayer-users mailing list