工作需要,编译windows版本的ffmpeg转换视频到xvid+mp3

来源:互联网 发布:算法的配套网站 编辑:程序博客网 时间:2024/04/25 06:44

 

#!/bin/sh


# 编译支持转换到xvid+mp3的ffmpeg.exe

#

# 首先安装msysGit.

#   1. Download Git from http://msysgit.googlecode.com/files/Git-1.7.4-preview20110204.exe

#   2. Install

# 然后需要安装MinGW

#   1. Download mingw-get-inst from http://sourceforge.net/projects/mingw/files/Automated%20MinGW%20Installer/mingw-get-inst/mingw-get-inst-20110316/mingw-get-inst-20110316.exe/download

#   2. Install

#   3. Edit MinGW path for call git

#      Add below line to X:/MinGW/msys/1.0/msys.bat

#      path=%path%;c:/program files/git/bin

#

#  保存此段文字到$HOME/build_ffmpeg.sh, 然后执行./build_ffmpeg.sh


# download source codes

git clone git://github.com/yasm/yasm.git

git clone git://git.videolan.org/ffmpeg.git

wget http://sourceforge.net/projects/lame/files/lame/3.98.4/lame-3.98.4.tar.gz/download

wget http://downloads.xvid.org/downloads/xvidcore-1.3.1.tar.gz


for i in ./*gz; do tar zxvf $i; done

for i in ./*.tar.bz2; do tar jxvf $i; done

# rm ./*gz ./*.tar.bz2


# build yasm

cd yasm

./configure && make && make install

cd ~


# build lame

cd lame

./configure --disable-shared

make && make install

cd ~


# build xvid

cd xvidcore/build/generic

./configure && make && make install

# Update for windows link and call

cp /usr/local/lib/xvidcore.dll /usr/local/bin

mv /usr/local/lib/xvidcore.a /usr/local/lib/libxvidcore.a

cd ~


# build ffmpeg

cd ffmpeg

./configure /

--enable-memalign-hack /

--enable-gpl /

--enable-version3 /

--disable-doc /

--disable-debug /

--disable-ffplay /

--disable-ffprobe /

--disable-ffserver /

--disable-pthreads /

--disable-network /

--enable-libmp3lame /

--enable-libxvid /

--extra-cflags=-I/usr/local/include /

--extra-ldflags=-L/usr/local/lib

# If make Cmdutils.c error could not found CommandLineToArgvW

# Add 2 lines to Cmdutils.c

# include <windows.h>

# include <shellapi.h>

make

# Now, ffmpeg.exe in ~/ffmpeg/ffmpeg.exe

# Enjoy!

 

原创粉丝点击