Render your image first to a set of individual files in a designated directory, in OpenEXR format. Yes, there will be a lot of large files here.
Now, use another Blend file and the VSE to process that entire set of files as an input, to generate the movie-file with whatever specs you may require.
The advantage to this approach is that it is fast and flexible, in terms of generating “just the right” output file. The frames have already been completely generated, and they’ve been stored in a high numeric-resolution, “loss-less” format. You can now do whatever compression and encoding you may require, and you will never actually lose anything. You can also easily restart a render job where it left off if Blender happens to crash in the mi
Of course, do pay attention to how large the frames need to be in order to look good on your final target. The default size is basically “high-def digital TV,” and if you don’t actually need the OpenEXR frames to be that big, you’ll waste a lot of time generating them that big.