[MPlayer-users] Re: TV and pre7

D Richard Felker III dalias at aerifal.cx
Sat Sep 14 17:59:01 CEST 2002


On Sat, Sep 14, 2002 at 05:03:47PM +0200, Tülay Sözbir-Seidel wrote:
> [Automatic answer: RTFM (read DOCS, FAQ), also read DOCS/bugreports.html]
> 
> Hello,
> 
> Thanx to the help of Rene and Chris I managed to record and watch TV at the 
> same time by using the following script.
> 
> ---
> export FILENAME=/movies/js/tv`date +%Y%m%d%H%M`.avi
> mencoder -v -tv on:driver=v4l:width=448:height=336:forcechan=2:volume=45000 
> -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=900 -oac mp3lame -lameopts 
> cbr:br=96 -vop crop=432:320:8:2,pp -npp lb -o $FILENAME &
> tail --retry -f $FILENAME | mplayer -fs -vo xv -ao sdl -cache 2048 -
> killall -TERM mencoder
> ---
> 
> Unfortunately my machine (Athlon 750) is to slow for higher resolutions. If it 
> just records with no playback it manages a few pixel more. Anyhow thanx to 
> the mplayer developer I do not need to buy myself a VCR and now even got a 
> good reason to buy a faster CPU....
> 
> It takes about 7MB per minute HD-spaced. Because of the kill command mencoder 
> doesn't stop gracefully so it leaves the file without proper index. But I 
> don't have time to play around more with it now. I assume another signal will 
> do it better.

No need to export filename, you're just using it in the script. Try

FILENAME=...
mencoder ... &
PID=$!
tail ... | mplayer ...
kill -INT $PID

Of course fill in the ...'s with what you were already using. Note the
-INT instead of -TERM too. :)

Also, if you don't mind using more disk space and re-encoding later,
setting a very low keyframe intervale (e.g. 1 or 2), disabling motion
estimation, or just using a simpler codec like mjpeg will cut down on
the cpu usage a lot. Of course in any of these cases you'll need a
much higher bitrate.

Rich




More information about the MPlayer-users mailing list