How to make the MP4 as small as possible without sacrificing video quality

Started by AshleyRobin, August 21, 2022, 03:12:14 PM

Previous topic - Next topic

AshleyRobin

Hello there, I'd like to know which preferences I should use to make the MP4 as small as possible without sacrificing video quality. Thank you for your help!

eumagga0x2a

Every re-encoding with a lossy codec sacrifices video quality. Thus the main question is about the properties of the source file.

The next question would be whether the targeted recipient of the compressed file is able to play video streams encoded with modern codecs like HEVC and VP9, whether reduction of frame rate would be acceptable (in case the input has a high frame rate >= 50 fps) and whether the source is interlaced or progressive.

If the source has multiple audio tracks, it would be necessary to know whether they all need to be present in the output and whether downmixing von multi-channel audio to stereo would be tolerable.

Elstar`

Don't use VP9 (it produces distorted results), for x264 (AVC) / x265 (HEVC) use preset veryslow and constant rate factor no more than 18. In case of x264, disabling macroblock tree (checkbox in advanced RC) and psychovisual optimizations (in Analysis, set them to 0,00) will help with the quality, but in avidemux you need to make your own preset for this (it does not allow using presets with advanced configuration).

eumagga0x2a


Elstar`

Quote from: eumagga0x2a on August 21, 2022, 10:29:29 PM
Quote from: Elstar` on August 21, 2022, 10:10:33 PMDon't use VP9 (it produces distorted results)
Please elaborate.
If it is not lossless, it seems to sacrifice too much quality in favor of bitrate, at least on HD (up to 1080p) content. Just compare the result frame by frame. Maybe it just too optimized for 4K content.

xtro

Quote from: AshleyRobin on August 21, 2022, 03:12:14 PMHello there, I'd like to know which preferences I should use to make the MP4 as small as possible without sacrificing video quality. Thank you for your help!

If your source is excellent then aim for about 60% size of original video. Audio if 5.1? can be changed to 2.0 stereo-maybe go 64kbps he-aac V1, roughly equivalent to 96kbps LC aac or just copy original audio. Don't use Very Slow as it is tortuously slow, especially if a 2 pass. Use Slower or Slow with preset Film.  If 1080p resize to 720p, that would reduce size considerably too! However any change to video equates to a loss in some visual quality!

CRF(lower numbers higher quality!) gives unpredictable sizes; CRF 18 is said to be transparent. I usually use CRF 20 on blu ray sources. If you use 1 pass abr at a highish bitrate say 2500+, differences between that and a 2 pass average bitrate may only be 5% in quality terms, but is it worth the time encoding? Try CRF first.

Who

Quote from: eumagga0x2a on August 21, 2022, 04:09:23 PMIf the source has multiple audio tracks, it would be necessary to know whether they all need to be present in the output and whether downmixing von multi-channel audio to stereo would be tolerable.

And when thinking about that, keep in mind that someday you may get an actual 5.1 receiver and speakers, and if that happens you are probably going to hate yourself for converting all that audio to stereo.  Converting audio generally doesn't save all that much space compared to compressing video with a better algorithm or using a higher compression rate factor.  Personally I always leave the audio set to "copy" even when compressing video, but you can decide what you need.

Elstar`

And if you want quality, never use bitrate constraints, use CRF only. Compress audio (to aac-lc, not he) only if source is lossless (PCM or FLAC) else you will lose much more audio quality.