Clear Filters
Clear Filters

convert jpg file to animation problem

1 view (last 30 days)
Yu Li
Yu Li on 1 Aug 2018
Commented: Dinesh Iyer on 3 Aug 2018
Hi:
I tried to convert a series of jpg files to a movie. but the created .avi file could not be open.
I attached the sample code and test file, could someone give me some suggestions?
clear all
clc
load test_name
v = VideoWriter('test.avi');
open(v);
for ii = 1:length(test_name)
fprintf('operating on file: %s.\n',test_name{ii})
F=imread(test_name{ii});
writeVideo(v,F)
end
close(v);
by the way, the test code I attached operate the file one by one. assuming that I have 1000 frames, is there anyway to optimize it to parallel computing?
Thanks! Yu
  1 Comment
Dinesh Iyer
Dinesh Iyer on 3 Aug 2018
In your animation since the images have to be written to video in a specific order, parallelization will not really help as you still have to wait for the nth image to be read and written until the (n+1)th frame is written. I believe VideoWriter has made some performance improvements in 18a as per the release notes. Maybe this should help speed up yyour operation.

Sign in to comment.

Answers (0)

Categories

Find more on Animation 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!