

FFmpeg 命令行工具 - 帮助和码率、帧率和文件大小
source link: http://blog.danthought.com/programming/2020/11/14/ffmpeg-tools-help-and-fundamental-characteristics/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

FFmpeg 命令行工具 - 帮助和码率、帧率和文件大小
这篇文章讲解 FFmpeg 命令行工具中如何查看帮助,以及关于码率、帧率和文件大小的概念和用法。

基础帮助和完整帮助
ffmpeg -h
ffmpeg -h full
针对特定主题的帮助,比如编码器
ffmpeg -bsfs
ffmpeg -codecs
ffmpeg -decoders
ffmpeg -encoders
ffmpeg -filters
ffmpeg -formats
ffmpeg -layouts
ffmpeg -L
ffmpeg -pix_fmts
ffmpeg -protocols
ffmpeg -sample_fmts
ffmpeg -version
针对特定条目的帮助,比如 FLV 解码器
ffmpeg -h decoder=flv
码率、帧率和文件大小
帧率是每秒的帧数,决定流畅度,人眼至少需要帧率为 15 才能感知到连续动画。
帧率通过 -r 来指定:
ffmpeg -i input.avi -r 30 output.mp4
码率是每秒的比特数,决定质量。
- Average bit rate, ABR, 平均码率:每秒处理的平均比特数量。
- Constant bit rate, CBR, 固定码率:通常用于流媒体,而不是文件。
- Variable bit rate, VBR, 变化码率:每秒处理的比特数量是变化的,运动画面需要更多的比特数量,静止画面需要较少的比特数量,同样的文件大小,VBR 比 CBR 的画面质量更好,但也需要更多运算时间和运算资源。
码率通过 -b 来指定, -b:a 针对音频,-b:v 针对视频:
ffmpeg -i input.avi -r 30 output.mp4
CBR 设置
-b、-minrate、-maxrate 三项需要设置相同的值,-maxrate 还需要 -bufsize 来控制缓存大小:
ffmpeg -i in.avi -b 0.5M -minrate 0.5M -maxrate 0.5M -bufsize 1M out.mkv
输出文件大小通过 -fs 来指定:
ffmpeg -i input.avi -fs 10MB output.mp4
编码视频的大小计算:
video_size = video_bitrate * time_in_seconds / 8
没有编码音频的大小计算:
audio_size = sampling_rate * bit_depth * channels * time_in_seconds / 8
编码音频的大小计算:
audio_size = bitrate * time_in_seconds / 8
For example to calculate the final size of 10-minutes video clip with the 1500 kbits/s video bit rate and 128 kbits/s audio bitrate, we can use the equations:
file_size = video_size + audio_size
file_size = (video_bitrate + audio_bitrate) * time_in_seconds / 8
file_size = (1500 kbit/s + 128 kbits/s) * 600 s
file_size = 1628 kbit/s * 600 s
file_size = 976800 kb = 976800000 b / 8 = 122100000 B / 1024 = 119238.28125 KB
file_size = 119238.28125 KB / 1024 = 116.443634033203125 MB ≈ 116.44 MB
Recommend
-
18
问与答 - @wuwukai007 - 看 1080+还要大会员,突然发现为什么油管那么受欢迎了
-
25
视频制作 - @HolgerHuo - 今天和一个同学讨论 码率决定品质的问题 具体起因如下 、视频上添加文字。
-
29
FFmpeg 命令行工具 - 基础 作为开发者,使用 FFmpeg 主要分两部分:命令行工具和接口使用,本文讲解如何在 macOS 上编译 FFmpeg,以及 FFmpeg 命令行工具使用的一些基本概念。
-
11
简单准确介绍视频/图像领域的分辨率、帧率、码率之间的关系。<!--more--> Drivers of Quality 传输质量 视频传输质量由分辨率与帧率决定。 Resulution: 分辨率是指一帧图像有多少条水平扫描线,如1080p。分辨率越大,图像...
-
6
ffmpeg 命令行生成工具 ffmpeg 命令行生成工具 一个能帮你自动生成 ffmpeg 命令行参数的工具
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK