You're on the right track with
-crf and x264 (the H.264 encoder), and it should provide the "quality threshold" that you're looking for. CRF is recommended if you want a certain output quality and output file size is of less importance. Conversely, performing a two-pass encode with
-b:v is recommend if you are targeting a specific output file size and quality is of less importance.
1. Get FFmpeg
Get ffmpeg and x264. Your distro may provide a package, but it may not support libx264 or it may be very old. It's a good idea to compile these if you're going to be doing a good amount of encoding since development is very active. See FFmpeg Compilation Guides for complete FFmpeg and x264 compile instructions for Ubuntu and CentOS. Alternatively you can simply use FFmpeg static Linux builds (but compiling is more interesting). Links to these are available on the FFmpeg Download page.
If you're using Ubuntu and just want to use the distro package then see HOWTO: Easily enable MP3, MPEG4, AAC, and other restricted encoders in FFmpeg. This guide is now unmaintained, but it is still up to date.
2. Choose a CRF value
The range is 0-51 where 0 is lossless, 23 is default, and 51 is worst possible. A lower value is a higher quality. A subjectively sane range is 18-28. Consider 18 to be visually lossless: it should look the same as the input but it isn't technically lossless. Increasing the CRF value +6 is roughly half the bitrate while -6 is roughly twice the bitrate. Note: These CRF values apply to 8-bit x264. 10-bit x264 CRF values are different, IIRC.
General usage is to choose the highest quality that still provides an acceptable quality. That is if the output looks good then try a higher value and if it looks bad then choose a lower value.
3. Choose a preset
A preset is a collection of options that will provide a certain encoding speed:compression ratio. A slower preset will provide better compression (compression is quality per filesize). General usage is to use the slowest preset that you have patience for. Current presets in descending order of speed are:
ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo. Ignore
placebo as it is a joke and a waste of time (it helps at most ~1%). If it's encoding too slowly then use a faster preset.
Use these settings for the rest of your videos. They should all end up with the same quality.
ffmpeg -i input -c:v libx264 -preset slow -crf 22 -c:a copy output.mkv
Encode a section instead of the whole video with the
-ss (offset time from beginning; in seconds or hh:mm:ss) and
-t (duration in seconds or hh:mm:ss) options to quickly get a general idea of what the output will look like.