MPEG4 quality saved in MATLAB

2020-05-04 05:15发布

问题:

I need to get an mpeg4 file to use in another application, from an original mpeg4 video I loaded into matlab and edited (frame by frame). To do so, I tried using VideoWriter, setting the quality to 100%:

newVid = VideoWriter(outputfilename, 'MPEG-4');
newVid.FrameRate = fps;
newVid.Quality = 100;

However, the result I'm getting is very poor and if the original unedited video size was ~50MB, the one I get post-edit in matlab is around ~20MB, and I don't know how to keep the quality and size as they were. I also tried saving as .avi and converting to mpeg4 with ffmpeg, but it gave even poorer results. Any ideas?

回答1:

MPEG-4is a compressed format so there is information loss when you save it in this format. Quality is the quality of the compression but you do not want any compression. To force Matlab not to use compression my guess is to use the statement below as the default is H.264


    newVid.VideoCompressionMethod = 'none'