Audio

From TSG Doc
Revision as of 13:22, 28 April 2025 by P.dewater (talk | contribs)
Jump to navigation Jump to search

When using video in your experiment, especially when presenting time-critical stimuli, special care should be taken to optimize the video and audio settings on multiple levels (hardware, OS, script), as many things can go wrong along the way.

This page outlines some best practices; however, we advise to always consult a TSG member if you plan to run a video experiment in the labs.

Recording

When recording video for stimulus material or as input for your experiment, please: Use a high-quality camera, with settings appropriate for your application (e.g., frame rate, resolution). Use a high-quality recorder or capture device, capable of recording at 1080p (1920×1080) and 60fps or higher. Stabilize the camera and avoid automatic exposure, white balance, or focus during recording to prevent inconsistencies. Record in a controlled environment with consistent lighting and minimal background distractions. You can use the facecam for high quality video recording.

Editing

We recommend using 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

Alternatively, you can use Shotcut, a simple open-source editor, available here: https://shotcut.org/

Video Settings

We recommend using the following settings: File format: .mp4 (H.264 codec(libx264)) Frame rate: 60 fps (frames per second) Resolution: 1920×1080 (Full HD) or match your experiment's display settings Bitrate: 10-20 Mbps for Full HD video Constant Frame Rate (CFR): Always enforce a constant frame rate.

  Example: -vsync cfr in ffmpeg.


The Lab Computer displays are typically set to 1920×1080 at 120Hz. We found that this is sufficient for most applications. There are possibilities to go higher.

Windows Settings

Windows 10 has a habit of automatically enabling video enhancements or unnecessary processing features, which can interfere with smooth playback. Therefore, please make sure these are disabled:

Open Settings → System → Display → Graphics Settings. If available, disable "Hardware-accelerated GPU scheduling" for critical timing experiments. For specific applications (e.g., PsychoPy), under "Graphics Performance Preference," set them to "High Performance" to ensure they use the dedicated GPU.

Playback

PsychoPy

This is an example of a Python script that plays a .mp4 video file with high time accuracy.

 1 from psychopy import visual, core, prefs prefs.hardware['videoLib'] = ['avbin', 'ffpyplayer'] # Choose based on installed libraries
 2
 3Create a window
 4win = visual.Window(fullscr=True, monitor="testMonitor", units="pix")
 5
 6Path to video file
 7video_file = "stimulus.mp4"
 8
 9Load video
10movie = visual.MovieStim3(win, video_file, size=(1920, 1080), flipVert=False, flipHoriz=False, loop=False)
11
12Play video
13while movie.status != visual.FINISHED: movie.draw() win.flip()
14
15Close window
16win.close() core.quit()