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

Geoffrey Hausheer b3zknt8xu02 at sneakemail.com
Fri Aug 15 15:07:36 CEST 2003


On Wed, 13 Aug 2003 20:42:35 -0500, "Geoffrey Hausheer"
<XXXXXXXXXXXXXXXXXXXXX> said:
> 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.

I'll follow up and say that this isn't really mencoder's fault.  I was
able to get around this problem entirely using threaded writers which can
dynamically allocate buffers to prevent starvation (and thus deadlock). 
The probalem was further compounded by using the wrong 'fps' in my tests,
which lead to a difference in the rate of audio vs video reading by
mencoder.

All is well now, and mencoder seems to do quite well reading from two
fifos.

The only issue I have is that I get this at the beginningof every
encoding:

Pos:   0.7s     22f ( 0%)   0fps Trem:   0min   0mb  A-V:0.067 [0:114]
Skipping frame!
Pos: 314.6s   9431f ( 0%)  34fps Trem:   0min   0mb  A-V:0.054 [807:109]]

Not sure how it is possible to skip a frame when data is sent on blocking
fifos.  And it only happens once.

Thanks,
.Geoff



More information about the MPlayer-users mailing list