English 中文(简体)
Perl系统电动器,视像之间的转变各不相同。
原标题:Perl system call mplayer, transition between videos varies

我只剩下几周时间,我正试图将以下守则付诸实施:

sub runVideo {
    system( mplayer -fs video1.mpeg2 video2.mpeg2 );
    return;
}

runVideo();
system( some other processes in background& );
runVideo();

基本上,我两次播放录像1和录像2,第一次是录像,第二次在背景中播放一些应用,因此,我用完全屏幕的方式播放录像。

<<>Problem>:

On the first run, the transition from video1 to video2 takes about 1-2 seconds. While on the second run, the transition from video1 to video2 takes less than a second.

< Question:

www.un.org/Depts/DGACM/index_spanish.htm 为什么过渡期有所不同? 这部录像是否仍然记忆中,因此装上该录像的时间要缩短?

www.un.org/Depts/DGACM/index_spanish.htm 什么其他替代办法或工作方式可以同时过渡?

问题回答

答案可能产生效果。 无论是录像还是需要使用的密码,都是录像2的记忆。 当然,这是你第二次这样做的。

你可以尝试的两件事——取决于拖延的确切原因:

  • You can try the -fixed-vo option to mplayer (if you re using mplayer 1.x; its default in 2.x I believe). This will prevent the jarring vo deinit/reinit cycle.
  • You can (and probably should) run mplayer in -slave mode (also probably with -idle). This will give you much more control over it.
  • You can pre-cache whatever data is taking a while. The way to do this on Unix-like systems is posix_fadvise(int fd, off_t offset, off_t len, int advice) with an advice of POSIX_FADV_WILLNEED. Alternatively, on Linux, readahead(int fd, off64_t offset, size_t count). Or finally, by a mmap on the file, followed by madvise(void *addr, size_t length, int advice) with advice of MADV_WILLNEED. Unfortunately, none of posix_fadvise, readahead, and madvise are exported by the POSIX module. So you ll have to find another module (check CPAN) or resort to Inline or XS. Or open/sysread (less efficient).
  • You can combine your videos together. That should completely eliminate transition time.




相关问题
Why does my chdir to a filehandle not work in Perl?

When I try a "chdir" with a filehandle as argument, "chdir" returns 0 and a pwd returns still the same directory. Should that be so? I tried this, because in the documentation to chdir I found: "...

How do I use GetOptions to get the default argument?

I ve read the doc for GetOptions but I can t seem to find what I need... (maybe I am blind) What I want to do is to parse command line like this myperlscript.pl -mode [sth] [inputfile] I can use ...

Object-Oriented Perl constructor syntax and named parameters

I m a little confused about what is going on in Perl constructors. I found these two examples perldoc perlbot. package Foo; #In Perl, the constructor is just a subroutine called new. sub new { #I ...

Where can I find object-oriented Perl tutorials? [closed]

A Google search yields a number of results - but which ones are the best? The Perl site appears to contain two - perlboot and perltoot. I m reading these now, but what else is out there? Note: I ve ...

热门标签