Hi,
I am trying to play Quicktime movies including both video and sound repeatedly with
Psychtoolbox. Usually this works fine, but in about 1/4 of the cases Matlab crashes with a
bus error. This practically never happens when the first movie is played for the first time,
but only after the movies have been playing for a while. Does anyone know any solution or
a way out of this problem?
Thank you,
Tuomas Teinonen
Here is an example code about how the movies are played:
%% The movie is loaded into memory
[movie.mov, movie.dur, movie.fps, movie.w, movie.h] =...
Screen('OpenMovie',EXPWIN, 'movie1.mov');
% Load texture
Screen('SetMovieTimeIndex', movie.mov, 0);
movietexture = 0;
count = 0;
lastpts = -1;
pts = -1;
texture = [];
while(movietexture>=0)
[movietexture, pts] = Screen('GetMovieImage', EXPWIN, movie.mov, 1);
if( movietexture>0 & pts>lastpts )
count = count +1;
texture(count) = movietexture;
lastpts = pts;
else
break;
end
end
%% The movie is played
% This is done in a loop so that each time the movies are played in a certain order
% (here the code for just playing one movie one time)
numframes = length(texture);
dispTime = (movie.dur)/(numframes-1);
Screen('SetMovieTimeIndex', movie.mov, 0);
Screen('DrawTexture', EXPWIN, texture(1), [], [] );
when = GetSecs + ifi;
Screen('PlayMovie', movie.mov, 1, 1 );
for j=2:numframes
now StimulusOnsetTime FlipTimestamp Missed Beampos] = Screen('Flip', EXPWIN, when,
2);
Screen('DrawTexture', EXPWIN, texture(j), [], []);
Screen('DrawingFinished',EXPWIN, 2);
when = StimulusOnsetTime + dispTime-ifi;
end
Screen('Flip', EXPWIN, when, 2 );
% Movie stopped
Here's the system info:
OS X Psychtoolbox version 3.0.8 9 October 2006
OS X 10.3.9
2 CPU PowerPC 970 (2.2) Mac G5 with 2GB RAM (bus speed 1 GHz)
ATI RV350 64MB AGB display driver
QuickTime 7.1.3
MATLAB Version 7.0.1.24704 (R14) Service Pack 1
And the error message I get when the program crashes is:
-----------------------------------------------------------------------
Bus error detected at Fri Jan 26 00:15:44 2007
------------------------------------------------------------------------
Configuration:
MATLAB Version: 7.0.1.24704 (R14) Service Pack 1
MATLAB License:
Operating System: Darwin 7.9.0 Darwin Kernel Version 7.9.0: Wed Mar
30 20:11:17 PST 2005; root:xnu/xnu-517.12.7.obj~1/RELEASE_PPC Power Macintosh
Window System: The XFree86 Project, Inc (40300000), display :0.0
Current Visual: 0x22 (class 4, depth 24)
Virtual Machine: Java 1.4.2_09 with "Apple Computer, Inc." Java HottSpot(TM) Client VM
(mixed mode)
Default Charset: US-ASCII
r0 = 00000000 r8 = 00000000 r16 = 00000000 r24 = a01c5084
r1 = bfffd9b0 r9 = 00000000 r17 = 00000000 r25 = a00016b4
r2 = a00016b4 r10 = 000003e8 r18 = a01c1f20 r26 = 02ca4a40
r3 = 30934ba0 r11 = a62f0c44 r19 = 00000000 r27 = 00000000
r4 = 00000000 r12 = 00000000 r20 = 0002f637 r28 = 02ca4a58
r5 = 000003e8 r13 = 00000000 r21 = 00000000 r29 = 02ca4a66
r6 = bfffd7a8 r14 = 00000000 r22 = 02c0f690 r30 = 30934ba0
r7 = 00000002 r15 = 00000001 r23 = 16685534 r31 = 962f8924
cr = 22222242 lr = 962f8984 xer = 20000000 ctr = 00000000
vrsave = 00000000
Stack Trace:
[0] 0x00000000
[1] QuickTime:0x96340e1c
[2] QuickTime:0x96402aa8
[3] CoreFoundation:0x901c5170
[4] CoreFoundation:0x901c24d0
[5] CoreFoundation:0x901c69e4
[6] HIToolbox:0x91a81e10
[7] HIToolbox:0x91a8853c
[8] HIToolbox:0x91aaa638
[9] AppKit:0x97d84248
[10] AppKit:0x97d9acc8
[11] AppKit:0x97daf048
[12] libawt.jnilib:0x8108bc3c
[13] Foundation:0x90a4b0a0
[14] CoreFoundation:0x902151b0
[15] CoreFoundation:0x901c4800
[16] CoreFoundation:0x901c20b8
[17] CoreFoundation:0x901c69e4
[18] CoreFoundation:0x9022ffac
[19] MATLAB:callMainFromNewThread(startup_args_tag*) + 172 bytes
[20] MATLAB:main + 208 bytes
[21] MATLAB:_start + 392 bytes
[22] MATLAB:start + 48 bytes
This error was detected while a MEX-file was running. If the
MEX-file is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for
information on debugging MEX-files.
I am trying to play Quicktime movies including both video and sound repeatedly with
Psychtoolbox. Usually this works fine, but in about 1/4 of the cases Matlab crashes with a
bus error. This practically never happens when the first movie is played for the first time,
but only after the movies have been playing for a while. Does anyone know any solution or
a way out of this problem?
Thank you,
Tuomas Teinonen
Here is an example code about how the movies are played:
%% The movie is loaded into memory
[movie.mov, movie.dur, movie.fps, movie.w, movie.h] =...
Screen('OpenMovie',EXPWIN, 'movie1.mov');
% Load texture
Screen('SetMovieTimeIndex', movie.mov, 0);
movietexture = 0;
count = 0;
lastpts = -1;
pts = -1;
texture = [];
while(movietexture>=0)
[movietexture, pts] = Screen('GetMovieImage', EXPWIN, movie.mov, 1);
if( movietexture>0 & pts>lastpts )
count = count +1;
texture(count) = movietexture;
lastpts = pts;
else
break;
end
end
%% The movie is played
% This is done in a loop so that each time the movies are played in a certain order
% (here the code for just playing one movie one time)
numframes = length(texture);
dispTime = (movie.dur)/(numframes-1);
Screen('SetMovieTimeIndex', movie.mov, 0);
Screen('DrawTexture', EXPWIN, texture(1), [], [] );
when = GetSecs + ifi;
Screen('PlayMovie', movie.mov, 1, 1 );
for j=2:numframes
now StimulusOnsetTime FlipTimestamp Missed Beampos] = Screen('Flip', EXPWIN, when,
2);
Screen('DrawTexture', EXPWIN, texture(j), [], []);
Screen('DrawingFinished',EXPWIN, 2);
when = StimulusOnsetTime + dispTime-ifi;
end
Screen('Flip', EXPWIN, when, 2 );
% Movie stopped
Here's the system info:
OS X Psychtoolbox version 3.0.8 9 October 2006
OS X 10.3.9
2 CPU PowerPC 970 (2.2) Mac G5 with 2GB RAM (bus speed 1 GHz)
ATI RV350 64MB AGB display driver
QuickTime 7.1.3
MATLAB Version 7.0.1.24704 (R14) Service Pack 1
And the error message I get when the program crashes is:
-----------------------------------------------------------------------
Bus error detected at Fri Jan 26 00:15:44 2007
------------------------------------------------------------------------
Configuration:
MATLAB Version: 7.0.1.24704 (R14) Service Pack 1
MATLAB License:
Operating System: Darwin 7.9.0 Darwin Kernel Version 7.9.0: Wed Mar
30 20:11:17 PST 2005; root:xnu/xnu-517.12.7.obj~1/RELEASE_PPC Power Macintosh
Window System: The XFree86 Project, Inc (40300000), display :0.0
Current Visual: 0x22 (class 4, depth 24)
Virtual Machine: Java 1.4.2_09 with "Apple Computer, Inc." Java HottSpot(TM) Client VM
(mixed mode)
Default Charset: US-ASCII
r0 = 00000000 r8 = 00000000 r16 = 00000000 r24 = a01c5084
r1 = bfffd9b0 r9 = 00000000 r17 = 00000000 r25 = a00016b4
r2 = a00016b4 r10 = 000003e8 r18 = a01c1f20 r26 = 02ca4a40
r3 = 30934ba0 r11 = a62f0c44 r19 = 00000000 r27 = 00000000
r4 = 00000000 r12 = 00000000 r20 = 0002f637 r28 = 02ca4a58
r5 = 000003e8 r13 = 00000000 r21 = 00000000 r29 = 02ca4a66
r6 = bfffd7a8 r14 = 00000000 r22 = 02c0f690 r30 = 30934ba0
r7 = 00000002 r15 = 00000001 r23 = 16685534 r31 = 962f8924
cr = 22222242 lr = 962f8984 xer = 20000000 ctr = 00000000
vrsave = 00000000
Stack Trace:
[0] 0x00000000
[1] QuickTime:0x96340e1c
[2] QuickTime:0x96402aa8
[3] CoreFoundation:0x901c5170
[4] CoreFoundation:0x901c24d0
[5] CoreFoundation:0x901c69e4
[6] HIToolbox:0x91a81e10
[7] HIToolbox:0x91a8853c
[8] HIToolbox:0x91aaa638
[9] AppKit:0x97d84248
[10] AppKit:0x97d9acc8
[11] AppKit:0x97daf048
[12] libawt.jnilib:0x8108bc3c
[13] Foundation:0x90a4b0a0
[14] CoreFoundation:0x902151b0
[15] CoreFoundation:0x901c4800
[16] CoreFoundation:0x901c20b8
[17] CoreFoundation:0x901c69e4
[18] CoreFoundation:0x9022ffac
[19] MATLAB:callMainFromNewThread(startup_args_tag*) + 172 bytes
[20] MATLAB:main + 208 bytes
[21] MATLAB:_start + 392 bytes
[22] MATLAB:start + 48 bytes
This error was detected while a MEX-file was running. If the
MEX-file is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for
information on debugging MEX-files.