convert images to a video
method 1 : use =avconv= package in Linux
e.g. to convert images (v_1.png, v_2.png ...) to 'velocity.mp4'
avconv -i v_%d.png -b:v 1000k velocity.mp4
to convert images (v_001.png, v_002.png ...) to 'velocity.mp4'
avconv -i v_%03d.png -b:v 1000k velocity.mp4
- i :: input file
- b :: bitrate
What bitrate should I use when encoding my video?
File size = bitrate (kilobits per second) x duration
Output size | Bitrate | Filesize |
320x240 pixels | 400 kbps | 3MB / minute |
480x270 pixels | 700 kbps | 5MB / minute |
1024 x 576 pixels | 1500 kbps | 11MB / minute |
1280x720 pixels | 2500 kbps | 19MB / minute |
1920x1080 pixels | 4000 kbps | 30MB / minute |
kbps= Kilo Bits Per Second
References:
https://stackoverflow.com/questions/16315192/avconv-make-a-video-from-a-subset-on-images
https://libav.org/avconv.html
https://www.ezs3.com/public/What_bitrate_should_I_use_when_encoding_my_video_How_do_I_optimize_my_video_for_the_web.cfm
Method 2 - MakeAVI (package) - Windows
http://makeavi.sourceforge.net/
Method 3 - ffmpeg (package) - Windows
ffmpeg -framerate 1 -pattern_type glob -i '*.jpg' -c:v libx264 -r 30 -pix_fmt yuv420p output.mp4
ffmpeg -framerate 1 -i "*.jpg" output.mp4
https://www.gyan.dev/ffmpeg/builds/
Method 4 - matlab code
clc clear step=63; for i=3:step h=figure(1); % ÏÂÃæÒ»ÐÐÌ滻ΪÏëÒªÏÔʾµÄÄÚÈÝ % set(0,'defaultfigurecolor','w') f_name=strcat('AnimationFrame',num2str(i,'%.6d'),'.jpg') aa=imread([f_name]); cc=imcrop(aa,[20 20 2000 800]); imshow(cc) % imshow([f_name]); % imshow([num2str(i),'.jpg']); frame = getframe(h); im = frame2im(frame); [imind,cm] = rgb2ind(im,256); % Write to the GIF File? if i==1 imwrite(imind,cm,['Frame','.gif'],'gif', 'Loopcount',inf,'DelayTime',0.1); elseif i==step imwrite(imind,cm,['Frame','.gif'],'gif','WriteMode','append','DelayTime',0.1); else imwrite(imind,cm,['Frame','.gif'],'gif','WriteMode','append','DelayTime',0.1); end end