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.
Thank you very much for your answer. Like my research, I seem to be stacking up more questions than answers :D. To answer your questions, my primary requirements are quality of video and size of file. I am trying to output a video quality for a 1920x1080 screen and I am sure it will be a lossy compression than lossless. – Vinny – 2015-10-14T12:51:52.667
What are your file size constraints, exactly? Are you streaming over a limited channel or is the screen directly connected to the source? You should be able to do something simple like
ffmpeg -i <input> -c:v libx264 -crf 20 -preset slow output.mp4
. A CRF of 20 means rather high visual quality. The slow preset will ensure better compression, but as the name implies, perform slower during encoding. You can vary the quality with the CRF parameter; lower is better. 18 should already be quite visually lossless. A CRF of +/- 6 gives you roughly half or double the file size. – slhck – 2015-10-14T14:38:36.860