Video Playback: Difference between revisions

Jump to navigation Jump to search
No edit summary
Line 399: Line 399:


Another one is DaVinci Resolve for editing and converting video files. DaVinci Resolve is a free, professional-grade editing program, available here: https://www.blackmagicdesign.com/products/davinciresolve
Another one is DaVinci Resolve for editing and converting video files. DaVinci Resolve is a free, professional-grade editing program, available here: https://www.blackmagicdesign.com/products/davinciresolve
==Playback==
=== PsychoPy ===
Example demonstrating how to play a video:
<syntaxhighlight lang="python" line>
#!/usr/bin/env python3.10
# -*- coding: utf-8 -*-
import time
import keyboard
from psychopy import visual
from psychopy import core
## Setup Section
win = visual.Window([720,720], fullscr=False, monitor="testMonitor", units='cm')
# append this stimulus to the list of prepared stimuli
vlc_movies = []
my_movies = ['YourMovie.mp4']#path to your movies from this directory
for movie in my_movies:
    mov = visual.VlcMovieStim(win, movie,
    size=600,  # set as `None` to use the native video size
    pos=[0, 0],  # pos specifies the /center/ of the movie stim location
    flipVert=False,  # flip the video picture vertically
    flipHoriz=False,  # flip the video picture horizontally
    loop=False,  # replay the video when it reaches the end
    autoStart=True)  # start the video automatically when first drawn
    vlc_movies.append(mov)
print("playing video....")
while not(keyboard.is_pressed('q')) and vlc_movies[0].status != visual.FINISHED:
    vlc_movies[0].draw()
    win.flip()
    buffer_in = vlc_movies[0].frameIndex
    print(vlc_movies[0].status)
print("Stop")
## Closing Section
core.quit()
</syntaxhighlight>