Install ffmpeg under ubuntu14.04
1. Install various dependencies
1. yasm (libx264 needs to depend on yasm)
sudo apt-get install yasm
2、libx264
sudo apt-get install libx264-dev
3、libfaac
sudo apt-get install libfaac-dev
4、libmp3lame
sudo apt-get install libmp3lame-dev
5、libtheora
sudo apt-get install libtheora-dev
6、libvorbis
sudo apt-get install libvorbis-dev
7、libxvid
sudo apt-get install libxvidcore-dev
8、libxext
sudo apt-get install libxext-dev
9、libxfixes
sudo apt-get install libxfixes-dev
2. Download the FFmpeg installation package
The official website failed to download the latest version of FFmpeg configuration, and finally used FFmpeg 2.4.13 "Fresnel", download URL: http://www.ffmpeg.org/olddownload.html
1. Unzip
tar -xjvf ffmpeg-2.4.13.tar.bz2
2. Configure
cd ffmpeg-2.4.13/
./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab --enable-libvorbis
3. Compile and install
sudo make
sudo make install
4. Copy the ffmpeg executable file generated in the ffmpeg-2.4.13 folder to the /usr/bin/ directory
sudo cp ffmpeg /usr/bin/
3. Operation
运行格式:ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}
1. If you want to convert the yuv file to png, then
ffmpeg -pix_fmt nv12 -s 1280x720 -i srcPic.yuv -y desPic.png
2. If converting .mp4 file to .h264 file
ffmpeg -i aa.mp4 -codec copy -bsf: h264_mp4toannexb -f h264 bb.264
illustrate:
-i aa.mp4: is the input MP4 file
-codec copy: copy from MP4 package
-bsf: h264_mp4toannexb: copy from MP4 to annexB package
-f h264: use h.264 format
bb.264: output file name
Reference: https://blog.csdn.net/leezha/article/details/77849286