惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threatpost
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
Security Affairs
N
News and Events Feed by Topic
T
Tenable Blog
P
Proofpoint News Feed
W
WeLiveSecurity
Simon Willison's Weblog
Simon Willison's Weblog
Google DeepMind News
Google DeepMind News
C
CERT Recently Published Vulnerability Notes
Help Net Security
Help Net Security
I
Intezer
T
Threat Research - Cisco Blogs
S
Secure Thoughts
C
Cyber Attacks, Cyber Crime and Cyber Security
L
Lohrmann on Cybersecurity
AWS News Blog
AWS News Blog
Google Online Security Blog
Google Online Security Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Know Your Adversary
Know Your Adversary
Project Zero
Project Zero
The Hacker News
The Hacker News
Security Archives - TechRepublic
Security Archives - TechRepublic
T
Tor Project blog
N
News | PayPal Newsroom
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Hacker News - Newest:
Hacker News - Newest: "LLM"
A
Arctic Wolf
Forbes - Security
Forbes - Security
O
OpenAI News
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Security Latest
Security Latest
P
Palo Alto Networks Blog
S
Schneier on Security
S
Securelist
C
Cybersecurity and Infrastructure Security Agency CISA
H
Heimdal Security Blog
V
Vulnerabilities – Threatpost
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园_首页
T
Troy Hunt's Blog
Latest news
Latest news
Recent Announcements
Recent Announcements
MyScale Blog
MyScale Blog
人人都是产品经理
人人都是产品经理
L
LINUX DO - 热门话题
M
MIT News - Artificial intelligence
N
Netflix TechBlog - Medium
V
Visual Studio Blog
H
Hacker News: Front Page

博客园 - LittlePeng

NodeJS Addon 多线程通信 c coroutine leveldb(ssdb)性能、使用场景评估 [微信协议分析] 多媒体 [微信协议分析] 多点登陆 [微信协议分析] 文本消息 paxos(chubby) vs zab(Zookeeper) 分布式一致性算法 erlang 健壮性 tcp 出现rst情况整理 tcp_tw_reuse、tcp_tw_recycle 使用场景及注意事项 erlang 在线生成crashdump erlang 故障排查工具 erlang 虚机crash Erlang C1500K长连接推送服务-内存 Erlang C1500K长连接推送服务-性能 redis lua erlang 虚机性能调优 java问题排查总结
ffmpeg+x264 Windows MSVC 静态编译
LittlePeng · 2016-07-01 · via 博客园 - LittlePeng

     在为一个视频相关SDK添加h264编码支持时,Android/iOS平台都进展都很顺利,Windows想着也不不多,先编成静态库后扔Vistual Studio做链接,目标是最终都链接为一个动态库。因为有现成的编译shell脚本,开始尝试用mingw编译静态库,发现Vistual Studio链接时因为静态库依赖的 libgcc.a, libmingw.a, libmingwex.a 会与mscrt 有符号冲突,gcc和msvc两套crt怎么可能不冲突。查看ffmpeg、x264官方有文档说明都是支持使用 msvc 来编译,这样自然没有 crt 版本不一致造成冲突的问题。

1. x264

按照官方文档说明:

  The following example command will configure libx264:

CC=cl ./configure --enable-static --prefix=<PREFIX> --extra-cflags="-DNO_PREFIX"
make

The NO_PREFIX flag may be necessary to make linkable libraries.

执行方式:

 - 要求VS 2013 SP2+

 - 先执行 C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat

 - 在切到 bash, [CC=cl] 使用 msvc 的编译器, 其他和在linux/mac 编译完全一样

  会编译生成可用的静态库: libx264.lib 

2. ffmpeg

 使用的是最新3.0 版本,已经支持使用 msvc 工具链的编译。只要指定toolchain为msvc,但生成的文件后缀不是.lib而是.a,没关系,Virtual Studio 也是支持的。

#!/bin/bash

set -x

prefix=$(pwd)/win32/install
export PKG_CONFIG_PATH="$prefix/lib/pkgconfig" 

mkdir -p win32/install

cd ffmpeg
if [[ ! -f config.mak ]]; then
  ./configure \
      --toolchain=msvc \
      --enable-gpl \
      --enable-nonfree \
      --enable-version3 \
      --arch=x86 \
      --target-os=mingw32 \
      --pkg-config=pkg-config \
      --disable-stripping \
      --disable-everything \
      --enable-static \
      --disable-shared \
      --disable-doc \
      --enable-avresample \
      --enable-demuxer=rtsp \
      --enable-muxer=rtsp \
      --disable-ffplay \
      --disable-ffserver \
      --enable-ffmpeg \
      --disable-ffprobe \
      --enable-libx264 \
      --enable-encoder=libx264 \
      --enable-decoder=h264 \
      --enable-protocol=rtp \
      --enable-hwaccels \
      --enable-zlib \
      --disable-devices \
      --disable-avdevice \
      --extra-cflags="-I$prefix/include -MT"  \
      --extra-ldflags=-L$prefix/lib \
      --prefix=$prefix/ffmpeg
fi
make install

参考:https://trac.ffmpeg.org/wiki/CompilationGuide/MSVC