I have videos in .mp4 format and I need to rotate them vertically so that they will rotate 180 degrees.
I wrote the code and it rotates 180 degrees, however, it only takes one frame, so the video duration is 0 and the video is grayscale, which is a thing that I don't want since the video includes a red fixation point.
vidName = 'SID12.mp4';vidPath = strcat(videosPathToBeEdited, vidName); V= VideoReader(vidPath); for k=1:video_duration*FrameRate RGB= readFrame(V); clear temp image_rot = flipud( RGB ); rotated_vid = image_rot; endrotated_vid = rotated_vid(:,:,end:-1:1);%calling save video function in another .m file
savemy_video(rotated_vid,[vidName(1:end-4), '_rev_rotated' video_duration_inname]);
Are there any easier and quicker ways to rotate a video? or if you could help me with this code would really appreciate it.
Best Answer