linux - ffmpeg + docker: make install not installing libx265 when building the image, but works inside container - Stack Overflo

I have this DockerfileFROM ubuntu:22.04WORKDIR usrlocalsrcENV PKG_CONFIG_PATH=usrlocallibpkgcon

I have this Dockerfile

FROM ubuntu:22.04

WORKDIR /usr/local/src

ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

RUN apt update && apt install -y \
    build-essential cmake git pkg-config \
    libxml2-dev yasm nasm libtool autoconf automake \
    libx264-dev libx265-dev libnuma-dev libvpx-dev \
    libfdk-aac-dev libmp3lame-dev libopus-dev \
    libass-dev libfreetype6-dev libvorbis-dev

RUN apt-get install libx265-dev

RUN git clone --depth 1 .git && \
    cd vvenc && \
    mkdir build && cd build && \
    cmake .. -DCMAKE_BUILD_TYPE=Release && \
    make -j$(nproc)
  
RUN cd vvenc && \
    make install install-prefix=/usr/local
  

RUN git clone --depth 1 .git ffmpeg 

RUN cd ffmpeg && \
    ./configure --enable-libx265 --enable-gpl --enable-nonfree --enable-pthreads --enable-pic --enable-shared \
                --enable-rpath --enable-demuxer=dash \
                --enable-libxml2 --enable-libvvenc --extra-libs=-lpthread && \
    make -j$(nproc)

RUN cd ffmpeg && make install

RUN rm -rf /var/lib/apt/lists/*

# Some other irrelevant commands

It works for VVenC. As for works, i mean that i can enter the container with /bin/bash, execute ffmpeg -codecs | grep vvc and this is the response:

 DEV.L. vvc                  H.266 / VVC (Versatile Video Coding) (encoders: libvvenc)

But for libx265 it's not working.

ffmpeg -codecs | grep x265 

In another try:

ffmpeg -codecs | grep 265
 DEV.L. hevc                 H.265 / HEVC (High Efficiency Video Coding) (decoders: hevc hevc_v4l2m2m) (encoders: hevc_v4l2m2m)

After i enter the ffmpeg directory again and execute make install it works.

root@0a2ad1086abd:/usr/local/src# cd ffmpeg
root@0a2ad1086abd:/usr/local/src/ffmpeg# make install
... installation logs ...
root@0a2ad1086abd:/usr/local/src/ffmpeg# ffmpeg -codecs | grep x265
 DEV.L. hevc                 H.265 / HEVC (High Efficiency Video Coding) (decoders: hevc hevc_v4l2m2m) (encoders: libx265 hevc_v4l2m2m)

Is there anything i can do here? I tried separating layers, unifying... I really don't know what else should i do.

I have this Dockerfile

FROM ubuntu:22.04

WORKDIR /usr/local/src

ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

RUN apt update && apt install -y \
    build-essential cmake git pkg-config \
    libxml2-dev yasm nasm libtool autoconf automake \
    libx264-dev libx265-dev libnuma-dev libvpx-dev \
    libfdk-aac-dev libmp3lame-dev libopus-dev \
    libass-dev libfreetype6-dev libvorbis-dev

RUN apt-get install libx265-dev

RUN git clone --depth 1 https://github/fraunhoferhhi/vvenc.git && \
    cd vvenc && \
    mkdir build && cd build && \
    cmake .. -DCMAKE_BUILD_TYPE=Release && \
    make -j$(nproc)
  
RUN cd vvenc && \
    make install install-prefix=/usr/local
  

RUN git clone --depth 1 https://github/FFmpeg/FFmpeg.git ffmpeg 

RUN cd ffmpeg && \
    ./configure --enable-libx265 --enable-gpl --enable-nonfree --enable-pthreads --enable-pic --enable-shared \
                --enable-rpath --enable-demuxer=dash \
                --enable-libxml2 --enable-libvvenc --extra-libs=-lpthread && \
    make -j$(nproc)

RUN cd ffmpeg && make install

RUN rm -rf /var/lib/apt/lists/*

# Some other irrelevant commands

It works for VVenC. As for works, i mean that i can enter the container with /bin/bash, execute ffmpeg -codecs | grep vvc and this is the response:

 DEV.L. vvc                  H.266 / VVC (Versatile Video Coding) (encoders: libvvenc)

But for libx265 it's not working.

ffmpeg -codecs | grep x265 

In another try:

ffmpeg -codecs | grep 265
 DEV.L. hevc                 H.265 / HEVC (High Efficiency Video Coding) (decoders: hevc hevc_v4l2m2m) (encoders: hevc_v4l2m2m)

After i enter the ffmpeg directory again and execute make install it works.

root@0a2ad1086abd:/usr/local/src# cd ffmpeg
root@0a2ad1086abd:/usr/local/src/ffmpeg# make install
... installation logs ...
root@0a2ad1086abd:/usr/local/src/ffmpeg# ffmpeg -codecs | grep x265
 DEV.L. hevc                 H.265 / HEVC (High Efficiency Video Coding) (decoders: hevc hevc_v4l2m2m) (encoders: libx265 hevc_v4l2m2m)

Is there anything i can do here? I tried separating layers, unifying... I really don't know what else should i do.

Share Improve this question asked Mar 13 at 21:39 Alexander SantosAlexander Santos 1,72115 silver badges32 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I was being way too dumb. As i was using volumes, in one of my tests i cloned ffmpeg into my system. This was replicating it inside the container (which was why it was working when inside container).

I got no errors or anything because docker was using a cached image (one of the first versions). I deleted it and rebuilt, then it started to blame the problems i had. I adjusted the builds to be in same layer again and then built it, then it started to work.

If you find yourself lost like i was, try pruning the images. I was using --no-cache but for some reason it was still caching the old file.

Also a tip, cmake uses -DCMAKE_INSTALL_PREFIX not the prefix path like i used in the question

-DCMAKE_INSTALL_PREFIX=/usr/local

So this also helped

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744683881a4587796.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信