ffmpeg-bit rate, frame rate and file size

Source: Internet
Author: User

Bit rate and frame rate are basic features of audio and video, which play a key role in the overall quality of audio and video. If you know the bit rate and duration, you can calculate the size of the output file.

1.Frame (Frequency) Rate introductionthe frame rate is the number of frames encoded into the video file per second. The human eye needs to be at least 15 frames per second to keep the image coherent. The unit of frame rate is HZ,LCD display generally has a flat rate of 60Hz. There are 2 types of frame rates-interlaced(denoted asiafter FPS number) and progressive(denoted as pafter FPS number)//progressive scan and interlaced
progressive Scan (interlaced) frame rates are generally used in TVs:-ntsc with 60i fps, meaning: interlaced fields (frames) per secondthe-pal and SECAM standard is 50i fps, equal to 25 frames per second.
The interlaced (progressive) frame rate is 24p,25p and 30p, used in the film industry. Now the newer frame rate is 50p/60p for high-end HDTV products.

2. Frame rate Settingusing the-r optionThe syntax is:ffmpeg-i Input -r fps output For example:ffmpeg-i input.avi-r Output.mp4
Use FPS filterAnother set frame rate is used with FPS filter, especially when used in Filterchains

Example: Modify the frame rate of the input file toffmpeg-v clip.mpg-vf fps=fps=25 clip.webm
predefined values for frame rate
Example: Set frame rate 29.97fps


3. Bit rate settingbit rate is also a parameter that determines the overall quality of the audio and video. He decides the number of bits to be processed per time unit.

set bit rate:
The bit rate determines how much bits is required to process the encoded stream of 1s, set with the-B option. Distinguishing audio and video with-b:a and-b:vExample: Set overall 1.5Mbit per secondffmpeg-i file.avi-b 1.5M file.mp4
ffmpeg-i input.avi-b:v 1500K output.mp4
CBR settings:
CBR settings are typically used as live streams, such as video conferencing. To set up a CBR for the output, there are three parameters that must be set to the same value. bitrate (-b option), Minimal rate (-minrate), maximal rate (-maxrate). Maximal rate needs to set the-bufsize option. For example, set CBR to 0.5mbit/s. ffmpeg-i in.avi-b 0.5m-minrate 0.5m-maxrate 0.5m-bufsize 1M output.mkv

sets the maximum size of the output file.
Use the-FS option. For example, set the maximum size of the output file to 10Mffmpeg-i input.avi-fs 10MB output.mp4

File size calculation:
the size of the file is the size of the audio and video stream. The equation for the size of the video stream is (divided by 8 is the transition from bits to bytes):video_size = video_bitrate * TIME_IN_SECONDS/8;If the audio is uncompressed, the calculation formula is:audio_size = smpaling_rate * bit_depth * channels * TIME_IN_SECOND/8;
For example: Calculate 10 minutes of video, 1500kbits/s video bitrate and 128kbits/s audio bitrate, using the following calculation method:file_size = video_size + audio_size;file_size = (video_bitrate + audio_bitrate) * TIME_IN_SECONDS/8;file_size = (kbits/s + 128kbits/s) * 600sfile_size = 1628kbits/s * 600sfile_size = 976800kb = 976800000 B/8 = 122100000 b/1024 = 119238.28125KBfile_size = 119238.28125 kb/1024 = 116.443634033203125MB = 116.44M






ffmpeg-bit rate, frame rate and file size

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.