Writing jpeg images to movie - .avi size and timestamp on image
5 views (last 30 days)
Show older comments
Hi all,
The code below creates a .avi movie from a collection of jpeg files. The code works fine but I want to do two things:
(i)Reduce the size of the resulting video - quality of video is not that important
(ii)Add a visual timestamp to images (video)
Any suggestions on how best to go about this?
Thanks, Dom
if true
% Create a VideoWriter object, in order to write video data to an .avi file using a jpeg compression.
VideoFile = ['op1_mx',num2str(mx),'_',files(f).name];
writerObj = VideoWriter(VideoFile);
fps = 10; % Define the video frames per second speed (fps)
writerObj.FrameRate = fps;
open(writerObj); % Open file for writing video data
% Running over all the files, converting them to movie frames using im2frame and writing the video data to file using writeVideo
for t = 1:length(jpegFilesS)
disp(t);
Frame = imread(strcat(ImagesFolder,'/',jpegFilesS(t).name));
writeVideo(writerObj,im2frame(Frame));
end
% Close the file after writing the video data
close(writerObj);
end
0 Comments
Answers (0)
See Also
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!