convert jpg file to animation problem

2 次查看(过去 30 天)
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 个评论
Dinesh Iyer
Dinesh Iyer 2018-8-3
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Animation 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by