FFmpeg简介及在vc2010下编译步骤
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
?
總結
以上是生活随笔為你收集整理的FFmpeg简介及在vc2010下编译步骤的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Linux下编辑器vi/vim的使用介绍
- 下一篇: Linux下gdb调试工具的使用