editing videos - adding black frames - avi empty
Show older comments
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
Answers (0)
Categories
Find more on Audio and Video Data 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!