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.37k stars 450 forks source link

Core dumped in alpine 3.4 and newer #172

Open gecube opened 5 years ago

gecube commented 5 years ago

Good day!

I tried to use these images. They are awesome. But after some time I faced with size issues. I need the smallest possible image with ffmpeg and python. So I tried to switch to alpine version of jrottenberg/ffmpeg. Unfortunately, all versions starting from 3.4-alpine (i.e. - jrottenberg/ffmpeg:3.4-alpine, jrottenberg/ffmpeg:4.0-alpine and jrottenberg/ffmpeg:4.1-alpine`) dump core:

ffmpeg version 3.4.6 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 6.4.0 (Alpine 6.4.0)
  configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libass --enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-libkvazaar --enable-postproc --enable-small --enable-version3 --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib --extra-libs=-ldl --prefix=/opt/ffmpeg
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './cheese.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Media Server
    encoder         : Lavf56.40.101
  Duration: 00:04:59.05, start: 0.000000, bitrate: 2414 kb/s
    Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuvj420p(pc, bt709), 3840x2160 [SAR 1:1 DAR 16:9], 2409 kb/s, 0.50 fps, 1 tbr, 16384 tbn, 2 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 12 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
Output #0, image2, to './screen.jpg':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Media Server
    encoder         : Lavf57.83.100
    Stream #0:0(und): Video: mjpeg, yuvj420p(pc), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 1 fps, 1 tbn, 1 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc57.107.100 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
Segmentation fault (core dumped)

jrottenberg/ffmpeg:3.3-alpine works like a charm. I believe it is some incompatible version of ffmpeg

jrottenberg commented 5 years ago

Oh ! That's interesting, can you share the input command ?

$ docker run  jrottenberg/ffmpeg:3.4-alpine -stats  -i http://archive.org/download/thethreeagesbusterkeaton/Buster.Keaton.The.Three.Ages.ogv      -loop 0       -final_delay 500 -c:v gif -f gif -ss 00:49:42 -t 5 - > trow_ball.gif
$ docker run  jrottenberg/ffmpeg:4.0-alpine -stats  -i http://archive.org/download/thethreeagesbusterkeaton/Buster.Keaton.The.Three.Ages.ogv       -loop 0     -final_delay 500 -c:v gif -f gif -ss 00:49:42 -t 5 - > trow_ball.gif
$ docker run  jrottenberg/ffmpeg:4.1-alpine -stats -i http://archive.org/download/thethreeagesbusterkeaton/Buster.Keaton.The.Three.Ages.ogv      -loop 0  -final_delay 500 -c:v gif -f gif -ss 00:49:42 -t 5 - > trow_ball.gif

Those went fine, so I might need to adjust my test if it didn't catch the segfault...

gecube commented 5 years ago

I used -q:v key, so it looks like I faced the same issue as here: https://github.com/jrottenberg/ffmpeg/issues/104

jrottenberg commented 5 years ago

same fix as #104 ok ? I'll probably document that in the README for now.

gecube commented 5 years ago

I believe that we should do deeper fix, because any user of alpine distro could face the same issue with another combination of command-line options. Did you check - do developers of ffmpeg or alpine know of the issue? And what do you offer as solution?