Skip to content

Instantly share code, notes, and snippets.

@9bic
Last active February 26, 2016 08:20
Show Gist options
  • Save 9bic/fcd3db1c8bc0a8d10f26 to your computer and use it in GitHub Desktop.
Save 9bic/fcd3db1c8bc0a8d10f26 to your computer and use it in GitHub Desktop.
localhost に ffmpeg をインストールする playbook
- hosts: localhost
user: root
vars:
src_dir: "/usr/local/src/ffmpeg_sources"
tasks:
- name: "install Dependences"
yum: name={{ item }} state=installed
with_items:
- make
- openssl-devel
- git
- autoconf
- automake
- gcc
- gcc-c++
- libtool
- nasm
- pkgconfig
- zlib-devel
- name: "create src directory"
file: path={{ src_dir }} state=directory
- name: "checking installed yasm"
command: which yasm
ignore_errors: true
register: yasm_installed
- name: "clone yasm"
git: repo=git://github.com/yasm/yasm.git dest={{src_dir}}/yasm depth=1
when: yasm_installed|failed
- name: "make yasm"
shell: "chdir={{src_dir}}/yasm {{ item }}"
with_items:
- autoreconf -fiv
- ./configure --prefix="/usr/local/ffmpeg_build" --bindir="/usr/local/bin"
- make
- make install
- make distclean
when: yasm_installed|failed
- name: "checking installed x264"
command: which x264
ignore_errors: true
register: x264_installed
- name: "clone x264"
git: repo=git://git.videolan.org/x264 dest={{src_dir}}/x264 depth=1
when: x264_installed|failed
- name: "make x264"
shell: "chdir={{src_dir}}/x264 {{ item }}"
with_items:
- ./configure --prefix="/usr/local/ffmpeg_build" --bindir="/usr/local/bin" --enable-static
- make
- make install
- make distclean
when: x264_installed|failed
- name: "clone fdk-aac"
git: repo=git://git.code.sf.net/p/opencore-amr/fdk-aac dest={{src_dir}}/fdk-aac depth=1 force=true
- name: "make fdk-aac"
shell: "chdir={{src_dir}}/fdk-aac {{ item }}"
with_items:
- autoreconf -fiv
- ./configure --prefix="/usr/local/ffmpeg_build" --disable-shared
- make
- make install
- make distclean
- name: "checking installed lame"
command: which lame
ignore_errors: true
register: lame_installed
- name: "download lame"
shell: "chdir={{src_dir}} {{item}}"
with_items:
- curl -L -O http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
- tar xzvf lame-3.99.5.tar.gz
when: lame_installed|failed
- name: "make lame"
shell: "chdir={{src_dir}}/lame-3.99.5 {{ item }}"
with_items:
- ./configure --bindir="/usr/local/bin" --disable-shared --enable-nasm
- make
- make install
- make distclean
when: lame_installed|failed
- name: "clone opus"
git: repo=git://git.opus-codec.org/opus.git dest={{src_dir}}/opus depth=1 force=true
- name: " make opus"
shell: "chdir={{src_dir}}/opus {{ item }}"
with_items:
- autoreconf -fiv
- ./configure --prefix="/usr/local/ffmpeg_build" --disable-shared
- make
- make install
- make distclean
- name: "download libogg"
shell: "chdir={{src_dir}} {{item}}"
with_items:
- curl -O http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz
- tar xzvf libogg-1.3.2.tar.gz
- name: "make libogg"
shell: "chdir={{src_dir}}/libogg-1.3.2 {{ item }}"
with_items:
- ./configure --prefix="/usr/local/ffmpeg_build" --disable-shared
- make
- make install
- make distclean
- name: "download orbis"
shell: "chdir={{src_dir}} {{item}}"
with_items:
- curl -O http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.gz
- tar xzvf libvorbis-1.3.4.tar.gz
- name: "make orbis"
shell: "chdir={{src_dir}}/libvorbis-1.3.4 {{ item }}"
with_items:
- ./configure --prefix="/usr/local/ffmpeg_build" --with-ogg="/usr/local/ffmpeg_build" --disable-shared
- make
- make install
- make distclean
- name: "clone vpx"
git: repo=https://github.com/webmproject/libvpx.git dest={{src_dir}}/libvpx depth=1 force=true
- name: "make vpx"
shell: "chdir={{src_dir}}/libvpx {{ item }}"
with_items:
- ./configure --prefix="/usr/local/ffmpeg_build" --disable-examples
- make
- make install
- make clean
- name: "checking ffmpeg installed"
command: which ffmpeg
ignore_errors: true
register: ffmpeg_installed
- name: "clone ffmpeg"
git: repo=git://source.ffmpeg.org/ffmpeg dest={{src_dir}}/ffmpeg depth=1
when: ffmpeg_installed|failed
- name: "make ffmpeg"
shell: "chdir={{src_dir}}/ffmpeg {{ item }}"
with_items:
- ./configure --prefix="/usr/local/ffmpeg_build" --extra-cflags="-I/usr/local/ffmpeg_build/include" --extra-ldflags="-L/usr/local/ffmpeg_build/lib" --bindir="/usr/local/bin" --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264
- make
- make install
- make distclean
- hash -r
environment:
PKG_CONFIG_PATH: /usr/local/ffmpeg_build/lib/pkgconfig
when: ffmpeg_installed|failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment