[MPlayer-users] is it possible to play and to dump stream simultaneously ?

Kevin DeKorte kdekorte at gmail.com
Sun Nov 30 19:44:20 CET 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nicolas George wrote:
> Le decadi 10 frimaire, an CCXVII, The Wanderer a écrit :
>> Some explicit way to say "output to stdout" would allow us to redirect
>> the normal output text to stderr rather than having to turn it off,
>> which could be helpful or at least nice...
> 
> It is already possible to do all this from the calling shell, provided the
> operating system supports the /dev/fd/X feature (and the standard output is
> not connected to a socket):
> 
> mplayer ... -dumpfile /dev/fd/3 ... 3>&1 1>&2
> 
> With this command, when mplayer is started, its fd 1 and 2 are connected to
> the calling process' standard error, and its fd 3 is connected to the
> calling process' standard output. Thus, the dump will go to the calling
> process' standard output while all messages will go to standard error.
> 
> It would be quite easy to implement such a hack inside of mplayer, with
> something like that:
> 
> static int real_stdout = -1;
> 
> int
> open_output_file(const char *filename)
> {
>     if(strcmp(filename, "-") == 0) {
> 	if(real_stdout < 0) {
> 	    real_stdout = dup(1);
> 	    dup2(2, 1);
> 	    return real_stdout;
> 	} else {
> 	    return dup(real_stdout);
> 	}
>     } else {
> 	return open(filename, O_WRONLY);
>     }
> }
> 
> (add error checks, of course)
> 
> The advantage of this method is that it is resistant even to crappy external
> libraries that can not be prevented from writing to standard output.
> 
> Regards,


Also, depending on the site you can use...

wget [url] &
sleep 5   // this is needed to build up a little cache so that mplayer
does not run off the end

mplayer -nocache [filename wget is saving to]

You want to use -nocache so that mplayer does not cache the EOF marker.


If it is an mms or rtsp site you'll have to use the dump stream method.

If you are playing a http url off of a web site, mplayerplug-in and
gecko-mediaplayer both support saving of the downloaded content.

Kevin



- --
Get my public GnuPG key from
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x7D0BD5D1
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkky3wQACgkQ6w2kMH0L1dGgggCfXtSYbvHWApC4d05FT/+hfmtP
weoAnAlaUUQypDzFZ1Hd5p8k+KX2i+eE
=FRTL
-----END PGP SIGNATURE-----



More information about the MPlayer-users mailing list