如何通过 Alchemy gcc 编译 ffmpeg?
所以我创建了 ffmpeg 配置文件,使其成为纯 C (平台无关,但只是理论上)
所以我的配置很简单(0.6.1,0.6.3 测试):
./configure --disable-doc --disable-ffplay --disable-ffprobe --disable-ffserver --disable-avdevice --disable-avfilter --disable-pthreads --disable-everything --enable-muxer=flv --enable-encoder=flv --enable-encoder=h263 --disable-mmx --disable-shared --prefix=bin/ --disable-protocols --disable-network --disable-optimizations --disable-debug --disable-asm --disable-stripping
在 Linux 上编译此文件将解析为 4 个库,总大小为 1 mb 。
但我需要使用自定义编译器编译 ffmpeg(名为 Adobe Alchemy 的开源 gcc 模拟,让我们编译C/c++ 到 Flash)
在标准 Make 过程中几乎每个文件都会出现错误:
Array @ARGV missing the @ in argument 1 of shift() at /home/rupert/Downloads/alchemy-ubuntu-v0.5a/achacks/gcc line 218.
cc1: error: unrecognized command line option "-Wtype-limits"
cc1: error: unrecognized command line option "-fno-signed-zeros"
那么我该怎么办 - 如何通过炼金术编译 ffmpeg(至少是它的最小部分)?
更新 如果我们手动修复该错误(configure.mak 中有 2 个错误,alchemy gcc 中有 1 个),我们将得到一个非常混乱且很长的输出,例如:
> $ make -w install
make: Entering directory `/home/rupert/Downloads/ffmpeg-0.6.1'
AR libavformat/libavformat.a
llvm-ld: error opening 'avformat/libavformat.l.bc' for writing!
llvm-ranlib: Archive file does not exist
INSTALL libavformat/libavformat.a
install: cannot stat `libavformat/libavformat.a': No such file or directory
llvm-ranlib: Archive file does not exist
AR libavcodec/libavcodec.a
llvm-ld: error opening 'avcodec/libavcodec.l.bc' for writing!
llvm-ranlib: Archive file does not exist
INSTALL libavcodec/libavcodec.a
install: cannot stat `libavcodec/libavcodec.a': No such file or directory
llvm-ranlib: Archive file does not exist
AR libswscale/libswscale.a
llvm-ld: error opening 'swscale/libswscale.l.bc' for writing!
llvm-ranlib: Archive file does not exist
INSTALL libswscale/libswscale.a
install: cannot stat `libswscale/libswscale.a': No such file or directory
llvm-ranlib: Archive file does not exist
AR libavutil/libavutil.a
llvm-ld: error opening 'avutil/libavutil.l.bc' for writing!
llvm-ranlib: Archive file does not exist
INSTALL libavutil/libavutil.a
install: cannot stat `libavutil/libavutil.a': No such file or directory
llvm-ranlib: Archive file does not exist
INSTALL libavformat/avformat.h
INSTALL libavformat/avio.h
INSTALL libavformat/libavformat.pc
INSTALL libavcodec/avcodec.h
INSTALL libavcodec/avfft.h
INSTALL libavcodec/dxva2.h
INSTALL libavcodec/opt.h
INSTALL libavcodec/vaapi.h
INSTALL libavcodec/vdpau.h
INSTALL libavcodec/xvmc.h
INSTALL libavcodec/libavcodec.pc
INSTALL libswscale/swscale.h
INSTALL libswscale/libswscale.pc
INSTALL libavutil/adler32.h
INSTALL libavutil/attributes.h
INSTALL libavutil/avstring.h
INSTALL libavutil/avutil.h
INSTALL libavutil/base64.h
INSTALL libavutil/common.h
INSTALL libavutil/crc.h
INSTALL libavutil/error.h
INSTALL libavutil/fifo.h
INSTALL libavutil/intfloat_readwrite.h
INSTALL libavutil/log.h
INSTALL libavutil/lzo.h
INSTALL libavutil/mathematics.h
INSTALL libavutil/md5.h
INSTALL libavutil/mem.h
INSTALL libavutil/pixdesc.h
INSTALL libavutil/pixfmt.h
INSTALL libavutil/rational.h
INSTALL libavutil/sha1.h
INSTALL libavutil/avconfig.h
INSTALL libavutil/libavutil.pc
LD ffmpeg_g
WARNING: While resolving call to function 'main' arguments were dropped!
Cannot yet select: 0x8e707e8: i32 = ConstantPool < i64 6881500230622117888> 0
llc[0x86c7dec]
make: *** [ffmpeg_g] Error 6
make: Leaving directory `/home/rupert/Downloads/ffmpeg-0.6.1'
So I created ffmpeg configuration file that makes it pure C (platform independent, but only theoretically)
So my config is simple (0.6.1,0.6.3 tested):
./configure --disable-doc --disable-ffplay --disable-ffprobe --disable-ffserver --disable-avdevice --disable-avfilter --disable-pthreads --disable-everything --enable-muxer=flv --enable-encoder=flv --enable-encoder=h263 --disable-mmx --disable-shared --prefix=bin/ --disable-protocols --disable-network --disable-optimizations --disable-debug --disable-asm --disable-stripping
Compiling this on Linux will resolve in 4 libs with totall size of 1 mb.
But I need to compile ffmpeg with custom compiler (opensource gcc analog called Adobe Alchemy, lets us compile C/c++ into Flash)
It gives me errors on nearly each and every file during standart Make:
Array @ARGV missing the @ in argument 1 of shift() at /home/rupert/Downloads/alchemy-ubuntu-v0.5a/achacks/gcc line 218.
cc1: error: unrecognized command line option "-Wtype-limits"
cc1: error: unrecognized command line option "-fno-signed-zeros"
So what shall I do - how to compile ffmpeg (at least smallest part of it) via alchemy?
Update
If we would fix that errors manually (2 in configure.mak and one in alchemy gcc) we would get a really messy and long output like:
> $ make -w install
make: Entering directory `/home/rupert/Downloads/ffmpeg-0.6.1'
AR libavformat/libavformat.a
llvm-ld: error opening 'avformat/libavformat.l.bc' for writing!
llvm-ranlib: Archive file does not exist
INSTALL libavformat/libavformat.a
install: cannot stat `libavformat/libavformat.a': No such file or directory
llvm-ranlib: Archive file does not exist
AR libavcodec/libavcodec.a
llvm-ld: error opening 'avcodec/libavcodec.l.bc' for writing!
llvm-ranlib: Archive file does not exist
INSTALL libavcodec/libavcodec.a
install: cannot stat `libavcodec/libavcodec.a': No such file or directory
llvm-ranlib: Archive file does not exist
AR libswscale/libswscale.a
llvm-ld: error opening 'swscale/libswscale.l.bc' for writing!
llvm-ranlib: Archive file does not exist
INSTALL libswscale/libswscale.a
install: cannot stat `libswscale/libswscale.a': No such file or directory
llvm-ranlib: Archive file does not exist
AR libavutil/libavutil.a
llvm-ld: error opening 'avutil/libavutil.l.bc' for writing!
llvm-ranlib: Archive file does not exist
INSTALL libavutil/libavutil.a
install: cannot stat `libavutil/libavutil.a': No such file or directory
llvm-ranlib: Archive file does not exist
INSTALL libavformat/avformat.h
INSTALL libavformat/avio.h
INSTALL libavformat/libavformat.pc
INSTALL libavcodec/avcodec.h
INSTALL libavcodec/avfft.h
INSTALL libavcodec/dxva2.h
INSTALL libavcodec/opt.h
INSTALL libavcodec/vaapi.h
INSTALL libavcodec/vdpau.h
INSTALL libavcodec/xvmc.h
INSTALL libavcodec/libavcodec.pc
INSTALL libswscale/swscale.h
INSTALL libswscale/libswscale.pc
INSTALL libavutil/adler32.h
INSTALL libavutil/attributes.h
INSTALL libavutil/avstring.h
INSTALL libavutil/avutil.h
INSTALL libavutil/base64.h
INSTALL libavutil/common.h
INSTALL libavutil/crc.h
INSTALL libavutil/error.h
INSTALL libavutil/fifo.h
INSTALL libavutil/intfloat_readwrite.h
INSTALL libavutil/log.h
INSTALL libavutil/lzo.h
INSTALL libavutil/mathematics.h
INSTALL libavutil/md5.h
INSTALL libavutil/mem.h
INSTALL libavutil/pixdesc.h
INSTALL libavutil/pixfmt.h
INSTALL libavutil/rational.h
INSTALL libavutil/sha1.h
INSTALL libavutil/avconfig.h
INSTALL libavutil/libavutil.pc
LD ffmpeg_g
WARNING: While resolving call to function 'main' arguments were dropped!
Cannot yet select: 0x8e707e8: i32 = ConstantPool < i64 6881500230622117888> 0
llc[0x86c7dec]
make: *** [ffmpeg_g] Error 6
make: Leaving directory `/home/rupert/Downloads/ffmpeg-0.6.1'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
FlasCC(Alchemy 2) 确实可以很好地编译 ffmpeg - 对于任何尝试的人来说,基本上你需要下载 ffmpeg 源代码。转到 ffmpeg 目录,执行
以下操作: 现在,如果您运行带有一些限制的配置,这样它就不会包含每个编解码器或过滤器(需要很长时间)。我的用例中的其他配置参数:
重要的是
--disable-everything
然后仅启用您需要的内容。然后运行
./make
和./make
install (在这些命令前面加上 PATH),它应该生成并安装 ffmpeg 库。当我构建一个测试 swf 时,一切似乎都有效。我使用了他们的(修改过的)示例,其中他们编码了 25 个虚拟 mpeg 帧。我至少正在跟踪编码进度并看到正在编码的帧。
不过,如果您想使用 SWC,那么它是一个问题。我遇到奇怪的错误 - 首先它找不到编解码器(使用查找编解码器函数时得到 NULL),当我按名称指定它时,它无法分配编解码器上下文(也得到 NULL)。然后我用纯Flex编译它,它克服了这个问题,但无法打开编解码器(基本上所有这些都是av_一些库函数)。我真的不明白为什么 SWC 不能与这些一起使用,因为与 emmit-swf 一起工作都完美。
也许有人可以启发一下 SWC / SWF 的差异。
FlasCC(Alchemy 2) does compile ffmpeg fine - for anyone who is trying, basically you need to download ffmpeg source. Go to ffmpeg directory, do
Now it's good if you run configure with some restrictions so it doesn't include every codec or filter there is(takes ages). Additional configure params from my use case:
Important is to
--disable-everything
and then enable only what you need.Then run
./make
and./make
install (with the PATH in front of those commands), it should produce and install ffmpeg libs.When I built a test swf, all seemed to work. I've used their (modified) sample where they encode 25 dummy mpeg frames. I'm tracing the encoding progress at least and seeing the frames being encoded.
SWC is a problem though, if you would want to use that. I'm getting strange errors - first it couldn't find codec(got NULL when using the find codec function), when I specified it by name, it can't allocate codec context(also got NULL). Then I compiled it in pure Flex and it got over this one, but couldn't open the codec (basically all of those are av_ something library functions). I really don't understand why SWC doesn't work with these as with emit-swf all works perfectly fine.
Maybe someone could enlighten on the SWC / SWF differences.
Adobe 论坛此处对此进行了一些讨论。尽管有些人似乎取得了一些进展,但它似乎相当复杂。
There was some discussion about this on the Adobe Forums here. It seems rather involved, though some folks seem to have made some progress.
使用新的 Flash C 编译器 Adobe Flash cc 进行尝试。我希望它可以帮助你在flash中编译ffmpeg。
Try it with the new flash c compiler Adobe Flash cc. I hope it may help you to compile ffmpeg in flash.