mp4 format video converted to avi format video wont load in matlab using mmreader()
1 view (last 30 days)
Show older comments
i have converted an mp4 format video to avi format but loading it using mmreader() command gives the following error:
_ _ _ _ * ??? Initialization failed. (No combination of intermediate filters could be found to make the connection.)
Error in ==> mmreader.mmreader>mmreader.init at 364 obj.MMReaderImpl = audiovideo.mmreader(fullName);
Error in ==> mmreader.mmreader>mmreader.mmreader at 133 obj.init(fileName);
Error in ==> test1 at 5 video = mmreader('sample.avi');* _ _ _ _
can any one help me i don't understand the error my code is as following:
clear all
threshold= 15;
video = mmreader('sample.avi');
first_frame = video.read(1) ;
first_frame_gray=rgb2gray(first_frame);
total_frames= video.NumberOfFrames;
[row,column,page]=size(first_frame);
dummy_matrix = zeros(row,column);
for i=2:total_frames
current_frame=video.read(i);
current_frame_gray=rgb2gray(current_frame);
frame_difference=abs(double(current_frame_gray)-double(first_frame_gray));
for nr=1:row
for nc=1:column
if ((frame_difference(nr,nc) > threshold)) % if fr_diff > thresh then that pixel is in foreground
dummy_matrix(nr,nc) = frame_difference(nr,nc);
else
dummy_matrix(nr,nc) = 0; %if fr_diff < thresh then that pixel is black
end
end
end
first_frame_gray= current_frame_gray;
figure(1),subplot(2,1,1)
imshow(current_frame)
subplot(2,1,2)
imshow(uint8(dummy_matrix))
Movie(i-1) = im2frame(uint8(dummy_matrix),gray); % put frames into movie. i-1 cause it starts from 2
end
1 Comment
Geoff Hayes
on 3 Sep 2014
Ayesha - have you read this link? It may provide some insight in to why you are unable to read the file.
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!