jrottenberg / ffmpeg

Docker build for FFmpeg on Ubuntu / Alpine / Centos / Scratch / nvidia / vaapi
https://hub.docker.com/r/jrottenberg/ffmpeg/
Apache License 2.0
1.42k stars 455 forks source link

All NVIDIA images not working #294

Closed KaHooli closed 3 years ago

KaHooli commented 3 years ago

Hi, all the NVIDIA images aren't working as they need either Libc6 2.28 or 2.29, but as the base images are Ubuntu 18.04, the highest Libc6 that can be installed is 2.27, as can be seen here.

root@5c4cfd61aaee:/# ffmpeg
ffmpeg: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /usr/local/lib/libavdevice.so.58)
ffmpeg: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/libavfilter.so.7)
ffmpeg: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /usr/local/lib/libavformat.so.58)
ffmpeg: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/libavcodec.so.58)
ffmpeg: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/libswresample.so.3)
ffmpeg: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/libswscale.so.5)
ffmpeg: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/libavutil.so.56)
ffmpeg: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /usr/local/lib/libavutil.so.56)
ffmpeg: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/libass.so.9)
ffmpeg: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/libvidstab.so.1.1)
ffmpeg: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/libsrt.so.1)
ffmpeg: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/libvpx.so.6)
ffmpeg: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/libaom.so.0)
ffmpeg: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/libfdk-aac.so.1)
ffmpeg: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/libmp3lame.so.0)
ffmpeg: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/libopenjp2.so.7)
ffmpeg: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/libopus.so.0)
ffmpeg: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/libvorbis.so.0)
ffmpeg: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/libwebp.so.7)
ffmpeg: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/libx264.so.148)
ffmpeg: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/libx265.so.176)
ffmpeg: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/libxvidcore.so.4)
ffmpeg: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/libkvazaar.so.4)
ffmpeg: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by /usr/local/lib/libxml2.so.2)
root@5c4cfd61aaee:/# cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.5 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.5 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

Can the base image please be upgraded to Ubuntu 20.04?

jrottenberg commented 3 years ago

@KaHooli can you confirm it's all good with the latest images ?

csreynolds commented 3 years ago

I got a 'works on my box' for ya! Can't speak for any other config.

NOTE: When I was testing myself before your checkin last week, I had to add the following line to the dockerfile to get it to build or it would hang waiting for input when updating/installing tzdata:

ENV         DEBIAN_FRONTEND=nonintercative

2nd note: FFmpeg output from the 2004 docker says built on 1804, which would explain the noninteractive bit not checked in on your side.

CentOS7 w/ a P2000

[creynolds@masterblaster ~]$ cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
[creynolds@masterblaster ~]$ rpm -qa | grep nvidia
libnvidia-container-tools-1.4.0-1.x86_64
nvidia-driver-cuda-460.84-1.el7.x86_64
nvidia-container-toolkit-1.5.1-2.x86_64
nvidia-container-runtime-3.5.0-1.x86_64
nvidia-driver-libs-460.84-1.el7.x86_64
nvidia-driver-NVML-460.84-1.el7.x86_64
nvidia-driver-cuda-libs-460.84-1.el7.x86_64
nvidia-driver-libs-460.84-1.el7.i686
libnvidia-container1-1.4.0-1.x86_64
nvidia-docker2-2.6.0-1.noarch
kmod-nvidia-460.84-1.el7.x86_64
nvidia-persistenced-460.84-1.el7.x86_64
nvidia-kmod-common-460.84-1.el7.noarch
nvidia-driver-460.84-1.el7.x86_64
[creynolds@masterblaster ~]$ rpm -qa | grep docker
docker-ce-20.10.7-3.el7.x86_64
docker-ce-cli-20.10.7-3.el7.x86_64
docker-scan-plugin-0.8.0-3.el7.x86_64
nvidia-docker2-2.6.0-1.noarch
docker-ce-rootless-extras-20.10.7-3.el7.x86_64
[creynolds@masterblaster ~]$ INPUT="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
[creynolds@masterblaster ~]$ OUTPUT="output.mkv"
[creynolds@masterblaster ~]$ docker run --gpus all -v $(pwd):$(pwd) -w $(pwd) jrottenberg/ffmpeg:4.4-nvidia2004 -hwaccel cuvid -c:v h264_cuvid -i ${INPUT} -vf scale_npp=1280:-1 -c:v h264_nvenc -b:v 2048k  -y ${OUTPUT}
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libass --enable-fontconfig --enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --enable-libbluray --enable-libzmq --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-libopenjpeg --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-libsrt --enable-libaribb24 --enable-nvenc --enable-cuda --enable-cuvid --enable-libnpp --extra-cflags='-I/opt/ffmpeg/include -I/opt/ffmpeg/include/ffnvcodec -I/usr/local/cuda/include/' --extra-ldflags='-L/opt/ffmpeg/lib -L/usr/local/cuda/lib64 -L/usr/local/cuda/lib32/'
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
WARNING: defaulting hwaccel_output_format to cuda for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format cuda".
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    creation_time   : 2010-01-10T08:29:06.000000Z
  Duration: 00:09:56.47, start: 0.000000, bitrate: 2119 kb/s
  Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2010-01-10T08:29:06.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
      vendor_id       : [0][0][0][0]
  Stream #0:1(und): Video: h264 (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1991 kb/s, 24 fps, 24 tbr, 24k tbn, 48 tbc (default)
    Metadata:
      creation_time   : 2010-01-10T08:29:06.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:1 -> #0:0 (h264 (h264_cuvid) -> h264 (h264_nvenc))
  Stream #0:0 -> #0:1 (aac (native) -> vorbis (libvorbis))
Press [q] to stop, [?] for help
Output #0, matroska, to 'output.mkv':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomavc1mp42
    encoder         : Lavf58.76.100
  Stream #0:0(und): Video: h264 (H264 / 0x34363248), cuda(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 2048 kb/s, 24 fps, 1k tbn (default)
    Metadata:
      creation_time   : 2010-01-10T08:29:06.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
      vendor_id       : [0][0][0][0]
      encoder         : Lavc58.134.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/2048000 buffer size: 4096000 vbv_delay: N/A
  Stream #0:1(und): Audio: vorbis (oV[0][0] / 0x566F), 44100 Hz, stereo, fltp (default)
    Metadata:
      creation_time   : 2010-01-10T08:29:06.000000Z
      handler_name    : (C) 2007 Google Inc. v08.13.2007.
      vendor_id       : [0][0][0][0]
      encoder         : Lavc58.134.100 libvorbis
frame=14315 fps=630 q=20.0 Lsize=  155690kB time=00:09:56.45 bitrate=2138.3kbits/s speed=26.2x
video:148336kB audio:7051kB subtitle:0kB other streams:0kB global headers:4kB muxing overhead: 0.194863%
[creynolds@masterblaster ~]$ ls -lah
total 153M
drwxrwxr-x  2 creynolds creynolds   68 Jun 23 08:38 .
drwxrwxr-x 13 creynolds creynolds  192 Jun 16 20:34 ..
-rw-r--r--  1 root      root      153M Jun 23 08:38 output.mkv
[creynolds@masterblaster ~]$ nvidia-smi
Wed Jun 23 08:38:26 2021
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 460.84       Driver Version: 460.84       CUDA Version: 11.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Quadro P2000        Off  | 00000000:01:00.0 Off |                  N/A |
| 47%   38C    P0    28W /  75W |    139MiB /  5059MiB |      6%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A     12834      C   ffmpeg                            135MiB |
+-----------------------------------------------------------------------------+

Also, when I was testing myself, I thought I would have to add the configure options from this pull to support more cards, but it seems fine how it is. https://github.com/pecord/FFmpeg/pull/1

Last comment was helpful here for that, compiled ok but again; does not seem to matter right now. https://github.com/NVIDIA/cuda-samples/issues/46

 you can just add --nvccflags="-gencode arch=compute_75,code=sm_75 -O2"