'2009/09/30'에 해당되는 글 4건

  1. 2009.09.30 Unofficial FFmpeg Win32 Builds
  2. 2009.09.30 Guide to building FFMpeg for Windows Mobile / Win CE
  3. 2009.09.30 윈도우에서 ffmpeg 컴파일하기(to use in vc++)
  4. 2009.09.30 HOWTO: compiling ffmpeg + x264 + MP3 + Xvid + AMR on Ubuntu

Unofficial FFmpeg Win32 Builds

Guide to building FFMpeg for Windows Mobile / Win CE

Hi all,

I after playing round with Crags guide I thought I would post what I have found. No small amount of hair pulling from me to

Prerequisites

1. Before proceeding, you must have the Msys + MingW development environment set up. I can highly recommend thishttp://ffmpeg.arrozcru.org/ guide as a starting point. Follow this guide through until you have an environment which is sufficient for building FFMpeg on Windows.

2. Get the CeGCC cross compiler from the http://sourceforge.net/project/showfiles.php?group_id=173455&package_id=198682 . The version you should get is http://downloads.sourceforge.net/cegcc/cegcc-mingw32ce-0.50-cygwin.tar.gz?modtime=1188210321&big_mirror=0%20cegcc-mingw32ce-0.50-cygwin.tar.gz.

3. Unzip cegcc-cegcc-0.50-cygwin.tar.gz into your msys/mingw directory. Assuming you followed the guid in step 1, that will be
"c:\msys\mingw"

4. Rename the winsock 2 library found in
"/mingw/opt/mingw32ce/arm-wince-mingw32ce/lib"
from libws2.a to libws2_32.a. Assuming you followed the guide in step 1 that will be
"C:\msys\mingw\opt\mingw32ce\arm-wince-mingw32ce\lib"

5. Modify the file errno.h found in
"/mingw/opt/mingw32ce/arm-wince-mingw32ce/include/errno.h"
Remove lines 11-14:
#ifdef __COREDLL__
# include_next <errno.h>
#else /* __COREDLL__ */
and lines 106-107:
#endif /* Not __COREDLL__ */

6. Note that this is only an issue if you are ''not'' using CeGCC to build your Windows CE / Mobile application. There is an issue with the alignment of structures that contain 8-byte variables in CeGCC (see this http://www.mail-archive.com/cegcc-devel@lists.sourceforge.net/msg00738.html discussion for more info). The solution for this problem involves modifying the stdint.h header file that ships with the release of CeGCC.
/mingw/opt/mingw32ce/arm-wince-mingw32ce/include/stdint.h
If the guide in step 1 was followed that will be
C:\msys\mingw\opt\mingw32ce\arm-wince-mingw32ce\include\stdint.h
Modify the typedefs of the 64-bit integer variables from:
typedef long long int64_t;
typedef unsigned long long uint64_t;
to:
typedef long long int64_t
#if defined(__GNUC__)
__attribute((aligned(8)))
#endif
;
typedef unsigned long long uint64_t
#if defined(__GNUC__)
__attribute((aligned(8)))
#endif
;

7. Download http://www.gnuarm.com/bu-2.16.1_gcc-4.1.0-c-c++_nl-1.14.0_gi-6.4.exe binutils-2.16.1, gcc-4.1.0-c-c++, newlib-1.14.0, insight-6.4, setup.exe [25.3MB] from http://www.gnuarm.com.

8. Install the gnuArm tools to the default location.

Build Process
1. Check out the latest version of the FFMpeg source from SVN. The rest of this guide will assume you checked out to c:\projects\ffmpeg.

2. Open a MSYS command window and navigate to the directory you checked FFMpeg out to:
cd /c/projects/ffmpeg

3. Add the path to the CeGCC cross compiler's bin directory to your PATH environment variable:
PATH=$PATH:/mingw/opt/mingw32ce/bin

4. Add the path to the gnuArm tools bin directory to your PATH environment variable:
PATH=$PATH:"/C/Program Files/GNUARM/bin"

5. Configure the build by executing the following command:
./configure --enable-mingwce --cross-compile --cross-prefix=arm-wince-mingw32ce- --arch=arm --disable-static --enable-shared --disable-parsers --enable-memalign-hack --disable-ffmpeg --disable-ffplay --disable-debug
note from metalkin) It seems that ffmpeg doesn't support '--enable-mingwce' and '--cross-compile'options anymore, '--enable-cross-compile' could replace '--cross-compile' based on current ffmpeg revision.
During build, dsputil_arm_s.S makes several errors "' junk at end of line, first unrecognized character is `p'". I guess an arm assember has to be designated to compile it.
Due to the reasons, this option could be a bit out of date, I think.

6. Remove any old intermediate files
make clean

7. Start the build by executing make:
make

8. Once the build is finished.
make install

9. The lib and header files will now have been copied over to the directories below.
/usr/local/lib
/usr/local/include/ffmpeg
Which if you followed the guide in the prerequisites will be located in:
C:\msys\local\lib
C:\msys\local\include\ffmpeg

Have fun
ceebmoj

ceebmoj
Posts: 1
Joined: Thu Nov 20, 2008 4:30 pm

윈도우에서 ffmpeg 컴파일하기(to use in vc++)

출처 : http://lotus.tistory.com/5?srchid=BR1http%3A%2F%2Flotus.tistory.com%2F5

http://blogit.blogkorea.net/15838845/http://microdev.pe.kr/84 에서
윈도우용 바이너리를 미리 컴파일 해놓은 것이 있어서 굳이 직접 컴파일 할 필요는 없습니다.

<직접컴파일하는 방법>

다운 받은 패키지는 아래와 같습니다.
원래하드에 깔려 있던 패키지
mingw-5.0.3
추가로 받은 패키지.
MSYS-1.0.11-2004.04.30-1.exe
bash-2.05b-MSYS.tar.bz2
binutils-2.16.91-20060119-1.tar.gz
ffmpeg 소스
svn클라이언트로 ffmpeg을 다운로드 합니다.
주소는 다음과 같습니다. svn://svn.mplayerhq.hu/ffmpeg/trunk
인터넷에서 돌아다니는 문서에 보면 binutils를 받으란 얘기는 없는데 binutils 버전이 안 맞으면 컴파일 도중에러가 나네요. 이것때문에 시간 좀 끌었습니다.
mingw와 msys를 설치해 줍니다. path는 경우에 맞게 지정해주세요.
msys.bat에
call "C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat"
이 한줄을 추가 시켜줍니다. vcvars32.bat가 있는 경로로 수정해주세요.
msys실행 후 link.exe를 실행해서 뭔가 주루룩 나오면 제대로 된겁니다. 그 다음 다운 받은 ffmpeg 디렉토리로 가서 configure를 수행합니다.
./configure --enable-shared --disable-static --enable-memalign-hack
그다음 make를  실행후 컴파일 완료되면
c:\program files\FFmpeg 이란 디렉토리가 생깁니다.
FFmpeg폴더 밑에 lib란 디렉토리를 만든후 원 소스가 있던 FFmpeg소스 디렉토리의 하위 디렉토리에lib파일이 세개 있는데 programs files\FFmepg\lib 디렉토리에 카피 합니다.
그리고 dll파일들은 system32에 카피 합니다.
아래 링크에 설치 과정이 나와있습니다.
http://ffmpeg.mplayerhq.hu/ffmpeg-doc.html#SEC26
http://arrozcru.no-ip.org/ffmpeg/

HOWTO: compiling ffmpeg + x264 + MP3 + Xvid + AMR on Ubuntu

ffmpeg is THE audio/video conversion tool. Unfortunately, the default build included in Ubuntu is usually quite outdated, as well as lacking support for many codecs.
The purpose of this article is to show you how you can build a fresh, up to date version of ffmpeg supporting (almost) all codecs. This procedure was successfully performed on Ubuntu 8.04 and 8.10.
0) Prerequisites
Before we start, let's check if subversion and git are installed. We'll need both to install some of the libraries required by ffmpeg:
ubuntu% svn
Type 'svn help' for usage.
ubuntu% git
usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]
OK, they're both present. If not, you need to install them with the following commands:
ubuntu% sudo apt-get install subversion
ubuntu% sudo apt-get install git git-core
Now would be a good time to decide where you're going to build all those sources. Just create a temporary directory anywhere you like (you'll need less than 150MB).
[Updated on 2008/01/02] If you have an existing installation of ffmpeg, you may run into linking issues caused by conflicting library versions. My advice is to remove all existing copies of libav* (libavcodec and so on) which may be present in /usr/lib, either by uninstalling them with APT or by deleting the .a and .so files. Please read the comments below for additional information.
1) Fetching the ffmpeg sources
First of all, let's get the latest ffmpeg source snapshot from the Subversion server:

ubuntu% svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
lots of output removed
Checked out external at revision 28172.
Checked out revision 16245.

Of course, you could just go ahead with configure, make, make install and be done with it. Unfortunately (?), it's not that simple. Go ahead, run configure:

ubuntu% cd ffmpeg
ubuntu% ./configure
--prefix=/usr/local
lots of output removed
Creating config.mak and config.h...

Take a closer look at the output, especially at the 'Enabled encoders' section. A number of major formats, like AAC, MP3, x.264 or XViD are missing. Can you live without these? Probably not...
Why, oh why are they missing? Take another look at the output of the configure command:
libfaac enabled no
libmp3lame enabled no
libx264 enabled no
libxvid enabled no

These encoders are missing because they're handled by external libraries which are not part of the ffmpeg source package. Chasing them all is a bit of a pain in the #$$ and hopefully this article will help!
2) Configuring ffmpeg... and failing
Let's go wild and enable almost everything, including shared libraries (nice if you're running multiple copies of ffmpeg) and POSIX threads (additional parallelism can't hurt):
ubuntu% ./configure --prefix=/usr/local --enable-gpl --enable-nonfree --enable-shared --enable-postproc --enable-avfilter --enable-avfilter-lavf --enable-pthreads --enable-x11grab --enable-bzlib --enable-libamr-nb --enable-libamr-wb --enable-libdc1394 --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libschroedinger --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-zlib

It will inevitably lead to something like this:
FAAD test failed.
If you think configure made a mistake, make sure you are using the latest
version from SVN. If the latest version fails, report the problem to the
ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.err" produced by configure as this will help
solving the problem.

It's normal, we haven't installed the external libraries required for our ffmpeg build. Let's get to it!
3) Installing libamr
This library is needed for 3GPP speech codecs. For legal reasons, it is not part of the standard Ubuntu repository. You can find it in the Medibuntu repository. Of course, you need to let APT know about this new repository. These are the commands for Ubuntu 8.04 (more information on other versions here):

ubuntu% sudo wget http://www.medibuntu.org/sources.list.d/hardy.list --output-document=/etc/apt/sources.list.d/medibuntu.list
ubuntu% sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update
Now you can install libamr:
ubuntu% sudo apt-get install libamrnb-dev libamrwb-dev
4) Installing libnut

NUT is a container format under construction by MPlayer and FFmpeg developers. Libnut needs to be built from source:
ubuntu% svn co svn://svn.mplayerhq.hu/nut/src/trunk/ nut
ubuntu% cd nut
ubuntu% make
ubuntu% sudo make install

5) Installing libx264
x264 is a free library for encoding H264/AVC video streams.
It can be fetched with APT using 'apt-get install libx264-dev' but let's make sure we have both the latest ffmpeg and the latest x264.
Before we build the x264 source, we need to install

  • libgpac, required to support the mp4 container with the x264 codec,
  • the yasm assembler, required to compile several assembly language routines present in the x264 code.
Installing libgpac is straightforward:
ubuntu% sudo apt-get install libgpac-dev
Now, let's take a look at yasm:
ubuntu% yasm --version
zsh: command not found: yasm
It's not there. Let's get it using APT:
ubuntu% sudo apt-get install yasm
ubuntu% yasm --version
yasm 0.5.0.1591

OK, now let fetch the x264 source and configure the build:

ubuntu% git clone git://git.videolan.org/x264.git
ubuntu% cd x264
ubuntu% ./configure --prefix=/usr/local --enable-shared
Found yasm 0.5.0.1591
Minimum version is yasm-0.6.1
If you really want to compile without asm, configure with --disable-asm.

Hmmm.. Do we want to use generic C routines instead of optimized assembly? No. Let's build the latest yasm (0.7.2 at the time of this writing):
ubuntu% sudo apt-get remove yasm
ubuntu% wget http://www.tortall.net/projects/yasm/releases/yasm-0.7.2.tar.gz
ubuntu% tar xvfz yasm-0.7.2.tar.gz
ubuntu% cd yasm-0.7.2
ubuntu% ./configure --prefix=/usr/local
ubuntu% make
ubuntu% sudo make install
ubuntu% yasm --version
yasm 0.7.2.2153

OK, now we can build x264:

ubuntu% cd x264
ubuntu% ./configure --prefix=/usr/local --enable-shared
output removed
Platform: X86
System: LINUX
asm: yes
avis input: no
mp4 output: yes
pthread: yes
debug: no
gprof: no
PIC: no
shared: yes
visualize: no
ubuntu% make
ubuntu% sudo make install

6) Installing libxvid
Before we install libxvid, we need to check that the nasm assembler is OK. It's required to build assembly code inlibxvid and you do NOT want this code to be replaced with generic C code in case nasm is missing : I ran some Xvidencoding tests with and without assembly code and there's a 2.5x factor... So read on :)
You need at least nasm 2.0, so let's check the default version on Ubuntu 8.04 and Ubuntu 8.10:

ubuntu8.04% sudo apt-get install nasm
ubuntu8.04% nasm -v
NASM version 0.99.06-20071101 compiled on Sep 16 2008
ubuntu8.10% sudo apt-get install nasm
ubuntu8.10% nasm -v
NASM version 2.03.01 compiled on Jun 19 2008

So, if you have 8.10, you're good to go and you can skip the rest of this section. If you have 8.04, follow me:
ubuntu% sudo apt-get remove nasm
ubuntu% wget http://www.nasm.us/pub/nasm/releasebuilds/2.05.01/nasm-2.05.01.tar.gz
ubuntu% tar xvfz nasm-2.05.01.tar.gz
ubuntu% cd nasm-2.05.01
ubuntu% ./configure --prefix=/usr/local
ubuntu% make
ubuntu% sudo make install
ubuntu% nasm -v
NASM version 2.05.01 compiled on Dec 23 2008

Now, let's fetch the xvid sources and build them:

ubuntu% wget http://downloads.xvid.org/downloads/xvidcore-1.2.1.tar.gz
ubuntu% tar xvfz xvidcore-1.2.1.tar.gz
ubuntu% cd xvidcore/build/generic
ubuntu% ./configure --prefix=/usr/local
ubuntu% make
lots of output removed
---------------------------------------------------------------
Xvid has been successfully built.
* Binaries are currently located in the '=build' directory
* To install them on your system, you can run '# make install'
as root.
---------------------------------------------------------------

ubuntu% sudo make install
7) Installing everything else
All the other libraries we need are part of the standard Ubuntu repository. Let's install them all with a single command:

ubuntu% sudo apt-get install
libfaac-dev libfaad-dev libschroedinger-dev libtheora-dev libvorbis-dev libxv-dev libxvmc-dev

We also need to install the LAME MP3 encoder. The name of the library differs on Ubuntu 8.04 and Ubunto 8.10, so choose wisely :)

ubuntu8.04% sudo apt-get
install liblame-dev
ubuntu8.10% sudo apt-get install libmp3lame-dev
8) Configuring ffmpeg... and succeeding!

We should have everything we need now. Let's try that configure command again:
[Updated on 2009/02/18 : the '--enable-xvmc' flag has been removed. XVMC support now seems to be integrated by default. If you're using an old build, please add the flag to the command line below]
[Updated on 2009/03/09 : the '--enable-swscale' flag has been removed. This library is now built by default. If you're using an old build, please add the flag to the command line below]
ubuntu% cd ffmpeg
ubuntu% ./configure --prefix=/usr/local --enable-gpl --enable-nonfree --enable-shared --enable-postproc --enable-avfilter --enable-avfilter-lavf --enable-pthreads --enable-x11grab --enable-bzlib --enable-libamr-nb --enable-libamr-wb --enable-libdc1394 --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libschroedinger --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-zlib
lots of output removed
License: unredistributable
Creating config.mak and config.h...
All right. Let's build it.

9) Building ffmpeg
That's the easiest bit!
ubuntu% make
LOTS of output removed
ranlib libavutil/libavutil.a
rm doc/ffserver.pod doc/ffmpeg.pod doc/ffplay.pod
ubuntu% sudo make install
That's it. Cool, huh? Before you can start playing with your ffmpeg binary, you need to register those new dynamic libraries in /usr/local/lib (I'm using zsh. the syntax may be different if you're using another shell):
ubuntu% LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
ubuntu% export LD_LIBRARY_PATH
ubuntu% sudo ldconfig
Now, let's check this new ffmpeg:
ubuntu% which ffmpeg
/usr/local/bin/ffmpeg
ubuntu% ffmpeg -formats
lots of output removed
Pretty good list of codecs, isn't it?
10) Cleaning up

If like me you keep building the latest version, you will eventually end up with a lot of unecessary libraries in/usr/local/lib, e.g.:
ubuntu% cd /usr/local/lib
ubuntu% ls -l libav*
-rw-r--r-- 1 root root 24108334 2009-02-20 11:15 libavcodec.a
lrwxrwxrwx 1 root root 21 2009-02-20 11:15 libavcodec.so -> libavcodec.so.52.15.0
lrwxrwxrwx 1 root root 21 2009-02-20 11:15 libavcodec.so.52 -> libavcodec.so.52.15.0
-rwxr-xr-x 1 root root 5791060 2009-02-04 11:34 libavcodec.so.52.11.0
-rwxr-xr-x 1 root root 5791192 2009-02-05 15:29 libavcodec.so.52.12.0
-rwxr-xr-x 1 root root 5791228 2009-02-10 17:46 libavcodec.so.52.14.0
-rwxr-xr-x 1 root root 5774920 2009-02-20 11:15 libavcodec.so.52.15.0
-rw-r--r-- 1 root root 467478 2009-02-20 11:15 libavdevice.a
lrwxrwxrwx 1 root root 21 2009-02-20 11:15 libavdevice.so -> libavdevice.so.52.1.0
lrwxrwxrwx 1 root root 21 2009-02-20 11:15 libavdevice.so.52 -> libavdevice.so.52.1.0
-rwxr-xr-x 1 root root 39492 2009-02-20 11:15 libavdevice.so.52.1.0
-rw-r--r-- 1 root root 63220 2009-02-20 11:15 libavfilter.a
lrwxrwxrwx 1 root root 20 2009-02-20 11:15 libavfilter.so -> libavfilter.so.0.3.0
lrwxrwxrwx 1 root root 20 2009-02-20 11:15 libavfilter.so.0 -> libavfilter.so.0.3.0
-rwxr-xr-x 1 root root 17876 2009-02-20 11:15 libavfilter.so.0.3.0
-rw-r--r-- 1 root root 6259158 2009-02-20 11:15 libavformat.a
lrwxrwxrwx 1 root root 22 2009-02-20 11:15 libavformat.so -> libavformat.so.52.29.0
lrwxrwxrwx 1 root root 22 2009-02-20 11:15 libavformat.so.52 -> libavformat.so.52.29.0
-rwxr-xr-x 1 root root 766736 2009-02-05 15:29 libavformat.so.52.25.0
-rwxr-xr-x 1 root root 770972 2009-02-10 17:46 libavformat.so.52.26.0
-rwxr-xr-x 1 root root 771072 2009-02-12 16:57 libavformat.so.52.27.0
-rwxr-xr-x 1 root root 775232 2009-02-13 11:22 libavformat.so.52.28.0
-rwxr-xr-x 1 root root 767108 2009-02-20 11:15 libavformat.so.52.29.0
-rw-r--r-- 1 root root 225672 2009-02-20 11:15 libavutil.a
lrwxrwxrwx 1 root root 20 2009-02-20 11:15 libavutil.so -> libavutil.so.49.14.0
lrwxrwxrwx 1 root root 20 2009-02-20 11:15 libavutil.so.49 -> libavutil.so.49.14.0
-rwxr-xr-x 1 root root 55508 2009-02-20 11:15 libavutil.so.49.14.0
There's nothing really wrong here, but for the sake of clarity, you may want to remove the old libraries, i.e. the ones NOT linked as lib*.so.
That's it for today :)
Related Posts by Categories

ffmpeg

open source

howto

x264

Written by: Julien Simon at 3:45 PM

Tags: ffmpeg, howto, open source, x264

prev 1 next