How to efficiently record & compress AVI animation & GIFs?

조회 수: 11 (최근 30일)
Saeed Mohammadian
Saeed Mohammadian 2018년 6월 17일
답변: Saeed Mohammadian 2018년 6월 19일
Hello everyone,
I'm recording a video out of my simulations in a loop and I want a smaller video size WITHOUT changing frame rate. I mean I don't want to decrease the duration of video, which happens when I change the frame rate. Below is my code:
applying the following code to save the video.
% defining file name as:
v = VideoWriter('filename.avi');
v.VideoCompressionMethod
open(v);
and in the loop for t=1:nTstep I apply the following:
%
if (rem(t,5)==0)
A(t) = getframe(gcf);
writeVideo(v,A(t));
This result in a 700 mb size for a 10-second video. Does anyone know how I can decrease it to less than 200 mb or something, without changing the video duration?.
Another thing, I'm eventually converting my avi to GIF and cannot directly do it in conveniently. I've used some codes to generate GIF but my frame rates and other stuff used to change. Can someone introduce a neat way of directly generating GIFs in Matlab?
Thanks a lot
Saeed
  댓글 수: 1
Walter Roberson
Walter Roberson 2018년 6월 17일
imwrite() with 'writemode', 'append' can make animated GIF.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2018년 6월 17일
For smaller .avi you need to pass a profile as the second argument to VideoWriter; see https://www.mathworks.com/help/matlab/ref/videowriter.html#d119e1242642 . You will probably need to reduce the Quality .
Unfortunately, VideoWriter writes frame by frame, so although it can do backwards references for compression, it never does forward references. A good transcoding program such as vlc can almost always do better.

추가 답변 (1개)

Saeed Mohammadian
Saeed Mohammadian 2018년 6월 19일
Thansk very much... I decided to go for conversion softwares.

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by