How to efficiently record & compress AVI animation & GIFs?

18 ビュー (過去 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.

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by