Convert to H.265 HEVC for smaller file size
basic conversion
// what it does
Re-encodes the video with libx265 (the x265 HEVC encoder) at CRF 28 and converts audio to AAC. HEVC typically delivers the same visual quality as H.264 at roughly half the bitrate, so this is the go-to for shrinking large files where you can afford the encode time. Lower the CRF for higher quality and a bigger file.
// shell
$ ffmpeg -i input.mp4 -c:v libx265 -crf 28 -c:a aac output.mp4// gotcha
By default the MP4 muxer writes HEVC with the hev1 tag, which Safari, QuickTime, and many hardware players refuse to play — add -tag:v hvc1 for Apple compatibility. Expect libx265 to encode several times slower than libx264.