Is there a formula that exists to estimate, the final data size that can be achieved?
No. The size largely depends on the encoding settings you choose, that is, the rate control mode, the average bitrate or average quality, the framerate, the tradeoff between compression efficiency and speed, the specific encoder, etc.
Of course, if you have a trivial constant bitrate encoding process, then the output file size is easy to calculate. But in most cases you'd rather not want to force a fixed bitrate.
For the video I am trying to estimate the size of the video and the encoding format I should use to produce a 1080p video quality?
1080p just refers to a resolution of 1080 pixels vertically. There is no inherent "quality" attached to these dimensions. When you talk about quality you'd generally categorize it as:
- lossless (mathematically lossless)
- visually lossless (differences between original and encoded version not visible to the human eye)
- lossy
When choosing a lossless codec like raw YUV, FFV1 or HuffYUV, your only worry is file size. When choosing a visually lossless codec like ProRes or DNxHD, you may still run into high file sizes that are unsuitable for online streaming.
For the lossy part, you should think about what your requirements are. Is fast encoding more important than low file size? Are you worried about compression artifacts or should the video be streamed through the web and therefore be compressed? Are you planning to just archive the stream to watch it later?
Depending on the answer to the above questions, you may prefer a single-pass fast encoding preset with low and constrained bitrate to enable web streaming. Or you maybe want a two-pass slow encoding preset with a constant quality mode (e.g., CRF in x264), if you care about fidelity but still want a rather small size.
And how to estimate the time it would take to encode the video?
This depends on your CPU capabilities, the pixel dimensions and frame rate of the video, its spatiotemporal complexity and the encoder options. With libx264
, for example, you have various presets to choose from. See the FFmpeg H.264 encoding guide for some tips.