LinkShare rotating banner
Showing posts with label mplayer. Show all posts
Showing posts with label mplayer. Show all posts

Friday, April 9, 2010

MinGW: MPlayer와 Mencoder 동적 컴파일하기

MinGW의 GCC 컴파일러를 사용하여 Windows용 MPlayer와 Mencoder를 컴파일해 보자. MPlayer는 동영상을 보는 프로그램이고 Mencoder는 동영상이나 음악을 인코딩하는 프로그램이다. 예전에는 정적으로 컴파일하였지만 이번에는 동적으로 컴파일해 보자.


우선 MinGW를 설치한다. MPlayer는 FFmpeg 라이브러리에 의존하므로 먼저 FFmpeg 라이브러리를 동적으로 컴파일하도록 한다.


시작 메뉴를 열어 MinGW (rxvt)를 실행한다. 노란 창이 나타날 것이다. 그럼 다음과 같이 MPlayer와 의존 라이브러리를 컴파일하자.



  1. LZO 압축 라이브러리 컴파일 (옵션)

    tar xzvf lzo-2.03.tar.gz
    cd lzo-2.03/
    ./configure --prefix=/mingw
    make
    make install


  2. Fribidi 라이브러리 컴파일 (옵션)

    Fribidi는 아랍어와 히브리어의 표시에 필요하다. 솔직히 이 기능은 빠뜨려도 된다.

    tar xzvf fribidi-0.19.2.tar.gz
    cd fribidi-0.19.2/
    ./configure --prefix=/mingw --disable-debug
    make
    make install

    자세한 내용은 Fribidi에 관한 글을 참조.

  3. giflib 라이브러리 컴파일 (옵션)

    tar xjvf giflib-4.1.6.tar.bz2 
    cd giflib-4.1.6/
    ./configure --prefix=/mingw
    make
    make install


  4. Live555 라이브러리 컴파일 (권장)

    Live 라이브러리는 인터넷 동영상을 보는 데 쓰인다. live555.com에서 최신 버전을 받아 다음과 같이 컴파일한다:

    export CC=/mingw/bin/gcc.exe
    cd /mingw/lib/
    tar xzvf live.2010.04.01.tar.gz
    cd live/
    ./genMakefiles mingw
    make


  5. JPEG 라이브러리 컴파일 (권장)

    tar xzvf jpegsrc.v8a.tar.gz
    cd jpeg-8a/
    ./configure --prefix=/mingw
    make
    make install


  6. PNG 라이브러리 컴파일 (권장)

    tar xzvf libpng-1.4.1.tar.gz 
    cd libpng-1.4.1
    ./configure --prefix=/mingw
    make
    make install


  7. FreeType 라이브러리 컴파일 (필수)

    자막 표시에 필요하다.

    그리고 Freetype를 컴파일한다.

    tar xzvf freetype-2.3.12.tar.gz 
    cd freetype-2.3.12/
    ./configure --prefix=/mingw
    make install


  8. 만일 iconv 라이브러리가 설치되어 있지 않다면 컴파일한다. libXML2 그리고 fontconfig 에 필요하다.

  9. libXML2 컴파일

    만약에 fontconfig 라이브러리를 컴파일하려면 필요하다. 먼저 testThreads.c를 고친다.

    --- testThreads.c.orig  2009-09-11 18:09:00.268640135 +0200
    +++ testThreads.c 2009-09-11 18:12:43.412653512 +0200
    @@ -107,7 +107,7 @@

    for (i = 0; i < num_threads; i++) {
    results[i] = NULL;
    - tid[i] = (pthread_t) -1;
    + memset(&tid[i], 0, sizeof(pthread_t));
    }

    for (i = 0; i < num_threads; i++) {

    그리고 컴파일한다:


    ./configure --prefix=/mingw
    make install


  10. Fontconfig 라이브러리 컴파일 (권장)

    SSA 자막 표시에 필요하다.

    tar xzvf fontconfig-2.8.0.tar.gz 
    cd fontconfig-2.8.0/
    ./configure --prefix=/mingw
    make install


  11. Libcdio 컴파일 (옵션)

    tar xzvf libcdio-0.83.tar.gz 
    cd libcdio-0.83/
    ./configure --prefix=/mingw
    make
    make install


  12. Libdca 컴파일 (권장)

    tar xjvf libdca-0.0.5.tar.bz2 
    cd libdca-0.0.5/
    ./configure --prefix=/mingw
    make install


  13. DirectX 7 라이브러리 추출 (권장)

    cd /mingw/include/
    tar xzvf dx7headers.gz


  14. MPlayer, Mencoder 컴파일

    ffmpeg 소스를 받아서 mplayer 소스 디렉토리에 넣는다.

    tar xjvf mplayer-export-snapshot.tar.bz2

    cd mplayer-export-2011-11-25/

    tar xjvf ffmpeg-snapshot.tar.bz2

    CPPFLAGS='-DWIN32 -DHAVE_INT32_T' ./configure --prefix=/mingw --enable-runtime-cpudetection --enable-theora --enable-fribidi --disable-ffmpeg_a --yasm=/mingw/bin/yasm

    MPlayer를 컴파일하기 전에 config.mak를 텍스트 에디터(notepad.exe)로 수정한다.

    EXTRALIBS_MPLAYER  = -lgdi32 -lopengl32 -lwinmm -lfaac -lx264 -lmp3lame -lfribidi
    EXTRALIBS_MENCODER = -lfaac -lx264 -lfribidi -lmp3lame

    MPlayer 컴파일 시작한다.

    make

  15. MPlayer.exe와 Mencoder.exe를 복사한다.

    strip mencoder.exe mplayer.exe
    cp -iv m*.exe /mingw/bin

Sunday, April 4, 2010

Using MPlayer & Mencoder to Rip Blu-ray

Blu-ray discs require new and powerful CPU and graphics card to play high-definition movies on them. Although MPlayer is not yet suitable for playing Blu-ray discs, Mencoder can be used to rip Blu-ray discs in a more watchable format so that you can watch the movie on your average computer, laptop, iPod or iPad. I blogged previously on using Mencoder to rip DVD. Ripping Blu-ray isn't much different from ripping DVD.


Since Blu-ray discs are encrypted, you need to use DumpHD, Clown_BD or AnyDVD HD to dump the contents of your Blu-ray disc to your hard drive prior to ripping it. If you have Slysoft AnyDVD HD installed, right-click on the red fox icon on the right side of the taskbar, and choose Rip Video DVD to Harddisk from the menu. Then, specify the location where you want to save unencrypted Blu-ray contents. Note that you'll need more than 20GB free space.



After saving the huge amount of Blu-ray contents, open Command Prompt and type mplayer commands to play the Blu-ray movie. Here are some examples:



  • VC-1 video and AC-3 audio

    mplayer E:\BDMV\STREAM\00024.m2ts -vo directx:accel -vc ffvc1 -ao dsound -ac ffac3 -aid 4352 -framedrop

  • H.264 video and AC-3 audio

    mplayer E:\BDMV\STREAM\00024.m2ts -vo directx:accel -vc ffh264 -ao dsound -ac ffac3 -aid 4352 -framedrop

  • MPEG video and AC-3 audio

    mplayer E:\BDMV\STREAM\00024.m2ts -vo directx:accel -vc ffmpeg12 -ao dsound -ac ffac3 -aid 4352 -framedrop


To find available audio tracks, type the -identify option for mplayer to create a log file and look for AUDIO_ID strings.


mplayer 00024.m2ts -vo direct3d -vc ffvc1 -vf cropdetect -ss 180 -identify > log.txt


To encode the Blu-ray video with H.263 codec and resize it to 768x432 screen at the same time, the mencoder command would be like:


mencoder 00024.m2ts -o film.h264 -of rawvideo -oac copy -vf scale=768:432,harddup -ofps 24000/1001 -vc ffvc1 -ovc x264 -x264encopts bitrate=1200:subq=4:bframes=3:b_pyramid=normal:weight_b:pass=1:turbo=1

My second-pass mencoder command would be:


mencoder 00024.m2ts -o film.264 -of rawvideo -oac copy -vf scale=768:432,harddup -ofps 24000/1001 -vc ffvc1 -ovc x264 -x264encopts bitrate=1200:8x8dct:me=umh:frameref=4:bframes=3:b_pyramid=normal:weight_b:pass=2:trellis=1:psnr


I like to convert 5.1-channel AC3 audio to 6-channel AAC sound.


mplayer 00024.m2ts -vo null -vc null -aid 4352 -ao pcm:fast:file=audio-en-51.pcm -ac ffac3 -channels 6
faac --mpeg-vers 4 -q 108 -c 16800 -I 2,6 audio-en-51.pcm


Finally, let's put together a Matroska package from the video and audio


mkvmerge --title "Le Film" --default-language fr --chapters Chapters.txt -o le_film.mkv --track-name 0:"Video_Title" --default-duration 0:23.976fps --display-dimensions 0:768x432 --noaudio film.264 --default-track 0 --language 0:fr audio-fr-51.aac

윈도용 MPlayer / Mencoder 사용 및 설정

MinGW로 컴파일한 MPlayer를 시험해 보고 최적으로 설정해 보자. 다음은 내가 컴파일한 MPlayer와 Mencoder이다. bzip2.exe로 압축을 풀어야 한다(bzip2 -d mplayer.exe.bz2).





  1. DirectX 8.1 설치(Windows 95/98/ME Only)


    업데이트: Windows 98/ME 사용자도 아래의 DirectX 9.0c를 설치할 수 있다. 만일 DirectX 9을 설치할 경우, DirectX 8.1을 설치할 필요가 없게 된다.


    Windows 98/ME 사용자는 DirectX 8.0a, DirectX 8.1b 혹은 DirectX 8.2를 받아서 설치해야 MPlayer가 제대로 작동한다. 다음은 다운로드 링크를 여러 군데 모은 것이다.



    DirectX 8.1는 Windows XP에 포함되어 있다.



  2. DirectX 9.0c 설치


    MPlayer의 최신 개발 코드는 기본적으로 DirectX 9와 링크되도록 되어 있다. 그러므로 이렇게 만든 mplayer.exe 실행 파일을 Windows 98/ME/XP에서 실행하면 DirectX 9를 못 찾고 오류가 발생할 수가 있다. 이러한 오류를 방지하기 위해 MPlayer를 configure 할 때 --disable-direct3d 옵션을 주어서 DX9 링크 못하게 할 수 있다. 그렇지 않으면 filehippo.com에서 DirectX 9.0c 2006년 12월 릴리스를 받아서 설치해야 한다.



  3. MPlayer의 간단한 명령행 도움말


    mplayer.exe를 처음 실행하면 검은 콘솔 창이 나타나 아래처럼 짧은 도움말이 나온다.


    MPlayer SVN-r29464-snapshot-3.4.5 (C) 2000-2009 MPlayer Team
    Usage: mplayer [options] [url|path/]filename

    Basic options: (complete list in the man page)
    -vo select video output driver ('-vo help' for a list)
    -ao select audio output driver ('-ao help' for a list)
    vcd:// play (S)VCD (Super Video CD) track (raw device, no mount)
    dvd:// play DVD title from device instead of plain file
    -alang/-slang select DVD audio/subtitle language (by 2-char country code)
    -ss seek to given (seconds or hh:mm:ss) position
    -nosound do not play sound
    -fs fullscreen playback (or -vm, -zoom, details in the man page)
    -x -y set display resolution (for use with -vm or -zoom)
    -sub specify subtitle file to use (also see -subfps, -subdelay)
    -playlist specify playlist file
    -vid x -aid y select video (x) and audio (y) stream to play
    -fps x -srate y change video (x fps) and audio (y Hz) rate
    -pp enable postprocessing filter (details in the man page)
    -framedrop enable frame dropping (for slow machines)

    Basic keys: (complete list in the man page, also check input.conf)
    <- or -> seek backward/forward 10 seconds
    down or up seek backward/forward 1 minute
    pgdown or pgup seek backward/forward 10 minutes
    < or > step backward/forward in playlist
    p or SPACE pause movie (press any key to continue)
    q or ESC stop playing and quit program
    + or - adjust audio delay by +/- 0.1 second
    o cycle OSD mode: none / seekbar / seekbar + timer
    * or / increase or decrease PCM volume
    x or z adjust subtitle delay by +/- 0.1 second
    r or t adjust subtitle position up/down, also see -vf expand

    * * * SEE THE MAN PAGE FOR DETAILS, FURTHER (ADVANCED) OPTIONS AND KEYS * * *


    mplayer -vo help 명령은 다음과 같이 어떤 화면 출력 장치가 사용 가능한지 보여 준다.


    MPlayer SVN-r29464-snapshot-3.4.5 (C) 2000-2009 MPlayer Team
    Available video output drivers:
    directx Directx DDraw YUV/RGB/BGR renderer
    direct3d Direct3D 9 Renderer
    gl X11 (OpenGL)
    gl2 X11 (OpenGL) - multiple textures version
    winvidix WIN32 (VIDIX)
    cvidix console VIDIX
    null Null video output
    mpegpes MPEG-PES file
    yuv4mpeg yuv4mpeg output for mjpegtools
    png PNG file
    jpeg JPEG file
    gif89a animated GIF output
    tga Targa output
    pnm PPM/PGM/PGMYUV file
    md5sum md5sum of each frame

    mplayer -ao help 명령은 어떤 음향 출력 장치가 사용 가능한지 보여 준다.


    MPlayer SVN-r29464-snapshot-3.4.5 (C) 2000-2009 MPlayer Team
    Available audio output drivers:
    dsound Windows DirectSound audio output
    win32 Windows waveOut audio output
    mpegpes MPEG-PES audio output
    null Null audio output
    pcm RAW PCM/WAVE file writer audio output


  4. MPlayer 시험


    일단 명령 프롬프트(cmd.exe)나 실행 대화창(Run...)에서 다음과 같은 명령을 입력하여 MPlayer를 테스트해 보자. 위에 보이는 -vo 도움말과 -ao 도움말을 참고하여 자신의 시스템에 가장 알맞은 옵션을 찾아 보자.


    mplayer -vo direct3d -ao dsound -font C:\WINDOWS\FONTS\Tahoma.ttf -framedrop mymoviefile.avi

    또는 좀 느리지만 기본적인 출력 장치로 GL과 win32를 사용해 볼 수 있다.


    mplayer -vo gl -ao win32 Bear.wmv

    샘플 동영상 파일은 인터넷에서 검색하여 받도록 한다. Vista와 Windows 7 사용자는 C:\Users\Public\Videos\Sample Videos 폴더에 있는 샘플 동영상 파일로 MPlayer를 테스트해 볼 수 있다.



  5. MPlayer 설정


    처음으로 MPlayer를 실행하기 전에 HOME 환경변수를 정하여 자신의 폴더를 정해 준다. 그리고 MPlayer를 처음으로 더블클릭하면 사용자의 %HOME% 디렉토리에 “mplayer”라는 폴더가 생기고 그 안에 "config"라는 파일이 있다. "config" 파일에 다음과 같이 설정 사항을 적는다:



    # Write your default config options here!
    cdrom-device=D:
    dvd-device=D:
    ao=dsound
    vo=direct3d
    font=C:\WINDOWS\FONTS\MALGUN.TTF
    framedrop=yes
    subcp=cp949

    Windows 98/ME 사용자는 화면 출력 장치 설정으로 vo=direct3d 대신에 vo=directx 또는 vo=directx:noaccel 라고 적어야 한다. directx:noaccel은 가속 기능이 없는 DirectDraw 출력 장치인데 화면 출력에 문제가 있을 경우에 사용한다.



  6. MPlayer 코덱


    MPlayer 코덱을 받는 게 좋다. 파일 이름은 windows-essential-20071007.zip이다. 압축을 풀면 "windows-essential-20071007" 폴더가 나오는데 "codecs"으로 이름을 바꾸어 mplayer.exe가 있는 폴더로 옮기도록 한다.


    또한, MPlayer 소스의 etc 디렉토리에 codecs.conf 파일이 있을 것이다. 이것을 사용자의 mplayer 폴더에 복사해 놓는다. 그리고 mplayer를 실행하면 메시지 첫머리에 다음과 같이 코덱 숫자가 표시된다.


    MPlayer SVN-r29464-snapshot-3.4.5 (C) 2000-2009 MPlayer Team
    138 audio & 299 video codecs
    Usage: mplayer [options] [url|path/]filename

    이제 다음 명령어를 실행하면 mplayer 코덱에 관한 정보가 나올 것이다.


    mplayer -vc help
    mplayer -ac help


  7. 다음처럼 동영상을 볼 수 있다:

    mplayer mymoviefile.avi > C:\Windows\Temp\error.txt

    이제 남은 일은 SMPlayer를 받아서 MPlayer 인터페이스로 설정하는 것이다.


Thursday, April 1, 2010

윈도용 MPlayer와 Mencoder 정적 컴파일

Windows에서 MPlayer/Mencoder를 컴파일하려면 MinGW 컴파일러가 필요하다. 이 글을 읽고 MinGW를 설치하도록 한다. 이 글은 정적 실행 파일(특별한 DLL에 의존하지 않는 단일 프로그램)을 생성하기 위해 쓰여졌다. 동적 실행 파일을 만들려면 이 글을 읽기 바란다.



시작 메뉴에서 MSYS (rxvt)를 오른쪽 클릭하여 관리자로 실행한다. Windows Vista와 Windows 7에서 문제 없이 컴파일하기 위함이다.




  1. LZO 라이브러리는 빠른 압축 기능으로 순수 비디오를 압축하는 데 쓰인다.

    tar xzvf lzo-2.03.tar.gz
    cd lzo-2.03
    ./configure --prefix=/mingw
    make
    make install

  2. Zlib는 압축 헤더가 붙은 몇몇 mov 파일을 보기 위해 필요하다. zlib.net에서 소스를 받아 컴파일한다:

    cd ~

    tar xjvf zlib-1.2.4.tar.bz2

    cd zlib-1.2.4

    ./configure --prefix=/mingw

    make

    make install


  3. PNG 이미지 라이브러리


    영화 보는 데 PNG 라이브러리가 왜 필요한지 궁금할 것이다. 가끔 영화의 인상적인 부분을 한 장면 한 장면 사진으로 저장하고 싶을 때 쓸 수 있다. PNG 라이브러리 소스를 받아 컴파일하자:


    cd ~
    tar xzvf libpng-1.4.1.tar.gz
    cd libpng-1.4.1/
    ./configure --prefix=/mingw --disable-shared
    make
    make install


  4. Freetype 및 Iconv 라이브러리


    Freetype은 자막 표시에 필요하다. iconv 라이브러리에 의존하므로 먼저 iconv 소스를 받아 컴파일하자:


    cd ~

    tar xvzf libiconv-1.13.1.tar.gz

    cd libiconv-1.13.1

    ./configure --prefix=/mingw --disable-shared

    make

    make install

    그런 다음, Freetype2를 받아 컴파일한다:


    cd ~

    tar xzvf freetype-2.3.12.tar.gz

    cd freetype-2.3.12

    ./configure --prefix=/mingw --disable-shared

    make

    make install


  5. Fontconfig 라이브러리는 SSA 자막 표시에 필요하다. expat 라이브러리에 의존하므로 먼저 expat 라이브러리를 컴파일하자.

    cd ~
    tar xzvf expat-2.0.1.tar.gz
    cd expat-2.0.1/
    ./configure --prefix=/mingw --disable-shared
    make install

    그리고 fontconfig 라이브러리를 컴파일한다.

    cd
    tar xzvf fontconfig-2.8.0.tar.gz
    cd fontconfig-2.8.0/
    ./configure --prefix=/mingw --disable-shared
    make install


  6. Libcdio 소스를 여기서 받아 컴파일하고 설치하자.

    tar xzvf libcdio-0.81.tar.gz

    cd libcdio-0.81

    ./configure --prefix=/mingw --disable-shared

    make

    make install


  7. Libogg, Libvorbis, speex, Theora 컴파일


    libogg, libvorbis, speex 그리고 theora 라이브러리 모두 xiph.org에서 받아 다음과 같이 컴파일하자:


    ./configure --prefix=/mingw --disable-shared

    make

    make install


  8. DirectX 헤더를 아래의 위치에서 받아서:


    MinGW의 include 폴더(예를 들어, C:\MinGW\include)에 압축을 푼다.



  9. MPlayer 정적 컴파일을 위한 configure 명령


    pkg-config.exe와 yasm.exe를 받아서 /mingw/bin에 저장한다. MPlayer 소스를 받아서 풀자:


    tar xjvf mplayer-export-snapshot.tar.bz2
    cd mplayer-export-2009-08-02/

    다음과 같이 configure 명령어를 입력한다.


    ./configure --prefix=/mingw --enable-runtime-cpudetection --enable-static --enable-theora --disable-vidix --yasm=/mingw/bin/yasm


  10. configure가 끝나면 config.mak를 열어서 손보자. MPlayer.exe를 실행할 때 검은 로그 창이 나타나는 현상을 원하지 않는다면 EXTRALIBS_MPLAYER= 행에 -mwindows 추가하도록 한다:

    EXTRALIBS_MPLAYER =  -mwindows -lopengl32 -lgdi32 -lwinmm -ld3d9 -lfaac -lx264 -lmp3lame


  11. MPlayer/Mencoder 컴파일


    드디어 MPlayer 컴파일을 시작한다.


    make

    컴파일이 성공적으로 끝나면 mplayer.exe 그리고 mencoder.exe 두 개의 파일이 생긴다. strip 명령을 쓰면 실행 파일의 크기를 약간 줄일 수 있다.


    strip m*.exe

    UPX로 압축한다.


    upx --best --strip-relocs=0 mplayer.exe
    upx --best --strip-relocs=0 mencder.exe

    가령, C:\Program Files로 복사하도록 한다.


    cp -iv m*.exe /c/Program\ Files



mplayer.exe와 mencoder.exe 두 개의 실행 파일이 성공적으로 만들어졌으니, 이제 MPlayer를 테스트하고 설정하는 일이 남았다.

Monday, June 8, 2009

Compiling Mencoder for Windows

Mencoder is a command-line tool for creating multimedia files. It allows you to convert video from one format to another. When used together with OGMRip, mencoder helps you to rip DVD into a video file that's convenient to watch on computers. Note that the instruction herein explains how to compile Mencoder for the Windows platform, not Linux.



MinGW must be installed first (Look here for how). Once you have MinGW, launch MSYS (rxvt) from the Start menu and type the following commands.




  1. PNG and JPEG


    PNG depends on zlib compression library. Download the zlib source from zlib.net and compile as follows:

    tar xzvf zlib-1.2.3.tar.gz
    cd zlib-1.2.3
    ./configure --prefix=/mingw
    make
    make install

    Now get the PNG library here and compile it as follows:

    tar xzvf libpng-1.2.34.tar.gz
    cd libpng-1.2.34/
    ./configure --prefix=/mingw --disable-shared
    make
    make install

    Download the source for JPEG library, compile and install JPEG as follows:

    tar xzvf jpegsrc.v7.tar.gz
    cd jpeg-7
    ./configure --prefix=/mingw
    make
    make install


  2. libdca Library


    Download the libdca source from videolan.org and compile it like this:


    tar xjvf libdca-0.0.5.tar.bz2
    cd libdca-0.0.5
    ./configure --prefix=/mingw
    make
    make install


  3. OGG, Vorbis and Theora


    The source for these libraries can be obtained from xiph.org. Compile them like this:

    ./configure --prefix=/mingw --disable-shared
    make
    make install


  4. Libcdio Library


    Download the libcdio source from here. Compile and install libcdio as follows:

    tar xzvf libcdio-0.81.tar.gz
    cd libcdio-0.81
    ./configure --prefix=/mingw --disable-shared
    make
    make install


  5. Live555 library


    The Live555 library is used to decode streaming media. Get the live555 source from here and compile it as follows:

    cd /mingw/lib
    tar xzvf live.2009.07.28.tar.gz
    cd live
    ./genMakefiles mingw
    make


  6. LAME


    LAME is an MP3 encoder. This library allows Mencoder to encode DVD sound into MP3 audio. Download LAME from lame.sf.net and compile it as follows.


    ./configure --prefix=/mingw --enable-expopt=full

    make

    make install


  7. TwoLame


    TwoLAME is an MP2 audio encoder. Get the source from twolame.org and compile it:

    ./configure --prefix=/mingw CPPFLAGS='-DLIBTWOLAME_STATIC'
    make
    make install


  8. XviD


    In case you didn't know, XviD is the most popular video encoder used in creating movie files found on the P2P networks. With this library, mencoder can rip a DVD into XviD video. Get the XviD source from xvid.org and compile as follows:


    tar xzvf xvidcore-1.2.2.tar.gz

    cd xvidcore/build/generic

    ./configure --prefix=/mingw

    make

    make install

    In addition, change to the /mingw/bin directory and copy xvidcore.a to libxvidcore.a.


    cd /mingw/lib

    cp xvidcore.a libxvidcore.a


  9. FAAC


    FAAC is an MPEG-4 AAC audio encoder. Get the source (faac-1.28.tar.gz) and unpack the package. Then, edit Makefile.am:

    SUBDIRS = include libfaac

    Also, edit the line beginning with AC_OUTPUT in the file configure.in:

    AC_OUTPUT(libfaac/Makefile include/Makefile Makefile)

    Then, compile FAAC like this

    sh bootstrap
    ./configure --prefix=/mingw --enable-static --disable-shared
    make
    make install


  10. x264


    x264 is yet another good video encoder. x264 requires YASM to build an optimized executable. So get yasm and save it as /mingw/bin/yasm.exe. Then, compile x264 like this:


    sh configure --prefix=/mingw --extra-cflags="-DX264_VERSION=20090608"

    make

    make install


  11. Compiling Mencoder


    Now you're ready to compile mencoder. Download the MPlayer source snapshot from mplayerhq.hu and unpack it. Then, type the following commands into the MSYS window to produce the executable mencoder.exe.


    CPPFLAGS='-DHAVE_INT32_T -DLIBTWOLAME_STATIC'./configure --prefix=/mingw --enable-runtime-cpudetection --enable-static --enable-theora --yasm=/mingw/bin/yasm

    make mencoder

    strip *.exe

    mv -iv mencoder.exe /c/Windows

    This produces a static executable mencoder.exe and copies it into the C:\WINDOWS folder.




If you'd like to try my mencoder build, download it from here. Its filename is MPlayer-svn-r30521-snapshot-3.4.5.zip.

Thursday, June 4, 2009

Building FAAC, XviD, GPAC and OGMRip



After building MPlayer and Mencoder for Linux, the last fun part is to build OGMRip so that we can rip movies into AVI or MP4 files as found on the P2P networks. OGMRip is a graphical movie convertor that uses MPlayer and Mencoder to convert a movie into another format.



Building FAAC


First, let's compile FAAC as it is needed to encode AAC audio. You need a g++ compiler, autoconf, automake and tcl-dev to compile FAAC, following a typical procedure:


./bootstrap
./configure --build=i586-pc-linux-gnu --prefix=/usr --with-mp4v2
make
make install

The bootstrap command produces the configure script and Makefile necessary for the build procedure. The following set of files are generated upon compilation of FAAC:


/usr/bin/faac
/usr/include/faac.h
/usr/include/faaccfg.h
/usr/lib/libfaac.a
/usr/lib/libfaac.la
/usr/lib/libfaac.so
/usr/lib/libfaac.so.0
/usr/lib/libfaac.so.0.0.0
/usr/man/man1/faac.1.gz


Building XviD library


Now, let's build the XviD library. XviD is a popular video codec. A typical build procedure for XviD looks like this:


tar xzf xvidcore-1.2.2.tar.gz
cd xvidcore/build/generic
./configure --build=i586-pc-linux-gnu --prefix=/usr
make
make install

Upon successful compilation, the following set of files are installed on system.


/usr/lib/libxvidcore.a
/usr/include/xvid.h
/usr/lib/libxvidcore.so
/usr/lib/libxvidcore.so.4
/usr/lib/libxvidcore.so.4.1


Building GPAC


Next, let's compile GPAC which is an open-source MPEG-4 encoder. Before compiling GPAC, install the following developer libraries, most of which are optional:


liba52-0.7.4-dev
libasound2-dev
libavformat-dev
libfaad-dev
libmad0-dev
libmozjs-dev
libogg-dev
libopenjpeg-dev
libssl-dev
libtheora-dev
libvorbis-dev
libwxgtk2.8-0
libxvidcore4

Then, compile GPAC as follows:


./configure --prefix=/usr/local --cpu=i586 --enable-pic --strip --use-ffmpeg=local --use-js=local

make

make install

When GPAC is compiled and installed successfully, the following set of files are generated on the system:


/usr/bin/MP4Box
/usr/bin/MP4Client
/usr/bin/Osmo4
/usr/lib/gpac/gm_aac_in.so
/usr/lib/gpac/gm_ac3_in.so
/usr/lib/gpac/gm_alsa.so
/usr/lib/gpac/gm_bifs_dec.so
/usr/lib/gpac/gm_ctx_load.so
/usr/lib/gpac/gm_dummy_in.so
/usr/lib/gpac/gm_ffmpeg_in.so
/usr/lib/gpac/gm_ft_font.so
/usr/lib/gpac/gm_gpac_js.so
/usr/lib/gpac/gm_img_in.so
/usr/lib/gpac/gm_ismacryp.so
/usr/lib/gpac/gm_isom_in.so
/usr/lib/gpac/gm_laser_dec.so
/usr/lib/gpac/gm_mp3_in.so
/usr/lib/gpac/gm_mpegts_in.so
/usr/lib/gpac/gm_odf_dec.so
/usr/lib/gpac/gm_ogg_xiph.so
/usr/lib/gpac/gm_oss_audio.so
/usr/lib/gpac/gm_raw_out.so
/usr/lib/gpac/gm_rtp_in.so
/usr/lib/gpac/gm_saf_in.so
/usr/lib/gpac/gm_soft_raster.so
/usr/lib/gpac/gm_svg_in.so
/usr/lib/gpac/gm_timedtext.so
/usr/lib/gpac/gm_x11_out.so
/usr/lib/gpac/gm_xvid_dec.so
/usr/lib/libgpac-0.4.5.so
/usr/lib/libgpac.so
/usr/man/man1/gpac.1.gz
/usr/man/man1/mp4box.1.gz
/usr/man/man1/mp4client.1.gz
/usr/share/gpac/gpac.mp4

If you encounter the following error during compilation:


scenegraph/vrml_smjs.c:41:20: error: jsapi.h: No such file or directory

make symlinks to jsapi.h and compile again as follows:


cd include/

ln -s ../extra_lib/include/js/* .

cd ..

./configure --prefix=/usr --cpu=i586 --enable-pic --strip --use-ffmpeg=local --use-js=local --extra-cflags=-DXP_UNIX

make

make install

Some programs require the gpac static library libgpac_static.a. This file is not installed by default. However, you can copy it manually:


cp bin/gcc/libgpac_static.a usr/lib


Building OGMRip


Finally, let's build OGMRip. First, make sure you have the following developer libraries:


libdbus-glib-1-dev
libdvdread-dev
libenca-dev
libenchant-dev
libgconf2-dev
libglade2-dev
libgtk2.0-dev
libhal-dev
libnotify-dev
libstdc++6-4.4-dev
libtheora-dev

Optionally, install intltool, gtk-doc and xsltproc for internationalization and documentation. Then, build OGMRip as follows:


./configure --prefix=/usr/local --build=i586-pc-linux-gnu --sysconfdir=/etc --enable-gtk-doc --with-ocr=auto

make

make install

After OGMRip is compiled and installed successfully, the following set of files are generated on system:


/etc/gconf/schemas/ogmrip.schemas
/usr/bin/avibox
/usr/bin/dvdcpy
/usr/bin/ogmrip
/usr/bin/subp2pgm
/usr/bin/subp2png
/usr/bin/subp2tiff
/usr/bin/subptools
/usr/bin/theoraenc
/usr/include/ogmdvd/
/usr/include/ogmjob/
/usr/include/ogmrip/
/usr/lib/libogmdvd-gtk.a
/usr/lib/libogmdvd-gtk.la
/usr/lib/libogmdvd-gtk.so
/usr/lib/libogmdvd-gtk.so.0
/usr/lib/libogmdvd-gtk.so.0.0.0
/usr/lib/libogmdvd.a
/usr/lib/libogmdvd.la
/usr/lib/libogmdvd.so
/usr/lib/libogmdvd.so.0
/usr/lib/libogmdvd.so.0.0.0
/usr/lib/libogmjob.a
/usr/lib/libogmjob.la
/usr/lib/libogmjob.so
/usr/lib/libogmjob.so.0
/usr/lib/libogmjob.so.0.0.0
/usr/lib/libogmrip-gtk.a
/usr/lib/libogmrip-gtk.la
/usr/lib/libogmrip-gtk.so
/usr/lib/libogmrip-gtk.so.0
/usr/lib/libogmrip-gtk.so.0.0.0
/usr/lib/libogmrip-lavc.a
/usr/lib/libogmrip-lavc.la
/usr/lib/libogmrip-lavc.so
/usr/lib/libogmrip-lavc.so.0
/usr/lib/libogmrip-lavc.so.0.0.0
/usr/lib/libogmrip-mplayer.a
/usr/lib/libogmrip-mplayer.la
/usr/lib/libogmrip-mplayer.so
/usr/lib/libogmrip-mplayer.so.0
/usr/lib/libogmrip-mplayer.so.0.0.0
/usr/lib/libogmrip.a
/usr/lib/libogmrip.la
/usr/lib/libogmrip.so
/usr/lib/libogmrip.so.0
/usr/lib/libogmrip.so.0.0.0
/usr/lib/ogmrip/
/usr/lib/pkgconfig/ogmdvd-gtk.pc
/usr/lib/pkgconfig/ogmdvd.pc
/usr/lib/pkgconfig/ogmjob.pc
/usr/lib/pkgconfig/ogmrip-gtk.pc
/usr/lib/pkgconfig/ogmrip.pc
/usr/share/applications/ogmrip.desktop
/usr/share/doc/ogmrip/
/usr/share/gtk-doc/html/ogmdvd-gtk
/usr/share/gtk-doc/html/ogmdvd/
/usr/share/gtk-doc/html/ogmjob/
/usr/share/gtk-doc/html/ogmrip-gtk/
/usr/share/gtk-doc/html/ogmrip/
/usr/share/locale/ca/LC_MESSAGES/ogmrip.mo
/usr/share/locale/cs/LC_MESSAGES/ogmrip.mo
/usr/share/locale/de/LC_MESSAGES/ogmrip.mo
/usr/share/locale/fr/LC_MESSAGES/ogmrip.mo
/usr/share/locale/sv/LC_MESSAGES/ogmrip.mo
/usr/share/man/man1/avibox.1.gz
/usr/share/man/man1/dvdcpy.1.gz
/usr/share/man/man1/subp2pgm.1.gz
/usr/share/man/man1/subptools.1.gz
/usr/share/ogmrip/
/usr/share/pixmaps/ogmrip.png

Now that you've compiled OGMRip, go ahead and test it. Be sure that mplayer, mencoder, ogmtools, vorbis-tools, gpac, faac, lame, mkvtoolnix and gocr (or ocrad) are installed, also.


OGMRip Video Convertor Options

About This Blog

KBlog logo This blog seeks to share useful information on freely available fonts on the Internet. Thanks for visiting the blog and posting your comments.

© Contents by KBlog

© Blogger template by Emporium Digital 2008

Followers

Total Pageviews

CyberChimps Professional WordPress Themes
Powered By Blogger