MovieStim ===================================== .. code-block:: python class psychopy.visual.MovieStim(win, filename='', units='pix', size=None, pos=(0.0, 0.0), ori=0.0, flipVert=False, flipHoriz=False, color=(1.0, 1.0, 1.0), colorSpace='rgb', opacity=1.0, volume=1.0, name=None, loop=False, autoLog=None, depth=0.0) PsychoPyで動画を再生するクラスである(訳注:現在はlibVLCをバックエンドとするMoveStim2またはffmpegをバックエンドとするMovieStim3の利用が推奨されている)。 以下に例を示す。 .. code-block:: python mov = visual.MovieStim(myWin, 'testMovie.mp4', flipVert=False) # 動画の再生時間を表示 print(mov.duration) # 動画のオリジナルの大きさをpix単位で表示 print(mov.format.width, mov.format.height) mov.draw() # 現在のフレームを描画 デモのMovieStim.pyを参照のこと。 .. A stimulus class for playing movies (mpeg, avi, etc...) in PsychoPy. .. Example: .. mov = visual.MovieStim(myWin, 'testMovie.mp4', flipVert=False) .. print(mov.duration) .. # give the original size of the movie in pixels: .. print(mov.format.width, mov.format.height) .. mov.draw() # draw the current frame (automagically determined) .. See MovieStim.py for demo. パラメータを以下に示す。 .. filename : .. a string giving the relative or absolute path to the movie. Can be any movie that AVbin can read (e.g. mpeg, DivX) .. flipVert .. : True or False .. If True then the movie will be top-bottom flipped .. flipHoriz .. : True or False .. If True then the movie will be right-left flipped .. volume : .. The nominal level is 1.0, and 0.0 is silence, see pyglet.media.Player .. loop .. : bool, optional .. Whether to start the movie over from the beginning if draw is called and the movie is done. (訳注:原文に掲載されているデータ属性およびメソッドの内、一般的な視覚刺激オブジェクトと共通するものは省略した) loadMovie(filename, log=None) --------------------------------------- 引数filenameで指定された動画ファイルを読み込む。システムにavbinが見つからない場合は警告を表示する。読み込み後に自動的にデータ属性durationが更新されて動画の再生時間(単位は秒)が反映される。 .. Load a movie from file .. Parameters: .. filename: string .. The name of the file, including path if necessary .. Brings up a warning if avbin is not found on the computer. After the file is loaded MovieStim.duration is updated with the movie duration (in seconds). pause(log=None) ---------------------- 動画再生を一時停止する。play()で再開する。 .. Pause the current point in the movie (sound will stop, current frame will not advance). If play() is called again both will restart. play(log=None) ---------------------- 動画を再生する。一時停止後に再開する際にも用いる。 .. Continue a paused movie from current position. seek(timestamp, log=None) ----------------------------------- 引数timestampで指定した位置までシークする(再生位置を変更する)。バージョン1.62の時点でこの機能はあまり安定していない。 (訳注:現時点でも不安定である) .. Seek to a particular timestamp in the movie. .. NB this does not seem very robust as at version 1.62, may crash! stop(log=None) ----------------------------------- 動画の再生を現在の位置で停止する。このメソッドで停止すると再生しなおすことは出来ない。再び再生するにはload()を実行し直す必要がある。従って、再生を再開する必要がある場合はpause()を使う方がよい。 .. Stop the current point in the movie. .. The sound will stop, current frame will not advance. Once stopped the movie cannot be restarted - it must be loaded again. Use pause() if you may need to restart the movie.