Appending image frames to existing avi file

21 ビュー (過去 30 日間)
JohnDylon
JohnDylon 2016 年 8 月 8 日
回答済み: JohnDylon 2016 年 8 月 8 日
Can anyone suggest how to append frames to an existing video file? I tried the code below in a for loop, however what I get is it can only create a new file only from given frames and doesn't append to the existing file.
outvid=VideoWriter([vidoutpath, name_vidout]);
outvid.FrameRate=mov.FrameRate;
open(outvid)
for pgc=1:length(RGBbin(1,1,1,:))
writeVideo(outvid, RGBbin(:,:,:,pgc));
end
close(outvid)
Thnx.

採用された回答

JohnDylon
JohnDylon 2016 年 8 月 8 日
I found a workaround. Since writeVideo can't append frames to a closed video file, (in my case) closing video in an appropriate step solves the problem. For example,
open(outvid);
for bin=1:n % An individual bin contains a number of frames say 1K
start=some calculation;
finish=some other calculation;
for frame=start:finish
writeVideo(outvid, framesource(frame));
end
% Video object is not closed here
end
close(outvid);
Thank for help.
JD

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 8 月 8 日
VideoWriter cannot append frames.
You might be able to edit the C++ code given in http://www.mathworks.com/matlabcentral/fileexchange/280-aviwrite . Or possibly you could make use of the 'Continue' and 'Initialized' options of https://www.mathworks.com/matlabcentral/fileexchange/15881-mmwrite

カテゴリ

Help Center および File ExchangeAudio and Video Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by