Creating a video from a sequence of images in Matlab

user13873097

I am stuck on how to create an video file from from a sequence of images.

I have a folder with images as follows:

image01.png 
image02.png 
... 
image150.png

How do I combine them to a video in Matlab?

I saw this link explaining it, but I could not understand it exactly.

User81862311

You may want to do something like this:

nImage = 150;                                                        % L1
fps = 3.0;                                                           % L2
addToInFolder = 'Address\to\Input\Images\Folder';                    % L3
addToOutFolder = 'Address\to\Output\Video\Folder';                   % L4

oVideo = VideoWriter(fullfile(addToOutFolder, 'myVideo.avi'));       % L5
oVideo.FrameRate = fps;                                              % L6
open(oVideo)                                                         % L7
for i = 1:nImage                                                     % L8
    fname = ['image' num2str(i, '%.2d') '.png'];                     % L9
    curImage = imread(fullfile(addToInFolder,fname));                % L10
    writeVideo(oVideo, curImage);                                    % L11
end                                                                  % L12
close(oVideo)                                                        % L13

Since you could not follow the example, here is a break down of what is going on per line:

  • L1 => Total number of images which based on your file names is 150
  • L2 => Frame per second of the movie you are making
  • L3 => Address to the input folder of your images
  • L4 => Address to the output folder for your movie
  • L5 => Create a complete address to the output movie (.avi) file and make a video file at this address to be written
  • L6 => Set frame rate of the movie to fps. FrameRate is a property of a video object. See this page for the complete list of properties you can play with. There are properties you may want to play with like Quality, Duration, CompressionRatio, etc).
  • L7 => Video file needs to be opened to allow for writing data, otherwise you do not have the permission to write to this file
  • L8 => Let's begin a loop over each image and make a frame out of it
  • L9 => Create a string of file name for the current image (image01.png, ...., image150.png)
  • L10 => Read the png file and store its data in variable curImage
  • L11 => Add contents of curImage to the video file pointed by oVideo
  • L13 => Don't forget to close the video file (oVideo) that was opened before

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

creating video from sequence of images javacv

From Dev

ffmepg video from uneven sequence of png images

From Dev

Creating a sequence of images from lyrics to use in ffmpeg

From Java

Python creating video from images using opencv

From Dev

Creating video from images with different SARs with FFMPEG

From Dev

Creating a video from set of images Android

From Dev

Android ffmpeg: create video from sequence of images using jni

From Dev

Creating an MJPEG video from still images using C#

From Dev

ffmpeg slideshow video from images creating empty mp4

From Dev

How to extract original images from a lossless compressed video which is composed from a sequence of images?

From Dev

Dynamically creating images in a sequence and having the sequence reset

From Dev

Convert Video to Image Sequence MATLAB

From Dev

Creating video from images produces black screen video for certain image formats

From Dev

Extract Images from video and rebuild video with these images

From Dev

FFMPEG images to video with reverse sequence with other filters

From Dev

Convert a sequence of ppm images to avi video

From Dev

Converting a sequence of ppm images to video with python

From Dev

Create video from image sequence

From Dev

Add watermark to each frame while creating video from images using ffmpeg

From Dev

Creating MJEPG video from multiple JPEG encoded images without using cv::imdecode()

From Dev

Resolution Issue when creating an MPEG4 video from images (Windows Media Foundation)

From Dev

creating video from selected images using FFMPEG through command Line Android

From Dev

Creating Video Slideshow From Images With Different Sizing/Aspect Ratio Using FFMPEG?

From Dev

Matlab: Creating contour maps/images similiar to SigmaPlot

From Dev

Creating a video from individual frames

From Dev

Creating Snapshoot Gallery From Video

From Dev

Create video from images in Flutter

From Dev

Create video from single images

From Dev

Create video from a list of images

Related Related

  1. 1

    creating video from sequence of images javacv

  2. 2

    ffmepg video from uneven sequence of png images

  3. 3

    Creating a sequence of images from lyrics to use in ffmpeg

  4. 4

    Python creating video from images using opencv

  5. 5

    Creating video from images with different SARs with FFMPEG

  6. 6

    Creating a video from set of images Android

  7. 7

    Android ffmpeg: create video from sequence of images using jni

  8. 8

    Creating an MJPEG video from still images using C#

  9. 9

    ffmpeg slideshow video from images creating empty mp4

  10. 10

    How to extract original images from a lossless compressed video which is composed from a sequence of images?

  11. 11

    Dynamically creating images in a sequence and having the sequence reset

  12. 12

    Convert Video to Image Sequence MATLAB

  13. 13

    Creating video from images produces black screen video for certain image formats

  14. 14

    Extract Images from video and rebuild video with these images

  15. 15

    FFMPEG images to video with reverse sequence with other filters

  16. 16

    Convert a sequence of ppm images to avi video

  17. 17

    Converting a sequence of ppm images to video with python

  18. 18

    Create video from image sequence

  19. 19

    Add watermark to each frame while creating video from images using ffmpeg

  20. 20

    Creating MJEPG video from multiple JPEG encoded images without using cv::imdecode()

  21. 21

    Resolution Issue when creating an MPEG4 video from images (Windows Media Foundation)

  22. 22

    creating video from selected images using FFMPEG through command Line Android

  23. 23

    Creating Video Slideshow From Images With Different Sizing/Aspect Ratio Using FFMPEG?

  24. 24

    Matlab: Creating contour maps/images similiar to SigmaPlot

  25. 25

    Creating a video from individual frames

  26. 26

    Creating Snapshoot Gallery From Video

  27. 27

    Create video from images in Flutter

  28. 28

    Create video from single images

  29. 29

    Create video from a list of images

HotTag

Archive