Watching and Simultaneously Saving Video in mplayer - is it possible?
This is a question I've posed in the Ubuntu forums, but I haven't found the answer yet.
I've got a great little IP security camera - the Y-Cam. It's Internet accessible, so it can email me photos of any suspicious behaviour. It will also stream video and audio to a number of devices - including mobiles.
Under Linux, it's very easy to get the video and audio via mplayer.
mplayer http://username:[email protected]/stream.asf
And we get this rather spiffy video playing.

In fact, there are a number of streams available (depending on camera), including RTSP and 3GP. The ASF stream seems the most Linux friendly.
It's also possible to save the video to a file - so if you catch a miscreant in the act of pilfering, you have video and audio evidence.
mplayer http://user:[email protected]/stream.asf -dumpstream -dumpfile ycam.asf
You now have a file which can be played back.
What I can't seem to work out is how to do the two together. I want a command which will show me the video and at the same time save it to disk.
So, fearless Internet commentors - any helpful suggestions?
Terence, you can use a pipe to redirect output from mplayer and capture it into a file, while it is playing on screen.
For example:
First, you must create a pipe:
mkfifo ./videoPipeThen, you must execute a process to read stream from this pipe, and play it. Don't forgot '&' for working on background:
cat ./videoPipe | tee -a -i video.asf | mplayer - &'tee' command, save the stream into a file, and send it to 'mplayer'.
And finally, you must send data to pipe:
mplayer http://user:[email protected]/stream.asf-dumpstream -dumpfile ./videoPipe
this comment is for subscribing via e-mail :-)
what about:
mplayer http://user:[email protected]/stream.asf -dumpstream -dumpfile ./mystream.asf
and in another terminal:
mplayer - < ./mystream.asf