~/code/
automate/ <-- 全部脚本放到这里
automate-git.py <-- CEF build script
chromium_git/
cef/ <-- CEF source checkout
chromium/
src/ <-- Chromium source checkout
update.[bat|sh] <-- Bootstrap script for automate-git.py
depot_tools/ <-- Chromium build tools
::download
set CEF_USE_GN=1
set GN_DEFINES=is_official_build=true ffmpeg_branding=Chrome proprietary_codecs=true
set GN_ARGUMENTS=--ide=vs2017 --sln=cef --filters=//cef/*
set GYP_DEFINES=buildtype=Official
set GYP_MSVS_VERSION=2017
set CEF_ARCHIVE_FORMAT=tar.bz2
python automate-git.py --download-dir=F:\code\chromium_git --branch=3809 --minimal-distrib --client-distrib --force-clean --no-build
pause
::automate-git.py脚本下载地址和为什么选择--branch=3809 参考 https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding.md
#define CONFIG_FLV_DECODER 1
#define CONFIG_H263_DECODER 1
#define CONFIG_H263I_DECODER 1
#define CONFIG_MPEG4_DECODER 1
#define CONFIG_MPEGVIDEO_DECODER 1
#define CONFIG_MSMPEG4V1_DECODER 1
#define CONFIG_MSMPEG4V2_DECODER 1
#define CONFIG_MSMPEG4V3_DECODER 1
#define CONFIG_RV10_DECODER 1
#define CONFIG_RV20_DECODER 1
#define CONFIG_RV30_DECODER 1
#define CONFIG_RV40_DECODER 1
#define CONFIG_AC3_DECODER 1
#define CONFIG_AMRNB_DECODER 1
#define CONFIG_AMRWB_DECODER 1
#define CONFIG_COOK_DECODER 1
#define CONFIG_SIPR_DECODER 1
#define CONFIG_FLV_ENCODER 1
#define CONFIG_H263_ENCODER 1
#define CONFIG_MPEG4_ENCODER 1
#define CONFIG_MSMPEG4V2_ENCODER 1
#define CONFIG_MSMPEG4V3_ENCODER 1
#define CONFIG_RV10_ENCODER 1
#define CONFIG_RV20_ENCODER 1
#define CONFIG_AAC_ENCODER 1
#define CONFIG_AC3_ENCODER 1
#define CONFIG_AC3_PARSER 1
#define CONFIG_COOK_PARSER 1
#define CONFIG_H263_PARSER 1
#define CONFIG_MPEG4VIDEO_PARSER 1
#define CONFIG_MPEGVIDEO_PARSER 1
#define CONFIG_RV30_PARSER 1
#define CONFIG_RV40_PARSER 1
#define CONFIG_SIPR_PARSER 1
#define CONFIG_AC3_DEMUXER 1
#define CONFIG_AMR_DEMUXER 1
#define CONFIG_AMRNB_DEMUXER 1
#define CONFIG_AMRWB_DEMUXER 1
#define CONFIG_AVI_DEMUXER 1
#define CONFIG_AVISYNTH_DEMUXER 1
#define CONFIG_FLV_DEMUXER 1
#define CONFIG_H263_DEMUXER 1
#define CONFIG_H264_DEMUXER 1
#define CONFIG_MPEGTS_DEMUXER 1
#define CONFIG_MPEGTSRAW_DEMUXER 1
#define CONFIG_MPEGVIDEO_DEMUXER 1
#define CONFIG_RM_DEMUXER 1
#define CONFIG_AC3_MUXER 1
#define CONFIG_AMR_MUXER 1
#define CONFIG_AVI_MUXER 1
#define CONFIG_FLV_MUXER 1
#define CONFIG_H263_MUXER 1
#define CONFIG_H264_MUXER 1
#define CONFIG_MPEGTS_MUXER 1
#define CONFIG_RM_MUXER 1
## 第一参数为上面要修改的#define 的文件路径,第二参数为 F:\code\chromium_git\chromium\src\third_party\ffmpeg\chromium\config\Chrome\win\ia32\config.h
import sys
import shutil
import re
import os
def Replace(change,content):
str_array = re.findall("#define\s\w+\s",change)
str_replace =str_array[0]
str_replace+="0"
str_dest =str_array[0]
str_dest+="1"
return content.replace(str_replace,str_dest)
if len(sys.argv) > 2 :
src_file_name =sys.argv[1]
dest_file_name=sys.argv[2]
else:
src_file_name =raw_input("Please input src file path name:").replace("\r","")
dest_file_name =raw_input("Please input dest file path name:").replace("\r","")
file_src_handle = open(src_file_name,"r")
file_src_lines = file_src_handle.readlines()
file_src_handle.close()
file_dest_handle = open(dest_file_name,"r")
dest_file_content = file_dest_handle.read()
file_dest_handle.close()
for line in file_src_lines:
dest_file_content = Replace(line,dest_file_content)
write_file_path = os.getcwd()+"\\"+ os.path.basename(dest_file_name)
ready_copy = open(write_file_path,"w")
ready_copy.write(dest_file_content)
ready_copy.close()
shutil.copy(write_file_path,dest_file_name)
os.remove(write_file_path)
print("Support mp4 Success!!!")
python SupportMp4.py F:/code/automate/mp4_support.txt F:/code/chromium_git/chromium/src/third_party/ffmpeg/chromium/config/Chrome/win/ia32/config.h
pause
set path=%path%;F:\code\depot_tools;F:\code\chromium_git\chromium\src
env.bat
set CEF_USE_GN=1
set GN_DEFINES=is_official_build=true ffmpeg_branding=Chrome proprietary_codecs=true
set GYP_DEFINES=buildtype=Official
set GYP_MSVS_VERSION=2017
set CEF_ARCHIVE_FORMAT=tar.bz2
set GYP_GENERATORS=ninja,msvs-ninja
set GN_ARGUMENTS=--ide=vs2017 --sln=cef --filters=//cef/*
set WIN_CUSTOM_TOOLCHAIN=1
set CEF_VCVARS=none
set GYP_MSVS_OVERRIDE_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community
set SDK_ROOT=C:\Program Files (x86)\Windows Kits\10
set INCLUDE=C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\shared;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\include;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\atlmfc\include;%INCLUDE%
set PATH=C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\bin\HostX64\x86;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\bin\HostX64\x64;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\14.13.26020\x64\Microsoft.VC141.CRT;%PATH%
set LIB=C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\um\x86;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x86;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\lib\x86;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\atlmfc\lib\x86;%LIB%
set VS_CRT_ROOT=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\crt\src\vcruntime
::python automate-git.py --download-dir=e:\buildLib\cef\source --depot-tools-dir=e:\buildLib\cef\depot_tools --branch=3359 --no-update --no-debug-build --build-log-file --verbose-build --force-distrib --force-build
python automate-git.py --download-dir=F:\code\chromium_git --depot-tools-dir=F:\code\depot_tools --branch=3809 --no-update --no-debug-build --build-log-file --verbose-build --force-distrib --force-build
pause
如果前面全部都顺利的话,你会看到F:\code\chromium_git\chromium\src\out目录,里面有一堆准备使用ninga来编译的工程!!!
最后一步,执行如下操作,然后进行死亡等待
cd F:\code\chromium_git\chromium\src
ninja -C out\Release_GN_x86 cef
编译好后,打开地址F:\code\chromium_git\chromium\src\out\Release_GN_x86 测试有没有成功支持mp4: http://html5test.com/
这个问题,折腾了我2天,想通过设置代理的方式解决,失败告终,但我通过奇技淫巧也成功编译了,首先停止脚本运行,修改一下automate-git.py,把13**多行的,sync git clone — job 16这句注释调,再执行下载脚本,跳过下载源码的过程
参考:点这里
解决方法:cd 到depot_tools下的bootstrap-3_8_0_chromium_8_bin,然后进入python里面,给python安装 pywin32这个库
python -m pip install pywin32
修改脚本 automate-git.py 188行,使用下载支持proxy请求
proxies = {'http': 'http://127.0.0.1:61422'}
opener = FancyURLopener(proxies)