다음을 사용하여 소스에서 FFMPEG를 컴파일하고 있습니다.우분투 가이드이전에 성공적으로 사용했던 것입니다.
Ubuntu 서버 14.04의 VirtualBox에서 Vagrant 가상 머신을 컴파일하고 있습니다. 프로젝트와 을 복제하면 vagrant up
상자에 FFMPEG가 설치됩니다.github.com/rfkrocktk/vagrant-ffmpeg.
저는 Ansible을 사용하여 컴파일을 자동화하고 있으므로 모든 단계를 볼 수 있습니다.여기:
---
- hosts: all
tasks:
# version control
- apt: name=git
- apt: name=mercurial
# build tools
- apt: name=build-essential
- apt: name=autoconf
- apt: name=automake
- apt: name=cmake
- apt: name=pkg-config
- apt: name=texinfo
- apt: name=yasm
# libraries
- apt: name=libass-dev
- apt: name=libfreetype6-dev
- apt: name=libsdl1.2-dev
- apt: name=libtheora-dev
- apt: name=libtool
- apt: name=libva-dev
- apt: name=libvdpau-dev
- apt: name=libvorbis-dev
- apt: name=libxcb1-dev
- apt: name=libxcb-shm0-dev
- apt: name=libxcb-xfixes0-dev
- apt: name=zlib1g-dev
- apt: name=libopus-dev
- apt: name=libmp3lame-dev
- apt: name=libx264-dev
# dependent libraries
# libx265
- name: clone libx265
command: hg clone https://bitbucket.org/multicoreware/x265 /usr/src/x265
args:
creates: /usr/src/x265
- name: configure libx265
command: cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/usr/local -DENABLED_SHARED:bool=off ../../source
args:
chdir: /usr/src/x265/build/linux
creates: /usr/src/x265/build/linux/Makefile
- name: compile libx265
command: make -j2
args:
chdir: /usr/src/x265/build/linux
creates: /usr/src/x265/build/linux/x265
- name: install libx265
command: make install
args:
chdir: /usr/src/x265/build/linux
creates: /usr/local/bin/x265
# libfdk-aac
- name: clone libfdk-aac
command: git clone https://github.com/mstorsjo/fdk-aac.git /usr/src/libfdk-aac
args:
creates: /usr/src/libfdk-aac
- name: autoconf libfdk-aac
command: autoreconf -fiv
args:
chdir: /usr/src/libfdk-aac
creates: /usr/src/libfdk-aac/configure
- name: configure libfdk-aac
command: /usr/src/libfdk-aac/configure --prefix=/usr/local --disable-shared
args:
chdir: /usr/src/libfdk-aac
creates: /usr/src/libfdk-aac/libtool
- name: compile libfdk-aac
command: make -j2
args:
chdir: /usr/src/libfdk-aac
creates: /usr/src/libfdk-aac/libFDK/src/FDK_core.o
- name: install libfdk-aac
command: make install
args:
chdir: /usr/src/libfdk-aac
creates: /usr/local/lib/libfdk-aac.a
# libvpx
- name: download libvpx
shell: wget -O - https://storage.googleapis.com/downloads.webmproject.org/releases/webm/libvpx-1.4.0.tar.bz2 | tar xjvf -
args:
chdir: /usr/src
creates: /usr/src/libvpx-1.4.0
- name: configure libvpx
command: ./configure --prefix=/usr/local --disable-examples --disable-unit-tests
args:
chdir: /usr/src/libvpx-1.4.0
creates: /usr/src/libvpx-1.4.0/Makefile
- name: compile libvpx
command: make -j2
args:
chdir: /usr/src/libvpx-1.4.0
creates: /usr/src/libvpx-1.4.0/libvpx.a
- name: install libvpx
command: make install
args:
chdir: /usr/src/libvpx-1.4.0
creates: /usr/local/lib/libvpx.a
# ffmpeg itself
- name: download ffmpeg
shell: wget -O - "https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2" | tar xjvf -
args:
chdir: /usr/src
creates: /usr/src/ffmpeg
- name: configure ffmpeg
shell: PKG_CONFIG_PATH=/usr/local/lib/pkgconfig /usr/src/ffmpeg/configure \
--prefix=/usr/local \
--pkg-config-flags='--static' \
--bindir=/usr/local/bin \
--enable-gpl --enable-version3 --enable-nonfree \
--enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame \
--enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx \
--enable-libx264 --enable-libx265
args:
chdir: /usr/src/ffmpeg
creates: /usr/src/ffmpeg/config.asm
- name: compile ffmpeg
command: make -j2
args:
chdir: /usr/src/ffmpeg
creates: /usr/src/ffmpeg/ffmpeg
- name: install ffmpeg
command: make install
args:
chdir: /usr/src/ffmpeg
creates: /usr/local/bin/ffmpeg
Ansible을 모르더라도 이것이 무엇을 하는지 명확하게 알 수 있기를 바랍니다.
ffmpeg
내가 겪고 있는 문제는 이 모든 작업이 성공적으로 실행된 후에도 컴퓨터 내에서 실행할 때 다음 오류가 발생한다는 것입니다 .
ffmpeg: error while loading shared libraries: libx265.so.77: cannot open shared object file: No such file or directory
파일을 명확하게 찾을 수 있습니다.
$ find /usr -iname libx265.so.77
/usr/local/lib/libx265.so.77
왜 이것이 발견되지 않습니까? 편집 가이드에 뭔가 빠졌나요? 나는 내 바이너리가 인간적으로 가능한 한 이식성이 있기를 바랍니다.
편집하다
출력 ldd $(which ffmpeg)
:
linux-vdso.so.1 => (0x00007fff552ea000)
libva.so.1 => /usr/lib/x86_64-linux-gnu/libva.so.1 (0x00007f2fb3b45000)
libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f2fb3926000)
libxcb-shm.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007f2fb3722000)
libxcb-xfixes.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-xfixes.so.0 (0x00007f2fb351b000)
libxcb-shape.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-shape.so.0 (0x00007f2fb3317000)
libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f2fb2fe1000)
libasound.so.2 => /usr/lib/x86_64-linux-gnu/libasound.so.2 (0x00007f2fb2cf1000)
libSDL-1.2.so.0 => /usr/lib/x86_64-linux-gnu/libSDL-1.2.so.0 (0x00007f2fb2a5b000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f2fb2754000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f2fb2536000)
libx265.so.77 => not found
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f2fb232d000)
libx264.so.142 => /usr/lib/x86_64-linux-gnu/libx264.so.142 (0x00007f2fb1f97000)
libvorbisenc.so.2 => /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2 (0x00007f2fb1ac8000)
libvorbis.so.0 => /usr/lib/x86_64-linux-gnu/libvorbis.so.0 (0x00007f2fb189a000)
libtheoraenc.so.1 => /usr/lib/x86_64-linux-gnu/libtheoraenc.so.1 (0x00007f2fb165a000)
libtheoradec.so.1 => /usr/lib/x86_64-linux-gnu/libtheoradec.so.1 (0x00007f2fb1441000)
libopus.so.0 => /usr/lib/x86_64-linux-gnu/libopus.so.0 (0x00007f2fb11f8000)
libmp3lame.so.0 => /usr/lib/x86_64-linux-gnu/libmp3lame.so.0 (0x00007f2fb0f6b000)
libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f2fb0cc8000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f2fb0aae000)
libass.so.4 => /usr/lib/x86_64-linux-gnu/libass.so.4 (0x00007f2fb088a000)
libvdpau.so.1 => /usr/lib/x86_64-linux-gnu/libvdpau.so.1 (0x00007f2fb0686000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2fb02bf000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f2fb00bb000)
libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f2fafeb7000)
libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f2fafcb0000)
/lib64/ld-linux-x86-64.so.2 (0x00007f2fb3d66000)
libpulse-simple.so.0 => /usr/lib/x86_64-linux-gnu/libpulse-simple.so.0 (0x00007f2fafaac000)
libpulse.so.0 => /usr/lib/x86_64-linux-gnu/libpulse.so.0 (0x00007f2faf862000)
libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f2faf650000)
libcaca.so.0 => /usr/lib/x86_64-linux-gnu/libcaca.so.0 (0x00007f2faf383000)
libogg.so.0 => /usr/lib/x86_64-linux-gnu/libogg.so.0 (0x00007f2faf179000)
libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007f2faef53000)
libfribidi.so.0 => /usr/lib/x86_64-linux-gnu/libfribidi.so.0 (0x00007f2faed3b000)
libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f2faeaff000)
libenca.so.0 => /usr/lib/x86_64-linux-gnu/libenca.so.0 (0x00007f2fae8cc000)
libpulsecommon-4.0.so => /usr/lib/x86_64-linux-gnu/pulseaudio/libpulsecommon-4.0.so (0x00007f2fae664000)
libjson-c.so.2 => /lib/x86_64-linux-gnu/libjson-c.so.2 (0x00007f2fae45a000)
libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007f2fae214000)
libslang.so.2 => /lib/x86_64-linux-gnu/libslang.so.2 (0x00007f2fade84000)
libncursesw.so.5 => /lib/x86_64-linux-gnu/libncursesw.so.5 (0x00007f2fadc50000)
libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f2fada26000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f2fad7fc000)
libwrap.so.0 => /lib/x86_64-linux-gnu/libwrap.so.0 (0x00007f2fad5f1000)
libsndfile.so.1 => /usr/lib/x86_64-linux-gnu/libsndfile.so.1 (0x00007f2fad389000)
libasyncns.so.0 => /usr/lib/x86_64-linux-gnu/libasyncns.so.0 (0x00007f2fad183000)
libnsl.so.1 => /lib/x86_64-linux-gnu/libnsl.so.1 (0x00007f2facf68000)
libFLAC.so.8 => /usr/lib/x86_64-linux-gnu/libFLAC.so.8 (0x00007f2facd37000)
libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f2facb1b000)
출력 file /usr/local/lib/libx265.so.77
:
/usr/local/lib/libx265.so.77: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=f91388281cc2dba1dfe37797324dc6b3898d8d1b, not stripped
LD_LIBRARY_PATH
환경 변수에 정의되어 있지 않습니다.
또한 이것은:
$ grep -r local /etc/ld.so.conf.d/
/etc/ld.so.conf.d/libc.conf:/usr/local/lib
내 작업 이론은 Ansible command
모듈이 환경 변수를 제거하기 때문에 모든 것이 중단된다는 것입니다.
FFMPEG 또는 x265 빌드에 문제가 있다고 생각합니다. --enable-libx265
FFMPEG 구성 명령을 제거했고 이제 FFMPEG가 작동하고 있습니다.
답변1
내 문제는 모든 것을 설치한 후 실행한 적이 없다는 사실에 있었습니다 ldconfig
.
Debian에서 공유 개체 라이브러리를 찾으려면 실행하여 sudo ldconfig
공유 라이브러리 캐시를 다시 빌드해야 합니다.