Opened 6 years ago

Closed 4 years ago

#5374 closed defect (fixed)

Infinite loop in paletteuse on pix_fmt change

Reported by: zettich Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords: paletteuse deadlock
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

I'm trying to create GIF from series of JPG images using palette but processing completely stall. I'm using last static build (http://johnvansickle.com/ffmpeg/). Same behavior reproduced on older build (I'm try some 2015 year release), also 32 and 64 bit builds. I tries to resize pictures, remove EXIF data, change colorspace.

I'm using Debian (3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u6 (2015-11-09) x86_64 GNU/Linux) on VMWare.

Firstly i'm generating a palette:

ffmpeg -nostdin -i 6659679_%04d.jpg -vf palettegen -y palette.png

Next I'm trying to create GIF:

ffmpeg -y -framerate 2 -i 6659679_%04d.jpg -i palette.png -lavfi paletteuse 6659679.gif

And got ffmpeg stall on second frame:

ffmpeg version 2.6.5 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-avresample --disable-htmlpages --disable-podpages --enable-libutvideo --enable-libfdk-aac --enable-libx265 --enable-libiec61883 --enable-vaapi --enable-libdc1394 --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 25.101 / 56. 25.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 11.102
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
[mjpeg @ 0x1533aa0] Changeing bps to 8
Input #0, image2, from '6659679_%04d.jpg':
  Duration: 00:00:01.50, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 652x386 [SAR 72:72 DAR 326:193], 2 fps, 2 tbr, 2 tbn, 2 tbc
Input #1, png_pipe, from 'palette.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, rgba, 16x16 [SAR 1:1 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
[swscaler @ 0x1528ee0] deprecated pixel format used, make sure you did set range correctly
Output #0, gif, to '6659679.gif':
  Metadata:
    encoder         : Lavf56.25.101
    Stream #0:0: Video: gif, pal8, 652x386 [SAR 1:1 DAR 326:193], q=2-31, 200 kb/s, 2 fps, 100 tbn, 2 tbc (default)
    Metadata:
      encoder         : Lavc56.26.100 gif
Stream mapping:
  Stream #0:0 (mjpeg) -> paletteuse:default
  Stream #1:0 (png) -> paletteuse:palette
  paletteuse -> Stream #0:0 (gif)
Press [q] to stop, [?] for help
Input stream #0:0 frame changed from size:652x386 fmt:yuvj420p to size:652x386 fmt:yuvj444p
[swscaler @ 0x150ac80] deprecated pixel format used, make sure you did set range correctly
Input stream #0:0 frame changed from size:652x386 fmt:yuvj444p to size:652x386 fmt:yuvj420p
[swscaler @ 0x150ac80] deprecated pixel format used, make sure you did set range correctly
frame=    2 fps=0.2 q=0.0 size=     140kB time=00:00:01.00 bitrate=1144.1kbits/s  

My JPEGs: http://zettich.com/images.tgz

Attachments (1)

images.tgz (196.7 KB ) - added by zettich 6 years ago.
jpegs

Download all attachments as: .zip

Change History (5)

by zettich, 6 years ago

Attachment: images.tgz added

jpegs

comment:1 by Carl Eugen Hoyos, 6 years ago

Priority: importantnormal

If the issue is reproducible with current FFmpeg, please provide the console output for current FFmpeg. Nothing else is supported except for regressions or security issues.

comment:2 by zettich, 6 years ago

Sorry

f/ffmpeg-git-20160323-64bit-static/ffmpeg -y -framerate 2 -i 6659679_%04d.jpg -i palette.png -lavfi paletteuse 6659679.gif 
ffmpeg version N-53602-g65cff81-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.1 (Debian 5.3.1-12) 20160316
  configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --enable-frei0r --enable-libfribidi --disable-indev=sndio --disable-outdev=sndio --enable-librtmp --enable-libmfx --cc=gcc
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 30.100 / 57. 30.100
  libavformat    57. 29.100 / 57. 29.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 39.102 /  6. 39.102
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, image2, from '6659679_%04d.jpg':
  Duration: 00:00:01.50, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 652x386 [SAR 72:72 DAR 326:193], 2 fps, 2 tbr, 2 tbn, 2 tbc
Input #1, png_pipe, from 'palette.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, rgba(pc), 16x16 [SAR 1:1 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
[swscaler @ 0x5315600] deprecated pixel format used, make sure you did set range correctly
Output #0, gif, to '6659679.gif':
  Metadata:
    encoder         : Lavf57.29.100
    Stream #0:0: Video: gif, pal8, 652x386 [SAR 1:1 DAR 326:193], q=2-31, 200 kb/s, 2 fps, 100 tbn, 2 tbc (default)
    Metadata:
      encoder         : Lavc57.30.100 gif
Stream mapping:
  Stream #0:0 (mjpeg) -> paletteuse:default
  Stream #1:0 (png) -> paletteuse:palette
  paletteuse -> Stream #0:0 (gif)
Press [q] to stop, [?] for help
Input stream #0:0 frame changed from size:652x386 fmt:yuvj420p to size:652x386 fmt:yuvj444p
[swscaler @ 0x52feec0] deprecated pixel format used, make sure you did set range correctly
Input stream #0:0 frame changed from size:652x386 fmt:yuvj444p to size:652x386 fmt:yuvj420p
[swscaler @ 0x52feec0] deprecated pixel format used, make sure you did set range correctly
frame=    2 fps=1.0 q=-0.0 size=      42kB time=00:00:01.00 bitrate= 346.1kbits/s speed=0.495x 

comment:3 by Carl Eugen Hoyos, 6 years ago

Component: undeterminedavfilter
Keywords: deadlock added; gif palettegen jpg removed
Reproduced by developer: set
Status: newopen
Summary: Processing stall during generate GIF from series of JPG using paletteInfinite loop in paletteuse on pix_fmt change

comment:4 by Elon Musk, 4 years ago

Resolution: fixed
Status: openclosed

Loop have been fixed.

Use movie filter instead:
ffmpeg -i 6659679_%04d.jpg -lavfi "movie=palette.png[p],[0:v][p]paletteuse" 6659679.gif

Note: See TracTickets for help on using tickets.