convert frames into video. Previous code i took frames from video, edited them and now i want to put them back. I got code from previous answer but it isnt working. Thanks
Show older comments
% Make an avi movie from a collection of PNG images in a folder.
% Specify the folder.
myFolder = 'C:\Users\bende\Documents\MATLAB\ppframes';
% Get a directory listing.
filePattern = fullfile(myFolder, '*.PNG');
pngFiles = dir(filePattern);
% Open the video writer object.
writerObj = VideoWriter('YourAVI.avi');
% Go through image by image writing it out to the AVI file.
for frameNumber = 1 : length(pngFiles)
% Construct the full filename.
baseFileName = pngFiles(frameNumber).name;
fullFileName = fullfile(myFolder, baseFileName);
% Display image name in the command window.
fprintf(1, 'Now reading %s\n', fullFileName);
% Display image in an axes control.
imageArray = imread(fullFileName);
imshow(imageArray) % Display image.
% Write this frame out to the AVI file.
writeVideo(writerObj, imageArray);
end
% Close down the video writer object to finish the file.
close(writerObj);
*I get this error***
Error using VideoWriter/writeVideo (line 338)
OBJ must be open before writing video. Call open(obj) before calling writeVideo.
Error in Frame_2_vid (line 22)
writeVideo(writerObj, imageArray);
Accepted Answer
More Answers (0)
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!