problems w video presentation using media_player_mpy
I am creating an experiment in which I want to present 52 videos at 30 seconds each. The videos are (currently) all .avi files and quite large (around 500 MB). Therefore, I have added them all to the experiment folder (instead of loading them directly into the file pool) and am using legacy as a backend. I tried to display them using the media_player_mpy plugin but sadly that drops a lot of frames. Also, there is a noticeable time lag from the previous slide to the one where the video presentation starts (where I assume the file is being loaded).
I have tried creating this experiment with an older OS version earlier this year and used the vlc player and alternatively the media player plugin but didn't get much luckier either. I've also been through several file formats including .flv and .mov and tried creating the experiment in two "blocks" (that is creating two separate experiments to keep the overall size of the file pool smaller) but none of that really gave me a smooth video presentation. I had hoped that by shortening the videos (they used to be 2 mins before I cut them to 30 secs) and using the new version of OS maybe this would solve itself but I still have roughly the same problems.
So if anyone has advice on how I can display my videos so they run smoothly, I would be very very greateful.
Is there a better file format I can use or a way to somehow pre-load the videos? Participants fill out a number of questions after each video, so maybe during this time the next video could be pre-loaded somehow? (I have no idea if this is possible in OS, but my supervisor keeps pointing out to me that this would be the go-to solution in presentation)
Thanks a lot in advance for any advice!
The performance of media_player_mpy was usually quite good during testing, even with full HD files at high framerates. With preloading, do you actually mean pre-buffering (as in drawing video frames ahead of time?). This is not really supported by media_player_mpy at the moment and I doubt it would actually help. I do notice that you are using legacy as your backend, and as it happens, this is the only non-hardware accelerated backend, which means it is slower than the psychopy or expyriment backends, which are hardware accelerated and should boost a much higher performance.
If this doesn't solve anything we need to look elsewhere. Before I can really help you, could you answer the following questions?
You could also send me (a few of) the movie files you have trouble with with wetransfer or a similar service so that I can see how they run on my computer.
thanks a lot for your reply! And thank you for offering to take a look at the videos, sadly I cannot send them over because they are patient videos that I cannot share.
I have tried switching to xpyriment or psychopy (as was also suggested in your help file, I just realised - sorry for missing that) but that didn't really help. xpyriment was slightly better than the other two but still very buggy.
I am using Windows and the videos play at 50 frames per second and have a resolution of 1280 x 720. The computer is our lab computer and pretty new and well equipped (I can write down all the details if that's still needed), so I don't think that should be the problem.
I have played around with the encoding of the videos a bit more and it seems to me that this could be the solution. To be honest, I know next to nothing about video encoding but it seems that the avi encoding the program I used to cut the videos defaulted to makes the videos bug. I have switched back to an flv encoding (at the loss of some quality) and just tested the experiment with 4 videos (still need to convert the rest) and so far it works fine. So currently I'm planning to switch back to flv and hope the experiments runs with the 52 shorter videos.
Daniel, do you have any general recommendations about codecs that work better than others? I have just gone through a few codecs on a trial and error base and the flv codec was the first that worked, but I'm sure it's not necessarily the best (just wondering before I convert all 52 videos).
Ah that explains it. 50fps at 720p in Windows is really stretching it. Somehow Windows is the only platform that is troublesome with higher framerates, as Mac OS and Linux easily play 60fps without stutter. I haven't been able to pinpoint the cause of Windows' worse performance.
If you could do with less fps, say 30, you could downsample the videos to a lower frame rate and you should definitely be fine.
That being said, flv is a pretty good format. It stands for flash video, and even though Flash itself is on its decline, the video format is still prominently used. You could also try mp4 or the widely adopted h264 format, although I don't think this will matter much, as the high fps is the largest culprit here. Hopefully I will find a fix for this somewhere in the near future...
thanks a lot for pointing out the issue with the frame rate. I have played around with the video settings a bit and will go with a h264 codec and 30 frames per second, ending up with .mp4 files that are remarkably smaller than the original (around 10 MB instead of 500), which so far seems to work fine. The flash videos seemed to work, too, but for some reason the h264 encoded videos looked a bit better, so I went with them.
Thanks for all the work you put into this plugin and for helping me out! I will post again once I've converted everything and tested the experiment to let you know how well it runs with all 52 videos included.
Great! I'm happy it works better now. Let me know indeed how the experiment worked out in the end.
So far the experiment runs smoothly with the specifications I described above. We'll do some more extensive testing before we start collecting patient data, but I think it should be fine, now.
Thanks again for your help, Daniel!
update: i just tried a new video that has sound (previous videos had no audio). I still get the flash of a black square and then blank screen, but i can hear the video continuing to play.
So it seems the video is playing but there's a problem with the visual.