user6105: According to the documentation for libx264 (h264) encoding, we can use a preset of veryfast, faster, fast, medium, slow, etc.
https://trac.ffmpeg.org/wiki/Encode/H.264

...for constant quality encoding, you will simply save bitrate by
  choosing a slower preset.

So while using constant quality, a slower preset doesn't have any affect on video quality, but it can compress the file size smaller.
This theoretically means it should be possible to take a video compressed with preset "veryfast", and recompress it with "slow"- resulting in a smaller file with no loss of video quality.
Has anyone ever done this or know how it can be done?

user2836: You have a misunderstanding of how compression works.  In all but a few specialized types of lossy compression, when you compress something a second time, even in a much higher quality level than previous encodings, you still lose additional quality.  
Using a slower encoding from the same original source with constant quality will often produce a smaller file of similar quality, but if you encode the already compressed version over again, you will still always end up with a lower quality video due to second generation quality losses from compressing twice.

user3295: Just to add a bit to AJ Henderson correct answer.
You do can compress in a lossless way with h264, this is the lossless predictive profile and is achieved by encoding with a CRF setting of 0.
Though while you get lossless h264 compression that way you will endup with a larger file than your source file.
Lossy compression cant be done twice without loosing more information with each iteration, it already says that that in itself, its "lossy" it looses information every time you encode with it, hence only a lossless encoding will preserve all information and that is the CRF 0 setting (which produces huge files).
What your read as constant quality just means you will have a constant bit-rate and x264 wont alter the bitrate in order to preserve more information in certain frames or use less space where it doesn't need as much space to save the given information in the frame.
That being said, if the encodes you have are of a high quality and there aren't any visible artifacts present, you might be fine with re-compressing it, if disk space is of the most importance here. Though you loose information that might be useful for possibly enhancing aspects of the video in the far future that aren't relevant right now.

6105: <p>According to the documentation for libx264 (h264) encoding, we can use a preset of veryfast, faster, fast, medium, slow, etc.
<a href="https://trac.ffmpeg.org/wiki/Encode/H.264" rel="nofollow">https://trac.ffmpeg.org/wiki/Encode/H.264</a></p>

<blockquote>
  <p>...for constant quality encoding, you will simply save bitrate by
  choosing a slower preset.</p>
</blockquote>

<p>So while using constant quality, a slower preset doesn't have any affect on video quality, but it can compress the file size smaller.</p>

<p>This theoretically means it should be possible to take a video compressed with preset "veryfast", and recompress it with "slow"- resulting in a smaller file with no loss of video quality.</p>

<p>Has anyone ever done this or know how it can be done?</p>
 2836: <p>You have a misunderstanding of how compression works.  In all but a few specialized types of lossy compression, when you compress something a second time, even in a much higher quality level than previous encodings, you still lose additional quality.  </p>

<p>Using a slower encoding from the same original source with constant quality will often produce a smaller file of similar quality, but if you encode the already compressed version over again, you will still always end up with a lower quality video due to second generation quality losses from compressing twice.</p>
 3295: <p>Just to add a bit to AJ Henderson correct answer.
You do can compress in a lossless way with h264, this is the lossless predictive profile and is achieved by encoding with a CRF setting of 0.</p>

<p>Though while you get lossless h264 compression that way you will endup with a larger file than your source file.
Lossy compression cant be done twice without loosing more information with each iteration, it already says that that in itself, its "lossy" it looses information every time you encode with it, hence only a lossless encoding will preserve all information and that is the CRF 0 setting (which produces huge files).</p>

<p>What your read as constant quality just means you will have a constant bit-rate and x264 wont alter the bitrate in order to preserve more information in certain frames or use less space where it doesn't need as much space to save the given information in the frame.</p>

<p>That being said, if the encodes you have are of a high quality and there aren't any visible artifacts present, you might be fine with re-compressing it, if disk space is of the most importance here. Though you loose information that might be useful for possibly enhancing aspects of the video in the far future that aren't relevant right now.</p>
