Multiple webcam files within a trial

Greetings all!

I would like to use the web cam to generate multiple video files. It does fine as long as you access “cam” once each trial. Trouble is that my trials include several parts and I’d like a separate video cam file for each. For example:

Start…training trials loop with separate video files… test trials loop with separate video…end

I’ve tried dummy coding separate n=1 loops thinking that might close the file before the next but that did not do the trick.

Thanks for your help!
Tyler

Hi Tyler,

did you have a look into the code exported by the builder (i.e., the .py-file) when using a camera component? Maybe you can identify which code snippets start and stop a camera and reuse them for your own purposes.

Adrian

Thanks (again) Adrian! That’s a great idea and I will give it a try!

Best,
Tyler

Hey @tlorig,

I have the same issue at the moment. I was wondering if you found any solution to save different clips for each trial that are in the same loop ?

Best,
Sarah

Hi Tyler,
We are trying to do the same thing and are using the Camera component that was suggested to you. What we notice is that each of the short videos is saved at the end of the Routine but we would rather they are saved before the loop repeats. Did you ever find a solution to this issue that might help us too?
Best wishes,
Donna

Hello Donna,
When we started, the version of Psychopy we were using allowed only one massive video file per loop! Fortunately, that changed with a new update. With the short trial-based videos, we were able to force file names that included our variable IDs from the loop structure. That solved our problem. Unfortunately, I don’t have my code or a PC nearby (it’s 6 hours away) to share that answer. Somebody on the listserv responded to my request for help with a code fragment that did the trick. If that would work for you, I suggest asking that question to the group.

Good luck with your work!
Best wishes,
Tyler

Thanks for your quick reply, Tyler, and sorry for my delayed thank you :slight_smile: Probably a silly question, but what listserv are you referring to? I’d like to give that a go.

Hi Donna,

I should have used its real name… that would be the forum! https://discourse.psychopy.org/

Probably how you found me!

Good luck in your search,
Tyler