FFmpeg是一个开源的多媒体库,最新版本是2.4.3,它的License是LGPL或GPL。FFmpeg可以用来记录、转换数字音频、视频,并能将其转换为流的开源计算机程序。它包括了音/视频编码库libavcodec。FFmpeg是在Linux下开发出来的,但它可以在包括Windows在内的大多数操作系统中编译。它可以轻易地实现多种视频格式之间的相互转换。

FFmpeg用vs2010编译步骤:

1.  从https://www.ffmpeg.org/download.html下载最新版本2.4.3,将其解压缩到E:\FFmpeg\ffmpeg-2.4.3下;

2.   从http://sourceforge.net/projects/mingw/files/下载mingw-get-setup.exe 并仿照http://blog.csdn.net/fengbingchun/article/details/7335741中步骤进行安装,除选择安装MinGW外,还需选择安装MSYS;并将C:\MinGW\bin和C:\MinGW\msys\1.0\bin加入到系统环境变量PATH中;

3.  从https://github.com/libav/c99-to-c89/releases 下载c99-to-c89-1.0.2.zip,解压缩,并将c99conv.exe和c99warp.exe复制到C:\MinGW\msys\1.0\bin目录下;

4.  从http://code.google.com/p/msinttypes/downloads/list下载c99头文件inttypes.h和stdint.h(msinttypes),并将其复制到C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include 目录下;

5.  从http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=5&t=1683下载pkg-config-0.23,解压缩,并将pkg-config.exe复制到C:\MinGW\msys\1.0\bin目录下,有时还需下载intl.dll等库,将其复制到pkg-config.exe同一目录下;

6.  从http://yasm.tortall.net/Download.html下载win32VS2010.zip(或Win32.exe),解压缩,并将vsyasm.exe改名为yasm.exe复制到C:\MinGW\msys\1.0\bin目录下;

7.  将其msys.bat改名为msys_vs2010.bat,并在msys_vs2010.bat文件的开头加入call"C:\Program Files (x86)\Microsoft Visual Studio10.0\VC\bin\vcvars32.bat" ;

8.  重命名C:\MinGW\msys\1.0\bin下link.exe为link_msys.exe,这是为了防止此link.exe与vc2010中的link.exe发生冲突,编译完ffmpeg后需要再次修改回来;

9.  双击运行msys_vs2010.bat,使用cd命令将其定位到E:\FFmpeg\ffmpeg-2.4.3;接着依次输入命令:./configure  --enable-shared –disable-static –prefix=./build_vs2010  --toolchain=msvc  >log.txt;  make;   make install;

10.             执行以上命令后会在E:\FFmpeg\ffmpeg-2.4.3目录下生成一个vs2010_dll文件夹,此文件夹下包括bin、include、lib、share四个文件,这是动态库,若要生成debug的静态库,则相应命令为./configure  --enable-static –enable-debug--prefix=./vs2010_lib_debug        --toolchain=msvc  >log.txt;更多其它选项可查看configure文件.

 

以下对上面生成的各个库进行简单的说明,摘自https://www.ffmpeg.org/documentation.html

1.      libavutil:The libavutillibrary is a utility library to aid portable multimedia programming. Itcontains safe portable string functions, random number generators, data structures,additional mathematics functions, cryptography and multimedia relatedfunctionality (like enumerations for pixel and sample formats). It is not alibrary for code needed by both libavcodec and libavformat.

2.      libswscale: The libswscalelibrary performs highly optimized image scaling and colorspace and pixel formatconversion operations. Specifically, this library performs the followingconversions:(1).Rescaling: is the process of changing the video size. Severalrescaling options and algorithms are available. This is usually a lossyprocess.(2).Pixel format conversion: is the process of converting the imageformat and colorspace of the image, for example from planar YUV420P to RGB24packed. It also handles packing conversion, that is converts from packed layout(all pixels belonging to distinct planes interleaved in the same buffer), toplanar layout (all samples belonging to the same plane stored in a dedicatedbuffer or "plane").This is usually a lossy process in case the sourceand destination colorspaces differ.

3.      libswresample: The libswresamplelibrary performs highly optimized audio resampling, rematrixing and sampleformat conversion operations.Specifically, this library performs the followingconversions:(1).Resampling: is the process of changing the audio rate, forexample from a high sample rate of 44100Hz to 8000Hz. Audio conversion fromhigh to low sample rate is a lossy process. Several resampling options andalgorithms are available.(2).Format conversion: is the process of convertingthe type of samples, for example from 16-bit signed samples to unsigned 8-bitor float samples. It also handles packing conversion, when passing from packedlayout (all samples belonging to distinct channels interleaved in the samebuffer), to planar layout (all samples belonging to the same channel stored ina dedicated buffer or "plane").(3).Rematrixing: is the process ofchanging the channel layout, for example from stereo to mono. When the inputchannels cannot be mapped to the output streams, the process is lossy, since itinvolves different gain factors and mixing. Various other audio conversions(e.g. stretching and padding) are enabled through dedicated options.

4.      libavcodec: The libavcodeclibrary provides a generic encoding/decoding framework and contains multipledecoders and encoders for audio, video and subtitle streams, and severalbitstream filters.The shared architecture provides various services rangingfrom bit stream I/O to DSP optimizations, and makes it suitable forimplementing robust and fast codecs as well as for experimentation.

5.      libavformat: The libavformatlibrary provides a generic framework for multiplexing and demultiplexing(muxing and demuxing) audio, video and subtitle streams. It encompassesmultiple muxers and demuxers for multimedia container formats.It also supportsseveral input and output protocols to access a media resource.

6.      libavdevice: The libavdevicelibrary provides a generic framework for grabbing from and rendering to manycommon multimedia input/output devices, and supports several input and outputdevices, including Video4Linux2, VfW, DShow, and ALSA.

7.      libavfilter: The libavfilterlibrary provides a generic audio/video filtering framework containing severalfilters, sources and sinks.

 

参考文献:

1.      https://www.ffmpeg.org/platform.html

2.      http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=5&t=1683

3.      http://www.cnblogs.com/xylc/p/3683203.html

4.      http://blog.csdn.net/heng615975867/article/details/21601617

 

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐