NMM视频技术(旧)

 找回密码
 成为会员
搜索
查看: 6480|回复: 4

MinGW编译ffmpeg最小环境的过程

[复制链接]
发表于 2007-11-20 12:04 | 显示全部楼层 |阅读模式
一来怕自己忘记,二来给后人方便,写下一些东东

首先svn检出ffmpeg。安装配置好msys和mingw环境。
  1. bash-3.1$ bash --version
  2. GNU bash, version 3.1.0(1)-release (i686-pc-msys)
  3. Copyright (C) 2005 Free Software Foundation, Inc.
复制代码
  1. bash-3.1$ g++ -v
  2. Reading specs from f:/mingw/bin/../lib/gcc/mingw32/3.4.2/specs
  3. Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw
  4. --enable-threads --disable-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --e
  5. nable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm --disable-libgcj-debug --ena
  6. ble-interpreter --enable-hash-synchronization --enable-libstdcxx-debug
  7. Thread model: win32
  8. gcc version 3.4.2 (mingw-special)
复制代码
首先进入bash,切换到目录下。
先试试有没有pr命令,没有的话到/bin/下面,把echo cp成pr:
  1. cp echo pr
复制代码
然后还要作一些修改:
(1)
  1. Index: configure
  2. ===================================================================
  3. --- configure        (revision 11067)
  4. +++ configure        (working copy)
  5. @@ -1948,7 +1948,7 @@
  6. # Do not overwrite config.h if unchanged to avoid superfluous rebuilds.
  7. cmp -s $TMPH config.h &&
  8.      echo "config.h is unchanged" ||
  9. -    mv -f $TMPH config.h
  10. +    [u]cp[/u] -f $TMPH config.h

  11. rm -f $TMPO $TMPC $TMPE $TMPS $TMPH
复制代码
因为mv -f好像有点问题,会不能覆盖文件。

(2)
  1. Index: libavformat/Makefile
  2. ===================================================================
  3. --- Makefile        (revision 11067)
  4. +++ Makefile        (working copy)
  5. @@ -6,7 +6,7 @@

  6. CFLAGS += -I$(SRC_PATH)/libavcodec

  7. -OBJS = allformats.o cutils.o os_support.o sdp.o utils.o
  8. +OBJS = allformats.o cutils.o os_support.o sdp.o utils.o[u] gettimeofday.o[/u]

  9. HEADERS = avformat.h avio.h rtp.h rtsp.h rtspcodes.h
复制代码
因为缺少了gettimeofday函数的链接库。

(3)
新建libavformat/gettimeofday.c
  1. #include
  2. #include

  3. void gettimeofday(struct timeval* p, void* tz /* IGNORED */)
  4. {
  5.           union {
  6.                  long long ns100; /*time since 1 Jan 1601 in 100ns units */
  7.                          FILETIME ft;
  8.           } now;

  9.   GetSystemTimeAsFileTime( &(now.ft) );
  10.   p->tv_usec=(long)((now.ns100 / 10LL) % 1000000LL );
  11.   p->tv_sec= (long)((now.ns100-(116444736000000000LL))/10000000LL);
  12. }
复制代码
好了,我们开始编译。
bash-3.1$ ./configure --enable-memalign-hack --disable-debug --enable-small
应该不会有什么问题的。
接着
bash-3.1$ make
bash-3.1$ make install
就可以了

最后我们得到了:
  1. I:\>ffmpeg > ffmpeg.txt
  2. FFmpeg version SVN-r11067, Copyright (c) 2000-2007 Fabrice Bellard, et al.
  3.   configuration: --enable-memalign-hack --disable-debug --enable-small
  4.   libavutil version: 49.5.0
  5.   libavcodec version: 51.48.0
  6.   libavformat version: 51.19.0
  7.   built on Nov 20 2007 12:06:05, gcc: 3.4.2 (mingw-special)
复制代码

[ 本帖最后由 MeteorRain 于 2007-11-20 12:09 编辑 ]

评分

1

查看全部评分

发表于 2007-11-20 12:55 | 显示全部楼层
囧 MR啥时候想起来来着发帖了-v-
 楼主| 发表于 2007-11-20 13:10 | 显示全部楼层
突然灵光一闪,没事做了,想试试用make来批量压片

于是就要用到命令行拆avi出mp3,于是就想到了用ffmpeg,于是就去下载编译了……
发表于 2007-11-20 17:55 | 显示全部楼层
某连碰都没碰过linux的小白飘过~
对了,原来那个MSN被垃圾邮件塞死了,新MSN:dgwxx AT live.cn
发表于 2008-1-18 12:26 | 显示全部楼层
不会编译。
只用编译好的小白飘过
您需要登录后才可以回帖 登录 | 成为会员

本版积分规则

小黑屋|手机版|NMM视频技术

GMT+8, 2024-4-29 05:08 , Processed in 0.060816 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表