zentara has asked for the wisdom of the Perl Monks concerning the following question:
That works without dropping any frames. But I want to be able to interrupt the STDIN feed, and I've tried things likemy $pid = open(MP, " | mplayer @options -v 3 - "); open (FH,"< z.mpg"); read( FH, my $buf, -s FH ); close FH; print MP $buf;
The problem is that it sends all the $data to mplayer almost immediately, so even if it is a long, say 1 minute video, and I set "$pause = 1" immediately after starting, the pause has no effect, and the entire video is played. Does anyone have a way of throttling this?open( FH, "< z.mpg" ); while ( sysread FH, my $data, 32678 ) { if($pause == 1){ goto ENDP } else{syswrite MP, $data;} } ENDP:
Or is there a way to sysread off of the slurped $buf a chunk at a time. I've been able to write to a variable as a filehandle, but am having trouble reading it like a filehandle.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: loop with throttle through an mpeg file
by simonm (Vicar) on Dec 23, 2004 at 17:40 UTC |