Skip to content
Related Articles
Get the best out of our app
Open App

Related Articles

How To Create Video From Sequence of Images Using MATLAB?

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

MATLAB stands for Matrix Laboratory. It is a high-performance language that is used for technical computing. In this article, we will see how to add subtitles to videos in MATLAB.

In the First step We will read the image after that we convert it to a movie frame and then write each frame one by one to the video file in this section. we take a example for creating video from sequence of images.

Example 1:


% Create Video with Image Sequence
clear all
% Designate the path below as
the current folder.
CD('E:\Documents and Settings\APPEX\My Documents\MATLAB\Images');
% Get all of the files in the current 
% folder that are in JPEG format.
Files = dir('*.jpg');
% The current folder's number of JPEG files
NumFiles= size(Files,1);
% To write Video File
VideoObj = VideoWriter('Create_Video.avi');
% Number of Seconds Between Frames
VideoObj.FrameRate = 6; 
% Define the Quality of the Video [ 0 to 100 ]
VideoObj.Quality = 70;  
% Open the File 'Create_video.avi'
for i = 1 : NumFiles
% Take a Look at the Image in the Present Folder.
I = imread(Files(i).name);
% Resize Image
ResizeImg = imresize(I,[500 900]);
% Convert a picture into a movie frame
frame = im2frame(ResizeImg);
% Six times are written on each Frame.
for j = 1 : 6
% Write a frame
writeVideo(VideoObj, frame);
% Close the File 'Create_Video.avi


Use the “im2frame” function to convert the image to a movie frame after reading the image from the current folder. Until the last image has been processed and written, write the frame to the file, read the next image, and repeat the process.

My Personal Notes arrow_drop_up
Last Updated : 28 Jan, 2023
Like Article
Save Article
Similar Reads
Related Tutorials