Given the length of a video, how do I calculate how much how much space it will take after conversion?

StackOverflow https://stackoverflow.com/questions/16636786

سؤال

OK so I am making a video converter and whenever user inputs a video, I want to be able to tell the user how much space on the disc it is going to take after conversion.

I am using Xuggler for the conversion task which is a wrapper around ffmpeg. It lets me access the the total length of the video in milliseconds as a long value.

Based on this, how can I calculate the size of the output video that will be generated ?

هل كانت مفيدة؟

المحلول

That's a tricky thing. Because any conversion involves doing a decode and encode. And if you observe any encoding algorithm, it uses transforms and many other steps, which give different o/p for different input streams. In plain words, the size depends on the complexity of raw video, so its not possible to predict the size effectively.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top