videowriter mpeg-4 vs avi file size

7 visualizaciones (últimos 30 días)
JM
JM el 30 de Sept. de 2024
Respondida: Arjun el 1 de Oct. de 2024
Im using videowriter to display some medical images which are typically about 10mb per frame
The orignal movie was made in AVI and are about 200mb each
vs.
path = ['C:\Users\**\image sets\Jim\03 - Non Clinical 3D Cases\0\']
y = VideoWriter("newfile2.avi","Uncompressed AVI");
y.FrameRate = 3
open(y)
I found out the person doing the presentation has a MAC and the codec is not working
I am thus trying to change it over to MPEG4
Each time I do this the same dataset for the movie comes out less than 1mb
I am using the quality variable
path = ['C:\Users\**\image sets\3D images\ImageData-Reconstructed slices DICOM\mini1\mini1\0\']
y = VideoWriter("newfile4.mp4", 'MPEG-4');
y.FrameRate = 3
y.Quality=100
any help?
thanks
  2 comentarios
JM
JM el 30 de Sept. de 2024
Movida: Walter Roberson el 30 de Sept. de 2024
this is the full code with username removed
clear
path = ['C:\Users\J***\image sets\Jim\03 - ***\0\']
y = VideoWriter("newfile2.avi","Uncompressed AVI");
y.FrameRate = 3
open(y)
for n = 2:19+1
file = ['**', num2str(n) '.DCM'];
im = double(dicomread([path, file]))/2^16;
%im = imcrop(im,[1000,1000,600,600]);
imshow(im);
hold on;
text(100, 100, '*****', 'FontSize', 16, 'Color', 'white');
text(100, 200, '03 - ****\0\', 'FontSize', 16, 'Color', 'white');
text(100, 300, ['ZAxis: ', num2str(n-1), 'mm'], 'FontSize', 16, 'Color', 'white');
F = getframe(gca);
im2 = frame2im(F);
writeVideo(y,im2);
end
close(y)
Walter Roberson
Walter Roberson el 30 de Sept. de 2024
The file sizes differ, but what problem are you encountering?
You would expect MPEG4 to be smaller than uncompressed AVI.

Iniciar sesión para comentar.

Respuestas (1)

Arjun
Arjun el 1 de Oct. de 2024
Hi @JM,
I understand that you have generated videos using “videowriter” in MATLAB and you want to understand why the size of videos generated in AVI and MPEG-4 formats so different.
Video formats like AVI are uncompressed formats focussed mainly on the quality aspect of the vide and storage requirements are more for them but video formats like MPEG-4 are more efficient to store and the quality of generated video takes a hit. To enhance the quality of the MPEG-4 video you can set the quality to higher values and if still not satisfied then consider changing the video format.
Hence the behaviour you see is expected and there will be considerable size difference between uncompressed AVI and MPEG-4 format.
I hope the explanation helps!

Etiquetas

Productos


Versión

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by