A simple one-pass encode that tries to reach the specified bitrate at the end.
By setting -b:v and -b:a.
WARNING: Take care of the amounts used for the bitrate!
ffmpeg -i input.mp4 -c:v libx265 -b:v 8M -b:a 320k output.mkv ffmpeg -i input.mp4 -c:v libx265 -b:v 8000k -b:a 320k output.mkv
NOTE: