editing videos - adding black frames - avi empty
显示 更早的评论
Hi! We wrote a script that adds black frames to an existing video. Adding these before the actual video worked perfectly, but adding more after resulted in a correct .avi file of 8GB, but it says it has 0 duration. What could be wrong in this script adding the black frames?
%%%%%%%%%%%%%%%%%%%%%
movieObj = VideoReader(listOfClips(i).name); % open file
%% get video info get(movieObj); % display all info
nFrames = movieObj.NumberOfFrames; vidHeight = movieObj.Height; vidWidth = movieObj.Width;
%%create new black structure of 3400 frames length and fill part with movie new_mov(1:3400)= ... struct('cdata', zeros(vidHeight,vidWidth,3), 'colormap', []);
for k = 201 : (200+nFrames) new_mov(k).cdata = read(movieObj, k-200); end
%% 4D array holding all frames imagedata = uint8(zeros(vidHeight,vidWidth,3,nFrames));
for k = 1:nFrames imagedata (:,:,:,k) = new_mov(k).cdata; end
%% write to a video file
cd('/Uni/Erhebungen/EmotionBiomarker/Onlinesurvey/Introvideos') filename = listOfClips(i).name movie2avi(new_mov, filename,'compression', 'none', 'fps', 25); disp('video written to file')
%% movieObj = VideoReader(listOfClips(i).name); % define movieObj get(movieObj) % display all info %%%%%%%%%%%%%%%%%%%%%%%%%%%%
Thanks a lot! Hedwig
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Audio and Video Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!