[MEncoder-users] Problem encoding raw video output of mencoder

R.L. Horn lists at eastcheap.org
Mon May 19 20:03:07 CEST 2008


On Mon, 19 May 2008, Bram wrote:

> With this patch applied to the latest svn revision (26838), I tried to
> transcode video using pipes. This results in a transcoded video stream,
> but the horizontal alignment of the result is wrong:

> # start consumer of video pipe first
> mencoder /tmp/videopipe -o "$OUT" -ofps 25 -noaspect -demuxer rawvideo 
> -rawvideo fps=25:w=${WIDTH}:h=${HEIGHT}:format=i420 -nosound -ovc xvid 
> -xvidencopts bitrate=800 &
>
> # demux video stream to named pipe
> mencoder -quiet -of rawvideo -ovc raw -rawvidopts pipe=6 -ofps 25 -vf 
> harddup,format=i420 -nosound "$IN" -o NUL 6>/tmp/videopipe
>
> wait # waits for encoder background job to complete

The only thing that stood out when I glanced through the patch is that 
you're not checking the results of write() calls.  Since the I/O 
primitives are interruptable, this can lead to incomplete writes.

If, in fact, that is the problem, the simplest solution is to get a FILE * 
with fdopen() and use fwrite() instead.  Otherwise, you have to put the 
write() in a loop and keep going until your entire buffer is written 
(don't forget to check for EINTR).

But why patch mencoder to accomplish the above anyway?  It's perfectly 
capable of writing to a named pipe using "-o" unless something has changed 
since SVN 26759.



More information about the MEncoder-users mailing list