Till Pfeiffer
Till Pfeiffer

Reputation: 1

Cannot use moviestim2 on Mac OSX 10.9.5

I program my experiments on a Macbook Pro with OSX 10.9.5, graphic card Intel HD Graphics 4000 1024 MB, with VLC Version 2.0.10 Twoflower (Intel 32bit). I used to present videos (avi and mp4 files, 60 frames per second) successfully with moviestim up to version 1.80. After upgrading to version 1.81 by installing the standalone version I tried to use moviestim2, adapting the code in Moviestim2.py. When I run the code below:

    from psychopy import visual, core
    import time, os, pylab

    os.chdir('/Users/till/work/edv/psychopy/test/')
    win = visual.Window([1440, 900])
    win.setRecordFrameIntervals(True)
    mov = visual.MovieStim2(win, 'jwpIntro.mov',
        size=[800,800],
        pos=[0, 100],
        flipVert=False,
        flipHoriz=False,
        loop=False)

    shouldflip = mov.play()
    while mov.status != visual.FINISHED:
        if shouldflip:
            win.flip()
        else:
            time.sleep(0.001)
        shouldflip = mov.draw()

    intervalsMS = pylab.array(win.frameIntervals[1:])*1000
    m=pylab.mean(intervalsMS)
    nTotal=len(intervalsMS)
    nDropped=sum(intervalsMS>(1.5*m))
    print "nTotal", nTotal
    print "nDropped", nDropped
    core.quit()

the video is shown in full length, the output is

nTotal 142

nDropped 2

(Warnings deleted). When I run the code with one of my videos (file format mov, size adjusted to 800x800), generated with ffmpeg in format H.264 from 852 png files with 60 frames per second to show moving objects for a tracking task (no audio data), the window closes immediately after probably showing the first frame. The output is

nTotal 0

nDropped 0

/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/numpy/core/_methods.py:55: RuntimeWarning: Mean of empty slice. warnings.warn("Mean of empty slice.", RuntimeWarning) /Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/numpy/core/_methods.py:67: RuntimeWarning: invalid value encountered in double_scalars ret = ret.dtype.type(ret / rcount)

(Other warnings deleted) Tests with file formats avi and mp4 generated nTotals of 1 to 2 and accordingly no Runtime Warnings and the same result.

Any help would be appreciated, because up to now I was not able to return to PsychoPy 1.80 using moviestim as before with avbin 10 (window freezes, but PsychoPy does not crash) as a workaround.

Best,

Till

Upvotes: 0

Views: 424

Answers (1)

Sol Simpson
Sol Simpson

Reputation: 101

The issue likely has to do with your videos not having any audio track. Try setting the 'noAudio' kwarg to True when you create the MovieStim2.

visual.MovieStim2(win, 'jwpIntro.mov',
        size=[800,800],
        pos=[0, 100],
        noAudio=True,
        flipVert=False,
        flipHoriz=False,
        loop=False)

MovieStim2 should really be able to auto detect when there is no audio stream at all; so that should be changed when there is time. ;)

If the above does not work, can you post a link to one of your sample videos so I can download and debug?

Update: I tested my suggested workaround, only to discover it uncovered some other issues. (Arrrg..) These issues are now fixed, however this means that for this suggestion to work, you will need to update your psychopy package source from the psychopy github master stream as of October 23rd, 2014, or use an official package update if one is available that was released after this date.

Upvotes: 0

Related Questions