How to calculate the size of the output ffmpeg file?

I use ffmpeg to convert home videos to DVD format and want to calculate the size of the output file before performing the conversion.

My input file has a transfer speed of 7700 kbps and is 114 seconds. The audio bitrate is 256 kbps (per second?). The input file is 77 MB. To get this information, I ran:

mplayer -vo null -ao null -frames 0 -identify input.MOD

So, theoretically, the input file should have a (approximately) file size:

((7700/8) * 114) / 1024

That is (7700/8) is kilobytes per second, multiplied by 114 seconds, and then converted to megabytes. This gives me 107 MB, which is beyond the scope of my 77. Thus, I am skeptical about his formula.

However, after converting the video:

 ffmpeg -i input.MOD -y -target ntsc-dvd -sameq -aspect 4:3 output.mpg 

The numbers seem to make more sense. The bitrate is 9000 kbps, and using the above formula, I get 125 MB, and my actual output file size is 126 MB.

So, two questions:

  • How to include audio bitrate in this calculation? Is it additive (video file size + audio file size)?

  • Does DVD always have a speed of 9000 kilobits / s? Is this a DVD definition? Or can this vary depending on the video quality of my input video? What guarantees "-target ntsc-dvd" about my video?

  • Why is my input file not matching the request, but the output file? Is there some other variable that I don't take into account?

What is the correct way to calculate file size?

+4
source share
1 answer

What you should keep in mind is that there are several different bitrate dimensions:

  • maximum bitrate - the bitrate of the most intense action of the video fragment
  • average (target) bit rate - bit rate calculated exactly using the formula

  • speed control (how quickly the encoder responds to changes in video complexity)

Patch video coding works by eliminating features that are hard to see for a person. This means that a slow motion talking head can be compressed further than a rotating full-screen zoom / panorama.

Why does it matter? Standards really determine the "maximum" bitrate for any reason - the player must be so fast to read and decode standardized video. The DVD has about 9000 Kbps.

Finally, since this is lossy compression, you can specify the average bitrate. This is used if you need to match content in a limited space or bandwidth (possibly for buffering more intense fragments).

For example, you can have a video with a maximum bitrate of 7000 kbps and an average bitrate of 5500 kbps. Finally, speed control is an algorithm used to determine how many space encoders need to be assigned to different fragments. If you perform multi-pass encoding, you reuse this information from previous passes - improving the quality and distribution of bitrate.

+3
source

All Articles