Topic - mplayer differences with input file vs piped to stdin



Reply to this topic

Topic Starter cjh85331 - Posted on Friday, May 16 2008 05:41:31 PM
Using mplayer to take a media file (I'm experimenting with mpg right now) and splitting the streams into .yuv and .wav I've noticed differences in the results of output yuv files depending on whether I provide the input using an input file in the command list to mplayer, as opposed to using '-' and piping the input to mplayer's stdin.

What I do is recombine those with mencoder to produce an avi file that can be played by both mplayer and Windows media player.

It appears if I pipe the input file to stdin, on playback of the first and last frame has some data is missing in the video image. This occurs on both linux and windows versions. Strangely, the video files with this are slightly larger than the ones without the anomaly, so I'm wondering if this first incomplete frame is actually "extra" data that gets put in at the beginning.

An example of the first usage, which does not have the problem is:

mplayer -vo yuv4mpeg:file-simpsons1.yuv -ao pcm:file=simpsons1.wav -endpos 20 -cache 65536 simpsons.mpg

followed by:

mencoder simpsons1.yuv -ovc copy -oac copy -audiofile simpsons1.wav -o simpsons1.avi

The above operations result in a clean-playing avi.

HOWEVER, if I do the following:

ON LINUX
cat simpsons.mpg | mplayer -vo yuv4mpeg:file-simpsons1.yuv -ao pcm:file=simpsons1.wav -endpos 20 -cache 65536 -

OR ON PC
type simpsons.mpg | mplayer -vo yuv4mpeg:file-simpsons1.yuv -ao pcm:file=simpsons1.wav -endpos 20 -cache 65536 -

followed by:

mencoder simpsons1.yuv -ovc copy -oac copy -audiofile simpsons1.wav -o simpsons1.avi

I end up with a final avi that has about half the first frame and last frame blank on playback. Also, looking at the various files, I see that the intermediate .yuv video files have slightly different sizes (anomalous ones are bigger), whereas the .wav sound files are the same.

Is anyone aware of this, and does anyone have a workaround?

Also note that I get the same anomalous results if I run mplayer with popen() and then write the file data to the pipe, so I know all the media data is actually going into mplayer.

I really need to be able to use the piping to stdin method since the media data may be coming in on a socket or some other stream.

Thanks,
Carl
cjh85331 - Posted on Friday, May 16 2008 06:00:41 PM
ADDENDUM - I tried this on some file types other than mpg and did NOT see the problem. MOV files worked fine, mp4 files worked fine, wmv works fine.