Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 15th September 2015, 14:02   #1  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,308
[GUIDE] x264 Build Tutorial

If moderators find this usefull enough, they can stick it.

Sorry in advance for the english mystakes, my english is not excellent.

There was a tutorial on doom10 once, but as doom10 doesn't exist anymore, it's gone. It was from it i've learned my first steps.
So, after a long struggle and gathering of informations, i've finaly been able to get a working process, to compile x264.

I've first severals peoples to thanks, without them, i wouldn't been able to succed.
First komisar, who have been a great help.
Have also been a great help, and give me others basis, the L-SMASH Works tutorial of Bruno Rex here.
Thanks also to MasterNobody, LoRd_MuldeR and others i may forget.

Now, begin the step by stop tutorial, begining form scratch. It's a Windows tutorial, but probably a lot of things can be used outside Windows.

Last edited by jpsdr; 23rd September 2015 at 07:23.
jpsdr is offline   Reply With Quote
Old 15th September 2015, 14:04   #2  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,308
GIT

You'll need at least git, and tortoise git can also be a great help.
You can get GIT here.
And tortoise git here.

I'll not explain how to use GIT (can't explain everything), but a quick search will allow you to know how to clone a repository, and pull regularly, that would be enough.
jpsdr is offline   Reply With Quote
Old 15th September 2015, 14:06   #3  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,308
PART 1 : Building using MSYS2

Install of MSYS2

First, you have to install msys2, get the version you want (x86 and/or x64) here.
Once installed, if leave to default, the installation directory will be C:\msys32 or C:\msys64, according you've installed the x86 or x64 version (or both).
Whatever it is, i'll call it from now "msys2 dir".
You'll also have 3 icons in "MSYS2 32bit" (or "MSYS2 64bit") menu. The msys2 shell, one mingw32 shell to build for x86 and one mingw64 shell to build for x64.

You have to install the necessary packages to be able to build things.
Start the msys2 shell, and inside use the following commands :

Code:
pacman -Sy
pacman -S --needed make autoconf autogen diffutils git p7zip patch perl python2 ruby subversion yasm wget mingw-w64-i686-gcc mingw-w64-i686-gettext mingw-w64-i686-crt-git mingw-w64-i686-libtool mingw-w64-i686-libjpeg-turbo mingw-w64-i686-libpng mingw-w64-i686-libxml2 mingw-w64-i686-tools-git mingw-w64-i686-glib2 pkg-config mingw-w64-i686-cmake nasm
pacman -S --needed mingw-w64-x86_64-gcc mingw-w64-x86_64-gettext mingw-w64-x86_64-crt-git mingw-w64-x86_64-libtool mingw-w64-x86_64-libjpeg-turbo mingw-w64-x86_64-libpng mingw-w64-x86_64-libxml2 mingw-w64-x86_64-tools-git mingw-w64-x86_64-glib2 mingw-w64-x86_64-cmake
Close the shell with "exit".
Now, tools have been installed, now you should proceed with the update process, to be sure to have everything up to date.

Note : If you've installed both the x86 and x64 version of msys2, you have to do this for both versions.

Last edited by jpsdr; 2nd April 2017 at 10:12.
jpsdr is offline   Reply With Quote
Old 15th September 2015, 14:07   #4  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,308
Updates of MSYS2

msys2 is actualy active and frequenlty updated, so, it should be regularly updated.

We will first update the core.
Start the "msys2 shell", and inside use the following commands :

Code:
pacman -Sy
pacman --needed -S bash pacman pacman-mirrors msys2-runtime
Note : If your version of MSYS2 is recent enough (but not too much), for updating the core, you can use instead just the following command :
Code:
update-core
Close the window shell with [X], not with exit.

Note : If your version of MSYS2 is even more recent, update-core is not working anymore. You have to do :
Code:
pacman -Syuu
and follow the instructions.


Now, go in the "msys2 dir" and launch (double click on it) the autorebase.bat file.
Once finished, restart again the "msys2 shell", and finish the update with the following command :

Code:
pacman -Su
Close with exit, and autorebase again.
Update is now finished.

Note : Again, if you've installed both x86 and x64 versions of msys2, you have to do this for both versions.

Last edited by jpsdr; 1st April 2016 at 12:52.
jpsdr is offline   Reply With Quote
Old 15th September 2015, 14:11   #5  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,308
GIT install of programs

We will install all the necessery programs in one directory, you can of course do what you want, but for this tutorial, i'll follow this guideline.

Create a "C:\x264_Prg\" directory.

Inside "C:\x264_Prg\" create a "ffmpeg-stable" subdirectory, get the last stable version here and decompress and put it inside.
In "ffmpeg-stable" directory create a "Build_x264" subdirectory.

Inside "C:\x264_Prg\" Clone git l-smash from here.
In "l-smash" directory create a "Build_x264" subdirectory.

Inside "C:\x264_Prg\" Clone git ffms2 from here.
In "ffms2" directory create a "Build_x264" subdirectory.

Inside "C:\x264_Prg\" Clone git x264 from here or... you can clone git from my github here (at you own risk ) to have t_mod version. There is also several different versions made by others people, (k_mod, nak5124, 7mod, etc...), choose the one you want.

Now, that everything is installed, we will compile ffmpeg and others libs to create the libpack for building the several x264 versions.

Last edited by jpsdr; 17th February 2016 at 14:42.
jpsdr is offline   Reply With Quote
Old 15th September 2015, 14:12   #6  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,308
FFMPEG

In "C:\x264_Prg\" create a file named Build_ffmpeg_x264.sh.

Put the following inside :

Code:
cd ./ffmpeg-stable/Build_x264
_dir="/local-x264"
[[ "$1" = "32" ]] && _dir="${_dir}_x86"
[[ "$1" = "64" ]] && _dir="${_dir}_x64"
[[ "$2" = "posix" ]] && _dir="${_dir}/posix"
[[ "$2" = "win32" ]] && _dir="${_dir}/Win32threads"
[[ "$3" = "original" ]] && _dir="${_dir}/Original"
[[ "$3" = "tmod" ]] && _dir="${_dir}/t_mod"
[[ "$3" = "jpsdr" ]] && _dir="${_dir}/jpsdr"
_arch="x86"
_cf="-mfpmath=sse -march=pentium3 -msse -mtune=pentium3"
_ld="-static"
_threads="--enable-pthreads --disable-w32threads"
_cpu="--cpu=pentium3"
_extra="--enable-avresample --disable-hwaccels --disable-network --disable-bsfs --disable-indevs --disable-outdevs --disable-devices --disable-avdevice --disable-d3d11va"
[[ "$3" = "tmod" ]] && _extra="${_extra} --enable-protocol=file --enable-swscale --enable-version3 --enable-nonfree"
[[ "$3" = "tmod" ]] && _extra="${_extra} --disable-decoder=alac,amrnb,amrwb,ape,ass,atrac1,atrac3,atrac3p,ccaption,mpc7,mpc8,mpl2,msmpeg4_crystalhd,nellymoser,opus,paf_audio,comfortnoise,cook,dsd_*,dsicinaudio,dvbsub,dvdsub,evrc,g723_1,g729,pgssub,pictor,pjs,qcelp,qdm2,ra_144,ra_288,ralf,realtext,roq_dpcm,sami,shorten,sipr,smackaud,sol_dpcm,sonic,srt,ssa,stl,subrip,subviewer,subviewer1,tak,text,gsm,gsm_ms,iac,idf,imc,interplay_dpcm,jacosub,lib*,mace3,mace6,metasound,microdvd,movtext,truespeech,tta,twinvq,vc1_crystalhd,vc1_vdpau,ws_snd1,xan_dpcm,xbin,xsub"
[[ "$3" = "jpsdr" ]] && _extra="${_extra} --enable-protocol=file --enable-swscale --enable-version3 --enable-nonfree"
[[ "$3" = "jpsdr" ]] && _extra="${_extra} --disable-decoder=alac,amrnb,amrwb,ape,ass,atrac1,atrac3,atrac3p,ccaption,mpc7,mpc8,mpl2,msmpeg4_crystalhd,nellymoser,opus,paf_audio,comfortnoise,cook,dsd_*,dsicinaudio,dvbsub,dvdsub,evrc,g723_1,g729,pgssub,pictor,pjs,qcelp,qdm2,ra_144,ra_288,ralf,realtext,roq_dpcm,sami,shorten,sipr,smackaud,sol_dpcm,sonic,srt,ssa,stl,subrip,subviewer,subviewer1,tak,text,gsm,gsm_ms,iac,idf,imc,interplay_dpcm,jacosub,lib*,mace3,mace6,metasound,microdvd,movtext,truespeech,tta,twinvq,vc1_crystalhd,vc1_vdpau,ws_snd1,xan_dpcm,xbin,xsub"
[[ "$3" = "original" ]] && _extra="${_extra} --disable-protocols --enable-protocol=file"
[[ "$3" = "original" ]] && _extra="${_extra} --disable-muxers --enable-muxer=avi,rawvideo,yuv4mpegpipe"
[[ "$3" = "original" ]] && _extra="${_extra} --disable-encoders --disable-filters"
[[ "$3" = "original" ]] && _extra="${_extra} --disable-parser=aac,aac_latm,ac3,cook,dca,dvbsub,dvd_nav,dvdsub,flac,gsm,mlp,mpegaudio,opus,tak,vorbis"
[[ "$3" = "original" ]] && _extra="${_extra} --disable-demuxer=aac,ac3,act,adf,adp,adx,aea,afc,aiff,amr,apc,ape,aqtitle,ass,ast,au,avr,bintext,bit,boa,brstm,caf,concat,daud,dsf,dts,dtshd,ea_cdata,eac3,epaf,ffmetadata,flac,g722,g723_1,g729,gsm,srt,stl,subviewer,subviewer1,sup,tak,tedcaptions,truehd,idf,ilbc,ircam,iss,jacosub,latm,libgme,libquvi,live_flv,loas,lrc,microdvd,mlp,mmf,mp3,mpc,mpc8,mpl2,mpsub,tta,txd,vobsub,voc,vplayer,vqf,w64,wav,msnwc_tcp,nistsphere,ogg,oma,pcm_*,pjs,pvf,qcp,realtext,redspark,rsd,rso,rtp,rtsp,sami,sap,sbg,sdp,shorten,sln,sol,sox,spdif,webm_dash_manifest,webvtt,wsaud,wv,xa,xwma"
[[ "$3" = "original" ]] && _extra="${_extra} --disable-decoder=aac,aac_latm,ac3,ac3_fixed,adpcm_*,alac,amrnb,amrwb,ape,ass,atrac1,atrac3,atrac3p,ccaption,mp3,mp3adu,mp3adufloat,mp3float,mp3on4,mp3on4float,mpc7,mpc8,mpeg1_vdpau,mpeg2_crystalhd,mpeg4_crystalhd,mpeg4_vdpau,mpeg_vdpau,mpeg_xvmc,mpl2,msmpeg4_crystalhd,nellymoser,opus,paf_audio,pcm_*,binkaudio_*,bmv_audio,comfortnoise,cook,dca,dsd_*,dsicinaudio,dvbsub,dvdsub,eac3,evrc,ffwavesynth,flac,g723_1,g729,pcm_*,pgssub,pictor,pjs,qcelp,qdm2,ra_144,ra_288,ralf,realtext,roq_dpcm,sami,shorten,sipr,smackaud,sol_dpcm,sonic,srt,ssa,stl,subrip,subviewer,subviewer1,tak,text,gsm,gsm_ms,h264_crystalhd,h264_vda,h264_vdpau,iac,idf,imc,interplay_dpcm,jacosub,lib*,mace3,mace6,metasound,microdvd,mlp,movtext,mp1,mp1float,mp2,mp2float,truehd,truespeech,tta,twinvq,vc1_crystalhd,vc1_vdpau,vmdaudio,vorbis,vplayer,wavpack,webvtt,wma*,wmv3_crystalhd,wmv3_vdpau,ws_snd1,xan_dpcm,xbin,xsub"
[[ "$1" = "64" ]] && _arch="${_arch}_64"
[[ "$3" = "original" ]] && _cf="${_cf} -U__STRICT_ANSI__"
[[ "$3" = "jpsdr" ]] && _cf=""
[[ "$1" = "64" ]] && _cf="-m64"
[[ "$3" = "jpsdr" ]] && _cf="${_cf} -mfpmath=sse -march=haswell -mavx -mavx2 -mtune=haswell"
[[ "$1" = "64" ]] && _ld="${_ld} -m64"
[[ "$2" = "win32" ]] && _threads="--disable-pthreads --enable-w32threads"
[[ "$1" = "64" ]] && _cpu=""
[[ "$3" = "jpsdr" ]] && _cpu="--cpu=haswell"
../configure --prefix=${_dir} --target-os=mingw32 --arch=${_arch} \
--extra-cflags="${_cf}" --extra-ldflags="${_ld}" \
--enable-static --disable-shared ${_threads} --enable-gpl \
--disable-debug --disable-programs --disable-doc \
${_extra} \
--enable-runtime-cpudetect --enable-memalign-hack --enable-postproc ${_cpu}
make -j1
make install
make clean
If you want to compile for x86, in msys2, start the mingw32 shell. If you want to compile for x64, start the mingw64 shell.
Warning : It seems for ffmpeg that to compile for x64, you have to be under an x64 OS.

In the mingw shell you have opened, go into the "C:\x264_Prg\" directory with the following command :

Code:
cd c:/x264_Prg
Now, you can launch the building script with the following command :
Code:
./Build_ffmpeg_x264.sh param1 param2 param3
Values of parameters are :
param1 : 32 or 64 : You will set if you target x86 or x64. You must nevertheless have launched the proper mingw shell.
param2 : posix or win32 : You will set if you will compile using posix or win32 threads.
param3 : original, tmod or jpsdr (well... this is the script i'm using... ).
- original : You'll build the libraries for original version, don't need to much extra, will just be a little smaller.
- tmod : You'll build the libraries for tmod and others versions, add a little more stuff.
- jpsdr : Identical to tmod, but compile targeting haswell cpu and use of avx/avx2 instructions. Not checked, but probably works only of you have an haswell on the PC you compile with.

Build all the versions you need, and be patient...

Now, we'll build l-smash.

Last edited by jpsdr; 18th January 2016 at 20:53.
jpsdr is offline   Reply With Quote
Old 15th September 2015, 16:57   #7  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,308
l-smash

Warning : If you want to build the t_mod version of x264, you have to create a branch (with GIT, for exemple a branch named "x264_build") and apply the patch described here.

Before building, don't forget to git pull to get up to date version, and fecth&rebase if you've created a "x264_build" branch.

In "C:\x264_Prg\" create a file named Build_lsmash_x264.sh.

Put the following inside :

Code:
cd ./l-smash/Build_x264
_dir="/local-x264"
[[ "$1" = "32" ]] && _dir="${_dir}_x86"
[[ "$1" = "64" ]] && _dir="${_dir}_x64"
[[ "$2" = "posix" ]] && _dir="${_dir}/posix"
[[ "$2" = "win32" ]] && _dir="${_dir}/Win32threads"
[[ "$3" = "original" ]] && _dir="${_dir}/Original"
[[ "$3" = "tmod" ]] && _dir="${_dir}/t_mod"
[[ "$3" = "jpsdr" ]] && _dir="${_dir}/jpsdr"
_ld="-static"
_cf=""
[[ "$3" = "jpsdr" ]] && _cf="-march=haswell -mavx -mavx2 -mtune=haswell"
[[ "$1" = "64" ]] && _ld="${_ld} -m64"
[[ "$1" = "64" ]] && _cf="${_cf} -m64"
PKG_CONFIG_PATH="${_dir}/lib/pkgconfig" \
../configure --prefix=${_dir} --extra-ldflags="${_ld}" --extra-cflags="${_cf}"
make -j1 lib
make install
make clean
Launch the building script with the following command :
Code:
./Build_lsmash_x264.sh param1 param2 param3
Parameters are the same than for ffmpeg.

Build all the versions you need, and... this time it'll be a lot faster.

Now, we'll build ffms2.

Last edited by jpsdr; 1st November 2015 at 10:15.
jpsdr is offline   Reply With Quote
Old 15th September 2015, 16:59   #8  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,308
ffms2

For ffms2, you need to make a little patch to use it with x264.
Create a git branch called "x264_build", and make the following change in include\ffms.h, replace :
Code:
// And now for some symbol hide-and-seek...
#if defined(_WIN32) // MSVC
#	if defined(FFMS_EXPORTS) // building the FFMS2 library itself, with visible API symbols
#		define FFMS_API(ret) FFMS_EXTERN_C __declspec(dllexport) ret FFMS_CC
with
Code:
// And now for some symbol hide-and-seek...
#if defined(_MSC_VER) // MSVC
#	if defined(FFMS_EXPORTS) // building the FFMS2 library itself, with visible API symbols
#		define FFMS_API(ret) FFMS_EXTERN_C __declspec(dllexport) ret FFMS_CC
You just have to change _WIN32 by _MSC_VER.

Commit, and now you have your own branch ready for x264 use.

Before building, don't forget to git pull to get up to date version, and fecth&rebase.

In "C:\x264_Prg\" create a file named Build_ffms2_x264.sh.
Put the following inside :
Code:
cd ./ffms2/Build_x264
_dir="/local-x264"
[[ "$1" = "32" ]] && _dir="${_dir}_x86"
[[ "$1" = "64" ]] && _dir="${_dir}_x64"
[[ "$2" = "posix" ]] && _dir="${_dir}/posix"
[[ "$2" = "win32" ]] && _dir="${_dir}/Win32threads"
[[ "$3" = "original" ]] && _dir="${_dir}/Original"
[[ "$3" = "tmod" ]] && _dir="${_dir}/t_mod"
[[ "$3" = "jpsdr" ]] && _dir="${_dir}/jpsdr"
_lav_l="-L${_dir}/lib -lswscale -lavformat -lavcodec -lavutil -lm -lbz2 -lz -lpsapi -ladvapi32 -lshell32"
_lav_c="-I${_dir}/include"
_av_l="-L${_dir}/lib -lavresample -lavutil -lm"
_av_c="-I${_dir}/include"
[[ "$2" = "posix" ]] && _lav_l="${_lav_l} -pthread"
[[ "$3" = "tmod" ]] && _lav_l="${_lav_l} -lavresample -lswresample -lavfilter -lpostproc"
[[ "$3" = "jpsdr" ]] && _lav_l="${_lav_l} -lavresample -lswresample -lavfilter -lpostproc"
[[ "$3" = "original" ]] && _av_l=""
[[ "$3" = "original" ]] && _av_c=""
_cf="-Wno-deprecated-declarations"
_cxx="-Wno-deprecated-declarations"
_ld="-static"
[[ "$3" = "jpsdr" ]] && _cf="${_cf} -march=haswell -mavx -mavx2 -mtune=haswell"
[[ "$3" = "jpsdr" ]] && _cxx="${_cxx} -march=haswell -mavx -mavx2 -mtune=haswell"
[[ "$1" = "64" ]] && _cf="${_cf} -m64"
[[ "$1" = "64" ]] && _cxx="${_cxx} -m64"
[[ "$1" = "64" ]] && _ld="${_ld} -m64"
_host="i686-w64-mingw32"
[[ "$1" = "64" ]] && _host="x86_64-w64-mingw32"
PKG_CONFIG_PATH="${_dir}/lib/pkgconfig" \
CFLAGS="${_cf}" \
CXXFLAGS="${_cxx}" \
LDFLAGS="${_ld}" \
../configure --prefix=${_dir} --build="i686-w64-mingw32" --host=${_host} \
--enable-static --disable-shared
make -j1
make install
make clean
Launch the building script with the following command :
Code:
./Build_ffms2_x264.sh param1 param2 param3
Parameters are the same than for ffmpeg.

Build all the versions you need, and... this time it'll be also faster.

Now, we are finaly ready for the final chapter of this first part, building x264.

Last edited by jpsdr; 24th September 2015 at 11:51.
jpsdr is offline   Reply With Quote
Old 16th September 2015, 12:32   #9  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,308
x264

After the long road, we finaly reach the final destination.

Before building, don't forget to git pull to get up to date version, and fecth&rebase if necessary.

In "C:\x264_Prg\x264" (or any name you put your x264 git cloned files) create a file named Build_x264.sh.

Put the following inside :
Code:
_dir="/local-x264"
[[ "$1" = "32" ]] && _dir="${_dir}_x86"
[[ "$1" = "64" ]] && _dir="${_dir}_x64"
[[ "$2" = "posix" ]] && _dir="${_dir}/posix"
[[ "$2" = "win32" ]] && _dir="${_dir}/Win32threads"
[[ "$3" = "original" ]] && _dir="${_dir}/Original"
[[ "$3" = "tmod" ]] && _dir="${_dir}/t_mod"
[[ "$3" = "jpsdr" ]] && _dir="${_dir}/jpsdr"
_cf=""
_ld="-static"
_extra="--disable-opencl --enable-static --enable-strip"
[[ "$3" = "jpsdr" ]] && _cf="${_cf} -march=haswell -mavx -mavx2 -mtune=haswell"
[[ "$1" = "64" ]] && _extra="${_extra} --host=x86_64-w64-mingw32"
[[ "$2" = "posix" ]] && _extra="${_extra} --disable-win32thread"
[[ "$4" = "10" ]] && _extra="${_extra} --bit-depth=10"
[[ "$3" = "tmod" ]] && _extra="${_extra} --enable-nonfree"
[[ "$3" = "jpsdr" ]] && _extra="${_extra} --enable-nonfree"
PKG_CONFIG_PATH="${_dir}/lib/pkgconfig" \
./configure --extra-cflags="${_cf}" --extra-ldflags="${_ld}" ${_extra}
make
You can change the make by :
Code:
make fprofiled VIDS="[your video path file]"
if you want.

In the mingw shell, change directory for the one you have x264 in :
Code:
cd x264
(this if you've name the subdirectory x264).
And then, launch the building script with the following command :
Code:
./Build_x264.sh param1 param2 param3 param4
Parameters param1 to param3 are the same than for ffmpeg.
param4 : 8 or 10 : You will set the bit depth you want to create.

Now, if you've for exemple compiled everything with the following parameters : 32 win32 tmod, when using the following command on the t_mod version :
Code:
./Build_x264.sh 32 win32 tmod 8
you should have :
Code:
platform:      X86
byte order:    little-endian
system:        WINDOWS
cli:           yes
libx264:       internal
shared:        no
static:        yes
asm:           yes
interlaced:    yes
avs:           avisynth
lavf:          yes
ffms:          yes
avi output:    yes
audio:         yes (raw, lavc)
mp4:           lsmash
gpl:           yes
nonfree:       yes
thread:        win32
opencl:        no
filters:       resize crop select_every hqdn3d pad vflip subtitles yadif
debug:         no
gprof:         no
strip:         yes
LTO:           no
PIC:           no
bit depth:     8
chroma format: all
This ends the first part.

Last edited by jpsdr; 18th January 2016 at 16:45.
jpsdr is offline   Reply With Quote
Old 16th September 2015, 12:35   #10  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,308
PART 2 : Using MSYS and komisar's builds

This will describe a different way to build x264, it was basicaly the way described in the doom10 tutorial, and it's the way i've begun with, and used during a long time. You can use both method on the same PC.

Install of MinGW

Create the following directory : "C:\MinGW"

Get one gcc version here.

Unpack it inside the "C:\MinGW" directory.

Get the last win32 yasm version here (actualy when i'm writing this it's the yasm-1.3.0-win32.exe). Rename the file in yasm.exe and put it in "C:\MinGW\bin".

Last edited by jpsdr; 9th October 2015 at 10:43.
jpsdr is offline   Reply With Quote
Old 16th September 2015, 13:57   #11  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,308
Install of MSYS

Note : This can be installed even with MSYS2 is installed, they are in different directories, and don't interfer with each others, unless you force things to mess up on purpose !

First, get MSYS-1.0.11.exe here and install it. When prompted for the mingw location, enter the directory where you've put komisar's gcc build (it should be "C:/MinGW" if you haven't changed the default of this tutorial).

Possible stop point
It could be enough if you just want to compile x264, and use the packlibs of komisar for ffmpeg and all. It was what i've done during a long time. But, you're bound to komisar's builds of libpack, which is largely enough for standard x264, but not for t_mod version for exemple.
Don't misunderstand me, komisar is doing great job providing what is providing, i'm just saying that if you want more, learn how to do it and do it yourself. I must said that the learning process especialy for ffmpeg has been a little painfull...
But if you want to build your own ffmpeg and all versions using this second method, installation continues.

Get msysDTK-1.0.1.exe here, and install it.

Now, all the others files to install are compressed files. They are not exe you install, but files you unpack and put directly on the msys directory.

Browsing and searching inside here get all the following files and install them :
Code:
bash-3.1.23-1-msys-1.0.18-bin.tar.xz
bzip2-1.0.6-1-msys-1.0.17-bin.tar.lzma
coreutils-5.97-3-msys-1.0.13-bin.tar.lzma
coreutils-5.97-3-msys-1.0.13-ext.tar.lzma
diffutils-2.8.7.20071206cvs-3-msys-1.0.13-bin.tar.lzma
file-5.04-1-msys-1.0.13-bin.tar.lzma
findutils-4.4.2-2-msys-1.0.13-bin.tar.lzma
gawk-3.1.7-2-msys-1.0.13-bin.tar.lzma
gettext-0.18.1.1-1-msys-1.0.17-bin.tar.lzma
glib_2.34.3-1_win32.zip
grep-2.5.4-2-msys-1.0.13-bin.tar.lzma
gzip-1.3.12-2-msys-1.0.13-bin.tar.lzma
less-436-2-msys-1.0.13-bin.tar.lzma
libasprintf-0.18.1.1-1-msys-1.0.17-dll-0.tar.lzma
libbz2-1.0.6-1-msys-1.0.17-dll-1.tar.lzma
libcharset-1.14-1-msys-1.0.17-dll-1.tar.lzma
libgettextpo-0.18.1.1-1-msys-1.0.17-dll-0.tar.lzma
libiconv-1.14-1-msys-1.0.17-bin.tar.lzma
libiconv-1.14-1-msys-1.0.17-dll-2.tar.lzma
libintl-0.18.1.1-1-msys-1.0.17-dll-8.tar.lzma
libltdl-2.4-1-msys-1.0.15-dll-7.tar.lzma
liblzma-5.0.3-1-msys-1.0.17-dll-5.tar.lzma
libmagic-5.04-1-msys-1.0.13-dll-1.tar.lzma
libregex-1.20090805-2-msys-1.0.13-dll-1.tar.lzma
libtermcap-0.20050421_1-2-msys-1.0.13-dll-0.tar.lzma
libtool-2.4-1-msys-1.0.15-bin.tar.lzma
locate-4.4.2-2-msys-1.0.13-bin.tar.lzma
make-3.81-3-msys-1.0.13-bin.tar.lzma
pkg-config_0.28-1_win32.zip
sed-4.2.1-2-msys-1.0.13-bin.tar.lzma
tar-1.23-1-msys-1.0.13-bin.tar.lzma
termcap-0.20050421_1-2-msys-1.0.13-bin.tar.lzma
texinfo-4.13a-2-msys-1.0.13-bin.tar.lzma
xz-5.0.3-1-msys-1.0.17-bin.tar.lzma
zlib-1.2.7-1-msys-1.0.17-dll.tar.lzma
Now, after you've finished, you have a msys setup able to compile ffmpeg.
You can now launch the shell using either the "MSYS" icon created on desktop, or with menu : MinGW -> MSYS -> MSYS.
Unlike the MSYS2 configuration, because using komisar's gcc version, there is no need for an x86 or an x64 specific mingw shell.

But msys is a closed project, so there is no updates anymore or anything. You could have guessed, it's been replaced (or updated) by MSYS2.

Last edited by jpsdr; 9th October 2015 at 10:44.
jpsdr is offline   Reply With Quote
Old 16th September 2015, 13:58   #12  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,308
ffmpeg

To build ffmeg, there is no differences than first method, it's easy for this step.
Use the same script with the same parameters.

Last edited by jpsdr; 17th September 2015 at 09:29.
jpsdr is offline   Reply With Quote
Old 17th September 2015, 09:32   #13  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,308
ffms2

ffms2 will be more troublesome.
Because of the way komisar's gcc is build, at least at the time i'm writing these lines, you can't compile version 2.21 and up, you can compile only until version 2.20.

To compile, you have to make changes in the building script. You have to change this :
Code:
_cf="-Wno-deprecated-declarations"
_cxx="-Wno-deprecated-declarations"
_ld="-static"
by this :
Code:
_cf="-I${_dir}/include -Wno-deprecated-declarations"
_cxx="-I${_dir}/include -Wno-deprecated-declarations"
_ld="-L${_dir}/lib -static"
#_cf="-Wno-deprecated-declarations"
#_cxx="-Wno-deprecated-declarations"
#_ld="-static"
and this :
Code:
PKG_CONFIG_PATH="${_dir}/lib/pkgconfig" \
by this :
Code:
#PKG_CONFIG_PATH="${_dir}/lib/pkgconfig" \
LIBAV_LIBS="${_lav_l}" \
LIBAV_CFLAGS="${_lav_c}" \
AVRESAMPLE_LIBS="${_av_l}" \
AVRESAMPLE_CFLAGS="${_av_c}" \
You can now compile ffms2 using the script the same way as descrided in first method.
jpsdr is offline   Reply With Quote
Old 17th September 2015, 09:34   #14  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,308
l-smash

Here to, there is no differences than first method, it's easy for this step.
Use the same script with the same parameters.
jpsdr is offline   Reply With Quote
Old 17th September 2015, 09:35   #15  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,308
x264

Now, the last step.
You have to make changes in the building script also here, changing this :
Code:
_cf=""
_ld="-static"
into this :
Code:
_cf="-I${_dir}/include -L${_dir}/lib"
_ld="-I${_dir}/include -L${_dir}/lib -static"
#_cf=""
#_ld="-static"
and this :
Code:
PKG_CONFIG_PATH="${_dir}/lib/pkgconfig" \
into this :
Code:
#PKG_CONFIG_PATH="${_dir}/lib/pkgconfig" \
It's now the end of this tutorial, i hope it can and will be usefull to people.

You can also consider this as a guideline or canvas to help you understand all the necessary processes to build x264, to create you own specific way of building x264.

It's of course a Windows tutorial, but i think it may also be used as guideline for others OS.
jpsdr is offline   Reply With Quote
Old 17th September 2015, 16:48   #16  |  Link
Neroldy
Registered User
 
Join Date: Sep 2014
Location: Nanjing, China
Posts: 18
Thanks a lot! I think it's a very useful tutorial.
Here is a 7mod x264 version which is very similar to tmod and still update with offical git.
https://github.com/Freecom/x264
Neroldy is offline   Reply With Quote
Old 8th October 2015, 09:14   #17  |  Link
pm12hpm
Registered User
 
Join Date: Jan 2013
Posts: 1
Nice gui! Stick it, plz, to the members as I easily search.

P/s: My build is ok?

Quote:
platform: X86_64
byte order: little-endian
system: WINDOWS
cli: yes
libx264: internal
shared: no
static: no
asm: yes
interlaced: yes
avs: avisynth
lavf: yes
ffms: yes
avi output: yes
audio: yes (raw, lavc)
mp4: lsmash
gpl: yes
nonfree: yes
thread: posix
opencl: no
filters: resize crop select_every hqdn3d pad vflip subtitles yadif
debug: no
gprof: no
strip: no
LTO: no
PIC: no
bit depth: 8
chroma format: all
Full log: http://pastebin.com/cvwa79QP
pm12hpm is offline   Reply With Quote
Old 9th October 2015, 10:42   #18  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,308
Seems Ok.
jpsdr is offline   Reply With Quote
Old 9th October 2015, 12:06   #19  |  Link
komisar
Registered User
 
komisar's Avatar
 
Join Date: Aug 2008
Location: Minsk, Belarus
Posts: 235
why strip: no?
with static: no external .dll?
__________________
..::[I am live here]..::..[My x264 CLI/VFW builds and tools]::..
komisar is offline   Reply With Quote
Old 9th October 2015, 14:54   #20  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,308
No idea about static, but the .exe has always worked without the need of extenal dll. Maybe static is relevant only when building the library, not the exe...? No idea what strip is (well... i know the meaning of the word... but no idea what it is in that case).

Last edited by jpsdr; 9th October 2015 at 14:59.
jpsdr is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:25.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.