Quick and easy x264 example

ffmpeg -i input.mp4 -c:v libx264 -crf 18 -preset slow -c:a copy output.mp4

Quick and easy x265 example

ffmpeg -i input.mp4 -c:v libx265 -crf 18 -preset medium -c:a copy output.mp4

Change the resolution

Add the argument -vf scale=1280:-1 to scale the width to 1280 and keep the height in proportion

Whats the difference in presets ?

x264 presets are more for adjusting the time taken to encode the video. X265 presets adjust the quality of the resulting video. So a fast encode in x265 will result in a smaller filesize, but will be a lower quality video.

References