工作需要用到ffmpeg来进行Android的软编码,对这玩意儿一点都不了解,做个学习记录先。
FFmpeg:
Fmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It is also highly portable: FFmpeg compiles, runs, and passes our testing infrastructure across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc. under a wide variety of build environments, machine architectures, and configurations.
当前我使用ffmpeg的目的:
- 视频格式转换;
- 视频转码(降低码率或者修改分辨率);
- 视频剪切;
- 视频拼接;
FFmpeg安装步骤:
1.根据自己所需环境下载(这里使用的是OS X);
2.在Mac上大家还可以使用Homebrew下载:
- Homebrew官网: (官网其实写的很明确了,如果还有疑问的朋友可以再看看别的帖子)
- 安装完后使用Homebrew的命令安装ffmpeg:
➜ ~ brew install ffmpeg
3.ffmpeg简单使用方法(常用命令)在官网的Document中都有详细介绍:http://www.ffmpeg.org/ffmpeg.html
$ ffmpeg -i input.mp4 output.avi
例如要将Video进行分辨率的转换:
$ ffmpeg -i input.mp4 -s 1280x720 output.mp4