Search code examples
videoffmpegfilesizesimulate

ffmpeg - Extract Video filesize from virtual data


I am trying to calculate a video filesize from its data using FFMPEG.

Assuming that I have the following data in my disposal :

  • vcodec => mp4a.40.2
  • acodec => avc1.64001F
  • format_note => hd720
  • height => 720
  • width => 1280
  • ext => mp4
  • duration => 56 (seconds)

Questions :

  1. Is there any mathematical formula that can extract the video filesize using the data above
  2. Is it possible to simulate and extract the filesize of a non-existing file using the data above
  3. If FFMPEG cannot accomplish what Im asking, what do you suggest ?

Please let me know if you need any additional information.

Thanks for your help.


Solution

  • To calculate the filesize of a video you to know the bitrate and the video length, bitrate is usually in kb/s so you need to multiply that value for the amount of seconds in the video.

    If your video contains audio, you should also consider it for the filesize using the same approach.

    If you don't know the bitrate you are going to use for encoding, you should check the encoder you are going to use and check for it's default values. But the most secure way is to define your own bitrate and make sure the size will be what you expect.