Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Change video speed

Hi,


I am trying to design an experiment in which short video clips will be displayed to participants.

The back end I am using is xpyriment as I get black screens during the presentation of the clips with other back ends.

I would like to increase the speed at which he clips are read (say x1.5).

Is there a way to do this in opensesame or do I need to alter the speed of the files themselves ?


Best,

Comments

  • Also related to the use of videos using media player mpy,


    I would like the clip to pause at its very end so that participants can see the final frame until the end of the desired presentation time.


    Best,

  • Hi Arthur,

    To be honest, I would strongly recommend to use OpenCV2 to present video, rather than any of the plugins that might or might not work. Most of them are already outdated and in their functionality they are also somewhat limited. OpenCV2 is a very powerful Python library that provides all kinds of video/image processing functionality. You first need to install it (see here how to). And then you can implement some video playback like this:

    import cv2
    import numpy as np
       
    # Create a VideoCapture object and read from input file
    cap = cv2.VideoCapture('tree.mp4')
       
    # Check if camera opened successfully
    if (cap.isOpened()== False): 
      print("Error opening video file")
       
    # Read until video is completed
    while(cap.isOpened()):
          
      # Capture frame-by-frame
      ret, frame = cap.read()
      if ret == True:
       
        # Display the resulting frame
        cv2.imshow('Frame', frame)
          
      # Break the loop
      else: 
        break
       
    # When everything done, release 
    # the video capture object
    cap.release()
    

    To then change the playback speed you essentially have to adapt the frame rate (see here for details).

    Hope this helps,

    Eduard

    Buy Me A Coffee

Sign In or Register to comment.