[MPlayer-dev-eng] mplayer and mjpegtools

Emmanuel Anne emanne at absysteme.fr
Thu Apr 11 16:03:49 CEST 2002


Thanks a lot for adding yuv4mpeg support to mplayer, but to be really
usefull, this feature requires the stream to be sent to stdout instead
of the file stream.yuv (did you ever try to write a full 1h30 movie at
25fps in an yuv file ??? Don't try it !!!).

If you want to do it, it's quite easy.
Take this stdout2stderr.pl perl script :
#!/usr/bin/perl

my $nb = 0;
while (<>) {
  $nb++ if (s/([ \t])printf ?\(/$1fprintf\(stderr,/);
  $nb++ if (s/^printf ?\(/fprintf\(stderr,/);
  print;
}
print STDERR "$nb replacements\n";

Then go into the mplayer directory and run it with :
for n in `find -name \*.c`; do
  perl ../stdout2stderr.pl $n > tmp
  mv -f tmp $n
done

It will replace all the printf( in the sources by fprintf(stderr,
Then you will need to add "#include <stdio.h>" to 2 files to be able to
compile them (forgot which files, sorry !), and finally you need to
patch vo_yuv4mpeg.c file :
just replace the line
yuv_out = fopen("stream.yuv", "wb");
by
yuv_out = stdout;

You can then run mplayer this way (for example) :
mplayer -vo yuv4mpeg -benchmark -nosound movie.avi | mpeg2enc -a 2 -f 4
-F 1 -S 650 -B 128 -s -o video.m2v

(this will encode an mpeg2 svcd).

The speed impvement compared to the divxdec from mjpegtools is not huge,
but mplayer allows to decode many formats that mjpegtools can't deal
with !

Thanks a lot for your awesome work !




More information about the MPlayer-dev-eng mailing list