0. Preface
It is said that the new h265 video, in the Thunder see above, the online view of the introduction, seemingly h265 video than H264 video compression rate is high, and can do 4K video.
At the same time see online someone tried ffmpeg in the compile time with the h265, so ffmpeg seems to be able to plug h265 codec, so this blog text, mainly with FFmpeg to try h265.
Here are some pictures of x265 's introduction (Of course, my own monitor is also 4k):
1, first download FFmpeg source code
Currently the latest version is 2.2.4
Download Portal: http://www.ffmpeg.org/releases/ffmpeg-2.2.4.tar.gz
2, assuming that the MinGW has been configuredMy system is win7, online configuration MinGW article is still quite a lot of
3, compile x264 (FFmpeg also need to plug H264 codec)Come here to download: http://www.videolan.org/developers/x264.html
Extract it, use MinGW to enter the source code directory
Execution:./configure--prefix=/x264--enable-shared--enable-static
Make
Make install
At this time, a x264 folder will appear below the C:\MinGW\msys\1.0, which is the required library.
4, compile x265 (this is the main need)x265 source code is cloned in the form of Hg (and git-like source code manager)
Because the source code is compiled using CMake, it is also necessary to configure the CMake environment, only need to download a green version of the CMake, and then fill in the system environment variables to Cmake.exe, so the following steps are assumed to have been configured CMake
So first, use MinGW to enter the Msys folder in the x265 source directory:
cdx265/build/msys/
Execute SH make-makefiles.sh
This opens the CMake configuration interface.
Because it has been configured, if the first configuration (out of the configuration installation path), but also need to find Yasm.exe to support the assembly (this need to download separately, the web is also a lot of download places)
Then click Configure----Generate
So the configuration file is created, turn off CMake (upper right corner off), then return to MinGW
Make
Make install
This generates the x265 DLL in C:\x265_libs.
5. Configuration to be done before generating ffmpeg
Put the above generated x264 folder:
X265 of the generated folder:
Copy one and put it in the root directory of the MinGW:
6. Compiling ffmpegMinGW into the source code directory, execute:
./configure--enable-yasm--prefix=/ffmpeg--disable-debug--disable-static \
--ENABLE-SHARED--ENABLE-GPL--enable-libx265--enable-libx264
That means it's been configured successfully.
Make
Make install
7. Test using FFmpeg compressed video
The environment used for testing is a virtual machine, so we can see what DLLs we are missing when we run the EXE.
Put the Bin folder Ffmpeg.exe in the virtual machine run, and finally found that in addition to the bin inside the DLL, but also need to use the MinGW in the Libgcc_s_dw2-1.dll, Libiconv-2.dll ( Can be obtained by searching the MinGW root directory)
Also need x265 and x264 DLLs, in both of these source code works, the search gets
Then use the command to compress a video to see the difference between x264 and x265.
A, ffmpeg-i 1.mp4-acodec copy-vcodec libx264-f mp4 h264.mp4
B, Ffmpeg-i 1.mp4-acodec copy-vcodeclibx265-f mp4 h265.mp4
You can see the size comparison of these two files (compression speed, here x264 faster):
In fact, is still relatively good, compression, for larger video, to save a lot of space to occupy.