How to flip a movie file with VideoWriter
2 views (last 30 days)
Show older comments
I had flipped my movie file up to down by using movie2avi, with the following code. However, after upgraded to MATLAB R2015a, the code couldn't work, and MATLAB's help recommends me to use VideoWriter. How can I use VideoWriter to flip my movie file?
Thanks in advance.
% edit_movie
close all
cd C:\
Vobj = VideoReader( '1R2f1.avi' );
matrix_V = read( Vobj );
[ H, W, B, F ] = size( matrix_V );
matrix_V_rev = [];
for i = 1:F
matrix_image = matrix_V( :, :, :, i );
matrix_image_rev = flipud( matrix_image );
M( i ) = im2frame( matrix_image_rev );
end
movie2avi( M, '1R2f1_rev.avi' );
0 Comments
Accepted Answer
Walter Roberson
on 19 Oct 2015
Remove the movie2avi call and use
v = VideoWriter('1R2f1_rev.avi');
open(v);
writeVideo(s, M);
close(v);
4 Comments
Walter Roberson
on 21 Oct 2015
Your
cd C:\
has placed you in the top level directory on the C: drive. You then try to write a file in that directory. You do not have permission to write files there. You will need to write the files somewhere else.
More Answers (0)
See Also
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!