필터 지우기
필터 지우기

Cannot using movie2avi in MATLAB

조회 수: 3 (최근 30일)
Kelvin
Kelvin 2015년 10월 16일
댓글: Walter Roberson 2015년 10월 20일
I am trying to use the movie2avi function in MATLAB. I simply copy the sample program in my MATLAB R2015a:
nFrames = 20;
% Preallocate movie structure.
mov(1:nFrames) = struct('cdata', [],...
'colormap', []);
% Create movie.
Z = peaks; surf(Z);
axis tight manual
set(gca,'nextplot','replacechildren');
for k = 1:nFrames
surf(sin(2*pi*k/20)*Z,Z)
mov(k) = getframe(gcf);
end
% Create AVI file.
movie2avi(mov, 'myPeaks.avi', 'compression', 'None');
But an error message appears:
Error using avi
Unexpected Error. Reason: Failed to open file.
Error in audiovideo.internal.aviwriter (line 168)
aviobj.FileHandle = avi('open',filename);
Error in movie2avi (line 63)
avimov = audiovideo.internal.aviwriter(filename,varargin{:});
Error in MakeMovie (line 36)
movie2avi(mov, 'myPeaks.avi', 'compression', 'None');
What's wrong here? Please help.

답변 (1개)

Dinesh Iyer
Dinesh Iyer 2015년 10월 16일
Can you check if the location you are attempting to write the file to has write permissions?
movie2avi is being deprecated. I would recommend using VideoWriter as it allows you the use of more modern compression methods such as MPEG-4, MJ200), MJPEG AVI.
See VideoWriter documentation for examples.
Hope this helps.
Dinesh
  댓글 수: 5
Kelvin
Kelvin 2015년 10월 20일
편집: Walter Roberson 2015년 10월 20일
I have typed this command and it shows:
Name: 'C:\Users\SupUsr\Desktop\Postdoctoral Research\DDFD\Practice'
archive: 0
system: 0
hidden: 0
directory: 1
UserRead: 1
UserWrite: 1
UserExecute: 1
GroupRead: NaN
GroupWrite: NaN
GroupExecute: NaN
OtherRead: NaN
OtherWrite: NaN
OtherExecute: NaN
It means that I can read and write in this directory. So what cause the error?
Walter Roberson
Walter Roberson 2015년 10월 20일
I do not know for sure, but I suggest trying again in a directory that does not have a space in its name.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by